[pLog-svn] r7027 - in plog/branches/lifetype-1.2/js/tinymce: . langs plugins themes themes/advanced themes/advanced/img themes/advanced/js themes/advanced/langs themes/advanced/skins themes/advanced/skins/default themes/advanced/skins/default/img themes/advanced/skins/o2k7 themes/advanced/skins/o2k7/img utils

jondaley at devel.lifetype.net jondaley at devel.lifetype.net
Tue Sep 21 19:00:22 EDT 2010


Author: jondaley
Date: 2010-09-21 19:00:22 -0400 (Tue, 21 Sep 2010)
New Revision: 7027

Added:
   plog/branches/lifetype-1.2/js/tinymce/themes/advanced/img/
   plog/branches/lifetype-1.2/js/tinymce/themes/advanced/img/colorpicker.jpg
   plog/branches/lifetype-1.2/js/tinymce/themes/advanced/img/icons.gif
   plog/branches/lifetype-1.2/js/tinymce/themes/advanced/js/
   plog/branches/lifetype-1.2/js/tinymce/themes/advanced/langs/en_dlg.js
   plog/branches/lifetype-1.2/js/tinymce/themes/advanced/skins/
   plog/branches/lifetype-1.2/js/tinymce/themes/advanced/skins/default/
   plog/branches/lifetype-1.2/js/tinymce/themes/advanced/skins/default/content.css
   plog/branches/lifetype-1.2/js/tinymce/themes/advanced/skins/default/dialog.css
   plog/branches/lifetype-1.2/js/tinymce/themes/advanced/skins/default/img/
   plog/branches/lifetype-1.2/js/tinymce/themes/advanced/skins/default/img/buttons.png
   plog/branches/lifetype-1.2/js/tinymce/themes/advanced/skins/default/img/items.gif
   plog/branches/lifetype-1.2/js/tinymce/themes/advanced/skins/default/img/menu_arrow.gif
   plog/branches/lifetype-1.2/js/tinymce/themes/advanced/skins/default/img/menu_check.gif
   plog/branches/lifetype-1.2/js/tinymce/themes/advanced/skins/default/img/progress.gif
   plog/branches/lifetype-1.2/js/tinymce/themes/advanced/skins/default/img/tabs.gif
   plog/branches/lifetype-1.2/js/tinymce/themes/advanced/skins/default/ui.css
   plog/branches/lifetype-1.2/js/tinymce/themes/advanced/skins/o2k7/
   plog/branches/lifetype-1.2/js/tinymce/themes/advanced/skins/o2k7/content.css
   plog/branches/lifetype-1.2/js/tinymce/themes/advanced/skins/o2k7/dialog.css
   plog/branches/lifetype-1.2/js/tinymce/themes/advanced/skins/o2k7/img/
   plog/branches/lifetype-1.2/js/tinymce/themes/advanced/skins/o2k7/img/button_bg.png
   plog/branches/lifetype-1.2/js/tinymce/themes/advanced/skins/o2k7/img/button_bg_black.png
   plog/branches/lifetype-1.2/js/tinymce/themes/advanced/skins/o2k7/img/button_bg_silver.png
   plog/branches/lifetype-1.2/js/tinymce/themes/advanced/skins/o2k7/ui.css
   plog/branches/lifetype-1.2/js/tinymce/themes/advanced/skins/o2k7/ui_black.css
   plog/branches/lifetype-1.2/js/tinymce/themes/advanced/skins/o2k7/ui_silver.css
   plog/branches/lifetype-1.2/js/tinymce/tiny_mce_gzip.js
Removed:
   plog/branches/lifetype-1.2/js/tinymce/blank.htm
   plog/branches/lifetype-1.2/js/tinymce/langs/readme.txt
   plog/branches/lifetype-1.2/js/tinymce/plugins/directionality/
   plog/branches/lifetype-1.2/js/tinymce/plugins/emotions/
   plog/branches/lifetype-1.2/js/tinymce/plugins/fullscreen/
   plog/branches/lifetype-1.2/js/tinymce/plugins/inlinepopups/
   plog/branches/lifetype-1.2/js/tinymce/plugins/insertdatetime/
   plog/branches/lifetype-1.2/js/tinymce/plugins/readme.txt
   plog/branches/lifetype-1.2/js/tinymce/plugins/table/
   plog/branches/lifetype-1.2/js/tinymce/themes/advanced/css/
   plog/branches/lifetype-1.2/js/tinymce/themes/advanced/docs/
   plog/branches/lifetype-1.2/js/tinymce/themes/advanced/images/
   plog/branches/lifetype-1.2/js/tinymce/themes/advanced/jscripts/
   plog/branches/lifetype-1.2/js/tinymce/themes/simple/
   plog/branches/lifetype-1.2/js/tinymce/utils/mclayer.js
Modified:
   plog/branches/lifetype-1.2/js/tinymce/langs/en.js
   plog/branches/lifetype-1.2/js/tinymce/themes/advanced/about.htm
   plog/branches/lifetype-1.2/js/tinymce/themes/advanced/anchor.htm
   plog/branches/lifetype-1.2/js/tinymce/themes/advanced/charmap.htm
   plog/branches/lifetype-1.2/js/tinymce/themes/advanced/color_picker.htm
   plog/branches/lifetype-1.2/js/tinymce/themes/advanced/editor_template.js
   plog/branches/lifetype-1.2/js/tinymce/themes/advanced/editor_template_src.js
   plog/branches/lifetype-1.2/js/tinymce/themes/advanced/image.htm
   plog/branches/lifetype-1.2/js/tinymce/themes/advanced/js/about.js
   plog/branches/lifetype-1.2/js/tinymce/themes/advanced/js/anchor.js
   plog/branches/lifetype-1.2/js/tinymce/themes/advanced/js/charmap.js
   plog/branches/lifetype-1.2/js/tinymce/themes/advanced/js/color_picker.js
   plog/branches/lifetype-1.2/js/tinymce/themes/advanced/js/image.js
   plog/branches/lifetype-1.2/js/tinymce/themes/advanced/js/link.js
   plog/branches/lifetype-1.2/js/tinymce/themes/advanced/js/source_editor.js
   plog/branches/lifetype-1.2/js/tinymce/themes/advanced/langs/en.js
   plog/branches/lifetype-1.2/js/tinymce/themes/advanced/link.htm
   plog/branches/lifetype-1.2/js/tinymce/themes/advanced/source_editor.htm
   plog/branches/lifetype-1.2/js/tinymce/tiny_mce-plog.js
   plog/branches/lifetype-1.2/js/tinymce/tiny_mce.js
   plog/branches/lifetype-1.2/js/tinymce/tiny_mce_gzip.php
   plog/branches/lifetype-1.2/js/tinymce/tiny_mce_popup.js
   plog/branches/lifetype-1.2/js/tinymce/tiny_mce_src.js
   plog/branches/lifetype-1.2/js/tinymce/utils/editable_selects.js
   plog/branches/lifetype-1.2/js/tinymce/utils/form_utils.js
   plog/branches/lifetype-1.2/js/tinymce/utils/mctabs.js
   plog/branches/lifetype-1.2/js/tinymce/utils/validate.js
Log:
our version of tinymce doesn't work with the newer versions of firefox... guess that means it is time to upgrade

Deleted: plog/branches/lifetype-1.2/js/tinymce/blank.htm
===================================================================
--- plog/branches/lifetype-1.2/js/tinymce/blank.htm	2010-09-21 21:29:55 UTC (rev 7026)
+++ plog/branches/lifetype-1.2/js/tinymce/blank.htm	2010-09-21 23:00:22 UTC (rev 7027)
@@ -1,9 +0,0 @@
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-	<title>blank_page</title>
-	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
-</head>
-<body class="mceContentBody">
-
-</body>
-</html>

Modified: plog/branches/lifetype-1.2/js/tinymce/langs/en.js
===================================================================
--- plog/branches/lifetype-1.2/js/tinymce/langs/en.js	2010-09-21 21:29:55 UTC (rev 7026)
+++ plog/branches/lifetype-1.2/js/tinymce/langs/en.js	2010-09-21 23:00:22 UTC (rev 7027)
@@ -1,41 +1,170 @@
-// UK lang variables
-
-tinyMCE.addToLang('',{
-bold_desc : 'Bold (Ctrl+B)',
-italic_desc : 'Italic (Ctrl+I)',
-underline_desc : 'Underline (Ctrl+U)',
-striketrough_desc : 'Strikethrough',
-justifyleft_desc : 'Align left',
-justifycenter_desc : 'Align center',
-justifyright_desc : 'Align right',
-justifyfull_desc : 'Align full',
-bullist_desc : 'Unordered list',
-numlist_desc : 'Ordered list',
-outdent_desc : 'Outdent',
-indent_desc : 'Indent',
-undo_desc : 'Undo (Ctrl+Z)',
-redo_desc : 'Redo (Ctrl+Y)',
-link_desc : 'Insert/edit link',
-unlink_desc : 'Unlink',
-image_desc : 'Insert/edit image',
-cleanup_desc : 'Cleanup messy code',
-focus_alert : 'A editor instance must be focused before using this command.',
-edit_confirm : 'Do you want to use the WYSIWYG mode for this textarea?',
-insert_link_title : 'Insert/edit link',
-insert : 'Insert',
-update : 'Update',
-cancel : 'Cancel',
-insert_link_url : 'Link URL',
-insert_link_target : 'Target',
-insert_link_target_same : 'Open link in the same window',
-insert_link_target_blank : 'Open link in a new window',
-insert_image_title : 'Insert/edit image',
-insert_image_src : 'Image URL',
-insert_image_alt : 'Image description',
-help_desc : 'Help',
-bold_img : "bold.gif",
-italic_img : "italic.gif",
-underline_img : "underline.gif",
-clipboard_msg : 'Copy/Cut/Paste is not available in Mozilla and Firefox.\nDo you want more information about this issue?',
-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.'
-});
+tinyMCE.addI18n({en:{
+common:{
+edit_confirm:"Do you want to use the WYSIWYG mode for this textarea?",
+apply:"Apply",
+insert:"Insert",
+update:"Update",
+cancel:"Cancel",
+close:"Close",
+browse:"Browse",
+class_name:"Class",
+not_set:"-- Not set --",
+clipboard_msg:"Copy/Cut/Paste is not available in Mozilla and Firefox.\nDo you want more information about this issue?",
+clipboard_no_support:"Currently not supported by your browser, use keyboard shortcuts instead.",
+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.",
+invalid_data:"Error: Invalid values entered, these are marked in red.",
+more_colors:"More colors"
+},
+contextmenu:{
+align:"Alignment",
+left:"Left",
+center:"Center",
+right:"Right",
+full:"Full"
+},
+insertdatetime:{
+date_fmt:"%Y-%m-%d",
+time_fmt:"%H:%M:%S",
+insertdate_desc:"Insert date",
+inserttime_desc:"Insert time",
+months_long:"January,February,March,April,May,June,July,August,September,October,November,December",
+months_short:"Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec",
+day_long:"Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday,Sunday",
+day_short:"Sun,Mon,Tue,Wed,Thu,Fri,Sat,Sun"
+},
+print:{
+print_desc:"Print"
+},
+preview:{
+preview_desc:"Preview"
+},
+directionality:{
+ltr_desc:"Direction left to right",
+rtl_desc:"Direction right to left"
+},
+layer:{
+insertlayer_desc:"Insert new layer",
+forward_desc:"Move forward",
+backward_desc:"Move backward",
+absolute_desc:"Toggle absolute positioning",
+content:"New layer..."
+},
+save:{
+save_desc:"Save",
+cancel_desc:"Cancel all changes"
+},
+nonbreaking:{
+nonbreaking_desc:"Insert non-breaking space character"
+},
+iespell:{
+iespell_desc:"Run spell checking",
+download:"ieSpell not detected. Do you want to install it now?"
+},
+advhr:{
+advhr_desc:"Horizontal rule"
+},
+emotions:{
+emotions_desc:"Emotions"
+},
+searchreplace:{
+search_desc:"Find",
+replace_desc:"Find/Replace"
+},
+advimage:{
+image_desc:"Insert/edit image"
+},
+advlink:{
+link_desc:"Insert/edit link"
+},
+xhtmlxtras:{
+cite_desc:"Citation",
+abbr_desc:"Abbreviation",
+acronym_desc:"Acronym",
+del_desc:"Deletion",
+ins_desc:"Insertion",
+attribs_desc:"Insert/Edit Attributes"
+},
+style:{
+desc:"Edit CSS Style"
+},
+paste:{
+paste_text_desc:"Paste as Plain Text",
+paste_word_desc:"Paste from Word",
+selectall_desc:"Select All",
+plaintext_mode_sticky:"Paste is now in plain text mode. Click again to toggle back to regular paste mode. After you paste something you will be returned to regular paste mode.",
+plaintext_mode:"Paste is now in plain text mode. Click again to toggle back to regular paste mode."
+},
+paste_dlg:{
+text_title:"Use CTRL+V on your keyboard to paste the text into the window.",
+text_linebreaks:"Keep linebreaks",
+word_title:"Use CTRL+V on your keyboard to paste the text into the window."
+},
+table:{
+desc:"Inserts a new table",
+row_before_desc:"Insert row before",
+row_after_desc:"Insert row after",
+delete_row_desc:"Delete row",
+col_before_desc:"Insert column before",
+col_after_desc:"Insert column after",
+delete_col_desc:"Remove column",
+split_cells_desc:"Split merged table cells",
+merge_cells_desc:"Merge table cells",
+row_desc:"Table row properties",
+cell_desc:"Table cell properties",
+props_desc:"Table properties",
+paste_row_before_desc:"Paste table row before",
+paste_row_after_desc:"Paste table row after",
+cut_row_desc:"Cut table row",
+copy_row_desc:"Copy table row",
+del:"Delete table",
+row:"Row",
+col:"Column",
+cell:"Cell"
+},
+autosave:{
+unload_msg:"The changes you made will be lost if you navigate away from this page.",
+restore_content:"Restore auto-saved content.",
+warning_message:"If you restore the saved content, you will lose all the content that is currently in the editor.\n\nAre you sure you want to restore the saved content?."
+},
+fullscreen:{
+desc:"Toggle fullscreen mode"
+},
+media:{
+desc:"Insert / edit embedded media",
+edit:"Edit embedded media"
+},
+fullpage:{
+desc:"Document properties"
+},
+template:{
+desc:"Insert predefined template content"
+},
+visualchars:{
+desc:"Visual control characters on/off."
+},
+spellchecker:{
+desc:"Toggle spellchecker",
+menu:"Spellchecker settings",
+ignore_word:"Ignore word",
+ignore_words:"Ignore all",
+langs:"Languages",
+wait:"Please wait...",
+sug:"Suggestions",
+no_sug:"No suggestions",
+no_mpell:"No misspellings found."
+},
+pagebreak:{
+desc:"Insert page break."
+},
+advlist:{
+types:"Types",
+def:"Default",
+lower_alpha:"Lower alpha",
+lower_greek:"Lower greek",
+lower_roman:"Lower roman",
+upper_alpha:"Upper alpha",
+upper_roman:"Upper roman",
+circle:"Circle",
+disc:"Disc",
+square:"Square"
+}}});
\ No newline at end of file

Deleted: plog/branches/lifetype-1.2/js/tinymce/langs/readme.txt
===================================================================
--- plog/branches/lifetype-1.2/js/tinymce/langs/readme.txt	2010-09-21 21:29:55 UTC (rev 7026)
+++ plog/branches/lifetype-1.2/js/tinymce/langs/readme.txt	2010-09-21 23:00:22 UTC (rev 7027)
@@ -1,9 +0,0 @@
-Beginning with version 2.0.5 the language packs are no
-longer included with the core distribution.
-Language packs can be downloaded from the TinyMCE website:
-http://tinymce.moxiecode.com/download.php
-
-The language pack codes are based on ISO-639-1:
-http://www.loc.gov/standards/iso639-2/englangn.html
-
-Plrease try using entities if possible. Like &aring; etc for non a-z characters.

Deleted: plog/branches/lifetype-1.2/js/tinymce/plugins/readme.txt
===================================================================
--- plog/branches/lifetype-1.2/js/tinymce/plugins/readme.txt	2010-09-21 21:29:55 UTC (rev 7026)
+++ plog/branches/lifetype-1.2/js/tinymce/plugins/readme.txt	2010-09-21 23:00:22 UTC (rev 7027)
@@ -1 +0,0 @@
-This is the location you place TinyMCE plugins.

Modified: plog/branches/lifetype-1.2/js/tinymce/themes/advanced/about.htm
===================================================================
--- plog/branches/lifetype-1.2/js/tinymce/themes/advanced/about.htm	2010-09-21 21:29:55 UTC (rev 7026)
+++ plog/branches/lifetype-1.2/js/tinymce/themes/advanced/about.htm	2010-09-21 23:00:22 UTC (rev 7027)
@@ -1,35 +1,39 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
 <html xmlns="http://www.w3.org/1999/xhtml">
 <head>
-	<title>{$lang_about_title}</title>
-	<script language="javascript" type="text/javascript" src="../../tiny_mce_popup.js"></script>
-	<script language="javascript" type="text/javascript" src="../../utils/mctabs.js"></script>
-	<script language="javascript" type="text/javascript" src="jscripts/about.js"></script>
-	<base target="_self" />
+	<title>{#advanced_dlg.about_title}</title>
+	<script type="text/javascript" src="../../tiny_mce_popup.js"></script>
+	<script type="text/javascript" src="../../utils/mctabs.js"></script>
+	<script type="text/javascript" src="js/about.js"></script>
 </head>
-<body id="about" onload="tinyMCEPopup.executeOnLoad('init();');" style="display: none">
+<body id="about" style="display: none">
 		<div class="tabs">
 			<ul>
-				<li id="general_tab" class="current"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{$lang_about}</a></span></li>
-				<li id="help_tab"><span><a href="javascript:mcTabs.displayTab('help_tab','help_panel');" onmousedown="return false;">{$lang_help}</a></span></li>
-				<li id="plugins_tab"><span><a href="javascript:mcTabs.displayTab('plugins_tab','plugins_panel');" onmousedown="return false;">{$lang_plugins}</a></span></li>
+				<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>
+				<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>
+				<li id="plugins_tab"><span><a href="javascript:mcTabs.displayTab('plugins_tab','plugins_panel');" onmousedown="return false;">{#advanced_dlg.about_plugins}</a></span></li>
 			</ul>
 		</div>
 
 		<div class="panel_wrapper">
 			<div id="general_panel" class="panel current">
-				<h3>{$lang_about_title}</h3>
-				<p>Version: {$tinymce_version} ({$tinymce_releasedate})</p>
+				<h3>{#advanced_dlg.about_title}</h3>
+				<p>Version: <span id="version"></span> (<span id="date"></span>)</p>
 				<p>TinyMCE is a platform independent web based Javascript HTML WYSIWYG editor control released as Open Source under <a href="../../license.txt" target="_blank">LGPL</a>
 				by Moxiecode Systems AB. It has the ability to convert HTML TEXTAREA fields or other HTML elements to editor instances.</p>
-				<p>Copyright &copy; 2003-2007, <a href="http://www.moxiecode.com" target="_blank">Moxiecode Systems AB</a>, All rights reserved.</p>
+				<p>Copyright &copy; 2003-2008, <a href="http://www.moxiecode.com" target="_blank">Moxiecode Systems AB</a>, All rights reserved.</p>
 				<p>For more information about this software visit the <a href="http://tinymce.moxiecode.com" target="_blank">TinyMCE website</a>.</p>
 
-				<div id="buttoncontainer"></div>
+				<div id="buttoncontainer">
+					<a href="http://www.moxiecode.com" target="_blank"><img src="http://tinymce.moxiecode.com/images/gotmoxie.png" alt="Got Moxie?" border="0" /></a>
+					<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>
+					<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>
+				</div>
 			</div>
 
 			<div id="plugins_panel" class="panel">
 				<div id="pluginscontainer">
-					<h3>{$lang_loaded_plugins}</h3>
+					<h3>{#advanced_dlg.about_loaded}</h3>
 
 					<div id="plugintablecontainer">
 					</div>
@@ -44,9 +48,7 @@
 		</div>
 
 		<div class="mceActionPanel">
-			<div style="float: right">
-				<input type="button" id="cancel" name="cancel" value="{$lang_close}" onclick="tinyMCEPopup.close();" />
-			</div>
+			<input type="button" id="cancel" name="cancel" value="{#close}" onclick="tinyMCEPopup.close();" />
 		</div>
 </body>
 </html>

Modified: plog/branches/lifetype-1.2/js/tinymce/themes/advanced/anchor.htm
===================================================================
--- plog/branches/lifetype-1.2/js/tinymce/themes/advanced/anchor.htm	2010-09-21 21:29:55 UTC (rev 7026)
+++ plog/branches/lifetype-1.2/js/tinymce/themes/advanced/anchor.htm	2010-09-21 23:00:22 UTC (rev 7027)
@@ -1,33 +1,26 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml">
 <head>
-	<title>{$lang_insert_anchor_title}</title>
-	<script language="javascript" type="text/javascript" src="../../tiny_mce_popup.js"></script>
-	<script language="javascript" type="text/javascript" src="jscripts/anchor.js"></script>
-	<base target="_self" />
+	<title>{#advanced_dlg.anchor_title}</title>
+	<script type="text/javascript" src="../../tiny_mce_popup.js"></script>
+	<script type="text/javascript" src="js/anchor.js"></script>
 </head>
-<body onload="tinyMCEPopup.executeOnLoad('init();');" style="display: none">
-<form onsubmit="insertAnchor();return false;" action="#">
-
+<body style="display: none">
+<form onsubmit="AnchorDialog.update();return false;" action="#">
 	<table border="0" cellpadding="4" cellspacing="0">
 		<tr>
-			<td colspan="2" class="title">{$lang_insert_anchor_title}</td>
+			<td colspan="2" class="title">{#advanced_dlg.anchor_title}</td>
 		</tr>
 		<tr>
-			<td nowrap="nowrap">{$lang_insert_anchor_name}:</td>
-			<td><input name="anchorName" type="text" id="anchorName" value="" style="width: 200px" /></td>
+			<td class="nowrap">{#advanced_dlg.anchor_name}:</td>
+			<td><input name="anchorName" type="text" class="mceFocus" id="anchorName" value="" style="width: 200px" /></td>
 		</tr>
 	</table>
 
 	<div class="mceActionPanel">
-		<div style="float: left">
-			<input type="button" id="insert" name="insert" value="{$lang_update}" onclick="insertAnchor();" />
-		</div>
-
-		<div style="float: right">
-			<input type="button" id="cancel" name="cancel" value="{$lang_cancel}" onclick="tinyMCEPopup.close();" />
-		</div>
+		<input type="submit" id="insert" name="insert" value="{#update}" />
+		<input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
 	</div>
-
 </form>
 </body>
 </html>

Modified: plog/branches/lifetype-1.2/js/tinymce/themes/advanced/charmap.htm
===================================================================
--- plog/branches/lifetype-1.2/js/tinymce/themes/advanced/charmap.htm	2010-09-21 21:29:55 UTC (rev 7026)
+++ plog/branches/lifetype-1.2/js/tinymce/themes/advanced/charmap.htm	2010-09-21 23:00:22 UTC (rev 7027)
@@ -1,27 +1,26 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml">
 <head>
-	<title>{$lang_theme_charmap_title}</title>
-	<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
-	<script language="javascript" type="text/javascript" src="../../tiny_mce_popup.js"></script>
-	<script language="javascript" type="text/javascript" src="jscripts/charmap.js"></script>
-	<base target="_self" />
+	<title>{#advanced_dlg.charmap_title}</title>
+	<script type="text/javascript" src="../../tiny_mce_popup.js"></script>
+	<script type="text/javascript" src="js/charmap.js"></script>
 </head>
-<body onload="tinyMCEPopup.executeOnLoad('init();');" style="display: none">
+<body id="charmap" style="display:none">
 <table align="center" border="0" cellspacing="0" cellpadding="2">
     <tr>
-        <td colspan="2" class="title">{$lang_theme_charmap_title}</td>
+        <td colspan="2" class="title">{#advanced_dlg.charmap_title}</td>
     </tr>
     <tr>
-        <td rowspan="2" align="left" valign="top">
-            <script language="javascript" type="text/javascript">renderCharMapHTML();</script>
+        <td id="charmapView" rowspan="2" align="left" valign="top">
+			<!-- Chars will be rendered here -->
         </td>
         <td width="100" align="center" valign="top">
-            <table border="0" cellpadding="0" cellspacing="0" width="100" style="height: 100px">
+            <table border="0" cellpadding="0" cellspacing="0" width="100" style="height:100px">
                 <tr>
-                    <td class="charmapOver" style="font-size: 40px; height:80px;" id="codeV">&nbsp;</td>
+                    <td id="codeV">&nbsp;</td>
                 </tr>
                 <tr>
-                    <td style="font-size: 10px; font-family: Arial, Helvetica, sans-serif; text-align:center;" id="codeN">&nbsp;</td>
+                    <td id="codeN">&nbsp;</td>
                 </tr>
             </table>
         </td>

Modified: plog/branches/lifetype-1.2/js/tinymce/themes/advanced/color_picker.htm
===================================================================
--- plog/branches/lifetype-1.2/js/tinymce/themes/advanced/color_picker.htm	2010-09-21 21:29:55 UTC (rev 7026)
+++ plog/branches/lifetype-1.2/js/tinymce/themes/advanced/color_picker.htm	2010-09-21 23:00:22 UTC (rev 7027)
@@ -1,27 +1,27 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml">
 <head>
-	<title>{$lang_theme_colorpicker_title}</title>
-	<script language="javascript" type="text/javascript" src="../../tiny_mce_popup.js"></script>
-	<script language="javascript" type="text/javascript" src="../../utils/mctabs.js"></script>
-	<script language="javascript" type="text/javascript" src="jscripts/color_picker.js"></script>
-	<link href="css/colorpicker.css" rel="stylesheet" type="text/css" />
-	<base target="_self" />
+	<title>{#advanced_dlg.colorpicker_title}</title>
+	<script type="text/javascript" src="../../tiny_mce_popup.js"></script>
+	<script type="text/javascript" src="../../utils/mctabs.js"></script>
+	<script type="text/javascript" src="js/color_picker.js"></script>
 </head>
-<body onload="tinyMCEPopup.executeOnLoad('init();');" style="display: none">
+<body id="colorpicker" style="display: none">
+<form onsubmit="insertAction();return false" action="#">
 	<div class="tabs">
 		<ul>
-			<li id="picker_tab" class="current"><span><a href="javascript:mcTabs.displayTab('picker_tab','picker_panel');" onmousedown="return false;">{$lang_color_picker_tab}</a></span></li>
-			<li id="rgb_tab"><span><a href="#" onclick="generateWebColors();mcTabs.displayTab('rgb_tab','rgb_panel');" onmousedown="return false;">{$lang_web_colors_tab}</a></span></li>
-			<li id="named_tab"><span><a  href="#" onclick="generateNamedColors();javascript:mcTabs.displayTab('named_tab','named_panel');" onmousedown="return false;">{$lang_named_colors_tab}</a></span></li>
+			<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>
+			<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>
+			<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>
 		</ul>
 	</div>
 
 	<div class="panel_wrapper">
 		<div id="picker_panel" class="panel current">
 			<fieldset>
-				<legend>{$lang_color_picker}</legend>
+				<legend>{#advanced_dlg.colorpicker_picker_title}</legend>
 				<div id="picker">
-					<img id="colorpicker" src="images/colors.jpg" onclick="computeColor(event)" onmousedown="isMouseDown = true;return false;" onmouseup="isMouseDown = false;" onmousemove="if (isMouseDown && isMouseOver) computeColor(event); return false;" onmouseover="isMouseOver=true;" onmouseout="isMouseOver=false;" />
+					<img id="colors" src="img/colorpicker.jpg" onclick="computeColor(event)" onmousedown="isMouseDown = true;return false;" onmouseup="isMouseDown = false;" onmousemove="if (isMouseDown && isMouseOver) computeColor(event); return false;" onmouseover="isMouseOver=true;" onmouseout="isMouseOver=false;" alt="" />
 
 					<div id="light">
 						<!-- Will be filled with divs -->
@@ -34,7 +34,7 @@
 
 		<div id="rgb_panel" class="panel">
 			<fieldset>
-				<legend>{$lang_web_colors}</legend>
+				<legend>{#advanced_dlg.colorpicker_palette_title}</legend>
 				<div id="webcolors">
 					<!-- Gets filled with web safe colors-->
 				</div>
@@ -45,7 +45,7 @@
 
 		<div id="named_panel" class="panel">
 			<fieldset>
-				<legend>{$lang_named_colors}</legend>
+				<legend>{#advanced_dlg.colorpicker_named_title}</legend>
 				<div id="namedcolors">
 					<!-- Gets filled with named colors-->
 				</div>
@@ -53,22 +53,21 @@
 				<br style="clear: both" />
 
 				<div id="colornamecontainer">
-					{$lang_color_name} <span id="colorname"></span>
+					{#advanced_dlg.colorpicker_name} <span id="colorname"></span>
 				</div>
 			</fieldset>
 		</div>
 	</div>
 
 	<div class="mceActionPanel">
-		<div style="float: left">
-			<input type="button" id="insert" name="insert" value="{$lang_theme_colorpicker_apply}" onclick="insertAction();" />
-		</div>
+		<input type="submit" id="insert" name="insert" value="{#apply}" />
 
 		<div id="preview"></div>
 
 		<div id="previewblock">
-			<label for="color">{$lang_color}</label> <input id="color" type="text" size="8" maxlength="8" class="text" />
+			<label for="color">{#advanced_dlg.colorpicker_color}</label> <input id="color" type="text" size="8" maxlength="8" class="text mceFocus" />
 		</div>
 	</div>
+</form>
 </body>
 </html>

Modified: plog/branches/lifetype-1.2/js/tinymce/themes/advanced/editor_template.js
===================================================================
--- plog/branches/lifetype-1.2/js/tinymce/themes/advanced/editor_template.js	2010-09-21 21:29:55 UTC (rev 7026)
+++ plog/branches/lifetype-1.2/js/tinymce/themes/advanced/editor_template.js	2010-09-21 23:00:22 UTC (rev 7027)
@@ -1 +1 @@
-tinyMCE.importThemeLanguagePack('advanced');var TinyMCE_AdvancedTheme={_defColors:"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",_autoImportCSSClasses:true,_resizer:{},_buttons:[['bold','{$lang_bold_img}','lang_bold_desc','Bold'],['italic','{$lang_italic_img}','lang_italic_desc','Italic'],['underline','{$lang_underline_img}','lang_underline_desc','Underline'],['strikethrough','strikethrough.gif','lang_striketrough_desc','Strikethrough'],['justifyleft','justifyleft.gif','lang_justifyleft_desc','JustifyLeft'],['justifycenter','justifycenter.gif','lang_justifycenter_desc','JustifyCenter'],['justifyright','justifyright.gif','lang_justifyright_desc','JustifyRight'],['justifyfull','justifyfull.gif','lang_justifyfull_desc','JustifyFull'],['bullist','b
 ullist.gif','lang_bullist_desc','InsertUnorderedList'],['numlist','numlist.gif','lang_numlist_desc','InsertOrderedList'],['outdent','outdent.gif','lang_outdent_desc','Outdent'],['indent','indent.gif','lang_indent_desc','Indent'],['cut','cut.gif','lang_cut_desc','Cut'],['copy','copy.gif','lang_copy_desc','Copy'],['paste','paste.gif','lang_paste_desc','Paste'],['undo','undo.gif','lang_undo_desc','Undo'],['redo','redo.gif','lang_redo_desc','Redo'],['link','link.gif','lang_link_desc','mceLink',true],['unlink','unlink.gif','lang_unlink_desc','unlink'],['image','image.gif','lang_image_desc','mceImage',true],['cleanup','cleanup.gif','lang_cleanup_desc','mceCleanup'],['help','help.gif','lang_help_desc','mceHelp'],['code','code.gif','lang_theme_code_desc','mceCodeEditor'],['hr','hr.gif','lang_theme_hr_desc','inserthorizontalrule'],['removeformat','removeformat.gif','lang_theme_removeformat_desc','removeformat'],['sub','sub.gif','lang_theme_sub_desc','subscript'],['sup','sup.gif','lan
 g_theme_sup_desc','superscript'],['forecolor','forecolor.gif','lang_theme_forecolor_desc','forecolor',true],['forecolorpicker','forecolor.gif','lang_theme_forecolor_desc','forecolorpicker',true],['backcolor','backcolor.gif','lang_theme_backcolor_desc','HiliteColor',true],['backcolorpicker','backcolor.gif','lang_theme_backcolor_desc','backcolorpicker',true],['charmap','charmap.gif','lang_theme_charmap_desc','mceCharMap'],['visualaid','visualaid.gif','lang_theme_visualaid_desc','mceToggleVisualAid'],['anchor','anchor.gif','lang_theme_anchor_desc','mceInsertAnchor'],['newdocument','newdocument.gif','lang_newdocument_desc','mceNewDocument']],_buttonMap:'anchor,backcolor,bold,bullist,charmap,cleanup,code,copy,cut,forecolor,help,hr,image,indent,italic,justifycenter,justifyfull,justifyleft,justifyright,link,newdocument,numlist,outdent,paste,redo,removeformat,strikethrough,sub,sup,underline,undo,unlink,visualaid,advhr,ltr,rtl,emotions,flash,fullpage,fullscreen,iespell,insertdate,ins
 erttime,pastetext,pasteword,selectall,preview,print,save,replace,search,table,cell_props,delete_col,delete_row,col_after,col_before,row_after,row_before,merge_cells,row_props,split_cells,delete_table',getControlHTML:function(button_name){var i,x,but;for(i=0;i<TinyMCE_AdvancedTheme._buttons.length;i++){but=TinyMCE_AdvancedTheme._buttons[i];if(but[0]==button_name&&(button_name=="forecolor"||button_name=="backcolor"))return tinyMCE.getMenuButtonHTML(but[0],but[2],'{$themeurl}/images/'+but[1],but[3]+"Menu",but[3],(but.length>4?but[4]:false),(but.length>5?but[5]:null));if(but[0]==button_name)return tinyMCE.getButtonHTML(but[0],but[2],'{$themeurl}/images/'+but[1],but[3],(but.length>4?but[4]:false),(but.length>5?but[5]:null))}switch(button_name){case"formatselect":var html='<select id="{$editor_id}_formatSelect" name="{$editor_id}_formatSelect" onfocus="tinyMCE.addSelectAccessibility(event, this, window);" onchange="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'FormatBlock\',false
 ,this.options[this.selectedIndex].value);" class="mceSelectList">';var formats=tinyMCE.getParam("theme_advanced_blockformats","p,address,pre,h1,h2,h3,h4,h5,h6",true).split(',');var lookup=[['p','{$lang_theme_paragraph}'],['address','{$lang_theme_address}'],['pre','{$lang_theme_pre}'],['h1','{$lang_theme_h1}'],['h2','{$lang_theme_h2}'],['h3','{$lang_theme_h3}'],['h4','{$lang_theme_h4}'],['h5','{$lang_theme_h5}'],['h6','{$lang_theme_h6}'],['div','{$lang_theme_div}'],['blockquote','{$lang_theme_blockquote}'],['code','{$lang_theme_code}'],['dt','{$lang_theme_dt}'],['dd','{$lang_theme_dd}'],['samp','{$lang_theme_samp}']];html+='<option value="">{$lang_theme_block}</option>';for(var i=0;i<formats.length;i++){for(var x=0;x<lookup.length;x++){if(formats[i]==lookup[x][0])html+='<option value="&lt;'+lookup[x][0]+'&gt;">'+lookup[x][1]+'</option>'}}html+='</select>';return html;case"styleselect":return'<select id="{$editor_id}_styleSelect" onmousedown="tinyMCE.themes.advanced._setupCSSC
 lasses(\'{$editor_id}\');" name="{$editor_id}_styleSelect" onfocus="tinyMCE.addSelectAccessibility(event,this,window);" onchange="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mceSetCSSClass\',false,this.options[this.selectedIndex].value);" class="mceSelectList">{$style_select_options}</select>';case"fontselect":var fontHTML='<select id="{$editor_id}_fontNameSelect" name="{$editor_id}_fontNameSelect" onfocus="tinyMCE.addSelectAccessibility(event, this, window);" onchange="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'FontName\',false,this.options[this.selectedIndex].value);" class="mceSelectList"><option value="">{$lang_theme_fontdefault}</option>';var iFonts='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';var nFonts='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';var fonts=tinyMCE.getParam("theme_advanced_fonts",nFonts).split(';');for(i=0;i<fonts.length;i++){if(fonts[i]!=''){var parts=fonts[i].split('=');fontHTML+='<option value="'+parts[1]+'">'+parts[0]+'</option>'}}fontHTML+='</select>';return fontHTML;case"fontsizeselect":return'<select id="{$editor_id}_fontSizeSelect" name="{$editor_id}_fontSizeSelect" onfocus="tinyMCE.addSelectAccessibility(event, this, window);" onchange="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'FontSize\',false,this.options[this.selectedI
 ndex].value);" class="mceSelectList">'+'<option value="0">{$lang_theme_font_size}</option>'+'<option value="1">1 (8 pt)</option>'+'<option value="2">2 (10 pt)</option>'+'<option value="3">3 (12 pt)</option>'+'<option value="4">4 (14 pt)</option>'+'<option value="5">5 (18 pt)</option>'+'<option value="6">6 (24 pt)</option>'+'<option value="7">7 (36 pt)</option>'+'</select>';case"|":case"separator":return'<img src="{$themeurl}/images/separator.gif" width="2" height="20" class="mceSeparatorLine" alt="" />';case"spacer":return'<img src="{$themeurl}/images/separator.gif" width="2" height="15" border="0" class="mceSeparatorLine" style="vertical-align: middle" alt="" />';case"rowseparator":return'<br />'}return""},execCommand:function(editor_id,element,command,user_interface,value){switch(command){case'mceHelp':tinyMCE.openWindow({file:'about.htm',width:480,height:380},{tinymce_version:tinyMCE.majorVersion+"."+tinyMCE.minorVersion,tinymce_releasedate:tinyMCE.releaseDate,inline:"yes
 "});return true;case"mceLink":var inst=tinyMCE.getInstanceById(editor_id);var doc=inst.getDoc();var selectedText="";if(tinyMCE.isMSIE){var rng=doc.selection.createRange();selectedText=rng.text}else selectedText=inst.getSel().toString();if(!tinyMCE.linkElement){if((tinyMCE.selectedElement.nodeName.toLowerCase()!="img")&&(selectedText.length<=0))return true}var href="",target="",title="",onclick="",action="insert",style_class="";if(tinyMCE.selectedElement.nodeName.toLowerCase()=="a")tinyMCE.linkElement=tinyMCE.selectedElement;if(tinyMCE.linkElement!=null&&tinyMCE.getAttrib(tinyMCE.linkElement,'href')=="")tinyMCE.linkElement=null;if(tinyMCE.linkElement){href=tinyMCE.getAttrib(tinyMCE.linkElement,'href');target=tinyMCE.getAttrib(tinyMCE.linkElement,'target');title=tinyMCE.getAttrib(tinyMCE.linkElement,'title');onclick=tinyMCE.getAttrib(tinyMCE.linkElement,'onclick');style_class=tinyMCE.getAttrib(tinyMCE.linkElement,'class');if(onclick=="")onclick=tinyMCE.getAttrib(tinyMCE.linkEl
 ement,'onclick');onclick=tinyMCE.cleanupEventStr(onclick);href=eval(tinyMCE.settings['urlconverter_callback']+"(href, tinyMCE.linkElement, true);");mceRealHref=tinyMCE.getAttrib(tinyMCE.linkElement,'mce_href');if(mceRealHref!=""){href=mceRealHref;if(tinyMCE.getParam('convert_urls'))href=eval(tinyMCE.settings['urlconverter_callback']+"(href, tinyMCE.linkElement, true);")}action="update"}var template=new Array();template['file']='link.htm';template['width']=310;template['height']=200;template['width']+=tinyMCE.getLang('lang_insert_link_delta_width',0);template['height']+=tinyMCE.getLang('lang_insert_link_delta_height',0);if(inst.settings['insertlink_callback']){var returnVal=eval(inst.settings['insertlink_callback']+"(href, target, title, onclick, action, style_class);");if(returnVal&&returnVal['href'])TinyMCE_AdvancedTheme._insertLink(returnVal['href'],returnVal['target'],returnVal['title'],returnVal['onclick'],returnVal['style_class'])}else{tinyMCE.openWindow(template,{href:
 href,target:target,title:title,onclick:onclick,action:action,className:style_class,inline:"yes"})}return true;case"mceImage":var src="",alt="",border="",hspace="",vspace="",width="",height="",align="";var title="",onmouseover="",onmouseout="",action="insert";var img=tinyMCE.imgElement;var inst=tinyMCE.getInstanceById(editor_id);if(tinyMCE.selectedElement!=null&&tinyMCE.selectedElement.nodeName.toLowerCase()=="img"){img=tinyMCE.selectedElement;tinyMCE.imgElement=img}if(img){if(tinyMCE.getAttrib(img,'name').indexOf('mce_')==0)return true;src=tinyMCE.getAttrib(img,'src');alt=tinyMCE.getAttrib(img,'alt');if(alt=="")alt=tinyMCE.getAttrib(img,'title');if(tinyMCE.isGecko){var w=img.style.width;if(w!=null&&w!="")img.setAttribute("width",w);var h=img.style.height;if(h!=null&&h!="")img.setAttribute("height",h)}border=tinyMCE.getAttrib(img,'border');hspace=tinyMCE.getAttrib(img,'hspace');vspace=tinyMCE.getAttrib(img,'vspace');width=tinyMCE.getAttrib(img,'width');height=tinyMCE.getAttri
 b(img,'height');align=tinyMCE.getAttrib(img,'align');onmouseover=tinyMCE.getAttrib(img,'onmouseover');onmouseout=tinyMCE.getAttrib(img,'onmouseout');title=tinyMCE.getAttrib(img,'title');if(tinyMCE.isMSIE){width=img.attributes['width'].specified?width:"";height=img.attributes['height'].specified?height:""}src=eval(tinyMCE.settings['urlconverter_callback']+"(src, img, true);");mceRealSrc=tinyMCE.getAttrib(img,'mce_src');if(mceRealSrc!=""){src=mceRealSrc;if(tinyMCE.getParam('convert_urls'))src=eval(tinyMCE.settings['urlconverter_callback']+"(src, img, true);")}action="update"}var template=new Array();template['file']='image.htm?src={$src}';template['width']=355;template['height']=265+(tinyMCE.isMSIE?25:0);template['width']+=tinyMCE.getLang('lang_insert_image_delta_width',0);template['height']+=tinyMCE.getLang('lang_insert_image_delta_height',0);if(inst.settings['insertimage_callback']){var returnVal=eval(inst.settings['insertimage_callback']+"(src, alt, border, hspace, vspace, 
 width, height, align, title, onmouseover, onmouseout, action);");if(returnVal&&returnVal['src'])TinyMCE_AdvancedTheme._insertImage(returnVal['src'],returnVal['alt'],returnVal['border'],returnVal['hspace'],returnVal['vspace'],returnVal['width'],returnVal['height'],returnVal['align'],returnVal['title'],returnVal['onmouseover'],returnVal['onmouseout'])}else tinyMCE.openWindow(template,{src:src,alt:alt,border:border,hspace:hspace,vspace:vspace,width:width,height:height,align:align,title:title,onmouseover:onmouseover,onmouseout:onmouseout,action:action,inline:"yes"});return true;case"forecolor":var fcp=new TinyMCE_Layer(editor_id+'_fcPreview',false),p,img,elm;TinyMCE_AdvancedTheme._hideMenus(editor_id);if(!fcp.exists()){fcp.create('div','mceColorPreview',document.getElementById(editor_id+'_toolbar'));elm=fcp.getElement();elm._editor_id=editor_id;elm._command="forecolor";elm._switchId=editor_id+"_forecolor";tinyMCE.addEvent(elm,'click',TinyMCE_AdvancedTheme._handleMenuEvent);tinyM
 CE.addEvent(elm,'mouseover',TinyMCE_AdvancedTheme._handleMenuEvent);tinyMCE.addEvent(elm,'mouseout',TinyMCE_AdvancedTheme._handleMenuEvent)}img=tinyMCE.selectNodes(document.getElementById(editor_id+"_forecolor"),function(n){return n.nodeName=="IMG"})[0];p=tinyMCE.getAbsPosition(img,document.getElementById(editor_id+'_toolbar'));fcp.moveTo(p.absLeft,p.absTop);fcp.getElement().style.backgroundColor=value!=null?value:tinyMCE.getInstanceById(editor_id).foreColor;fcp.show();return false;case"forecolorpicker":this._pickColor(editor_id,'forecolor');return true;case"forecolorMenu":TinyMCE_AdvancedTheme._hideMenus(editor_id);var ml=new TinyMCE_Layer(editor_id+'_fcMenu');if(!ml.exists())ml.create('div','mceMenu',document.body,TinyMCE_AdvancedTheme._getColorHTML(editor_id,'theme_advanced_text_colors','forecolor'));tinyMCE.switchClass(editor_id+'_forecolor','mceMenuButtonFocus');ml.moveRelativeTo(document.getElementById(editor_id+"_forecolor"),'bl');ml.moveBy(tinyMCE.isMSIE&&!tinyMCE.is
 Opera?-1:1,-1);if(tinyMCE.isOpera)ml.moveBy(0,-2);ml.show();return true;case"HiliteColor":var bcp=new TinyMCE_Layer(editor_id+'_bcPreview',false),p,img;TinyMCE_AdvancedTheme._hideMenus(editor_id);if(!bcp.exists()){bcp.create('div','mceColorPreview',document.getElementById(editor_id+'_toolbar'));elm=bcp.getElement();elm._editor_id=editor_id;elm._command="HiliteColor";elm._switchId=editor_id+"_backcolor";tinyMCE.addEvent(elm,'click',TinyMCE_AdvancedTheme._handleMenuEvent);tinyMCE.addEvent(elm,'mouseover',TinyMCE_AdvancedTheme._handleMenuEvent);tinyMCE.addEvent(elm,'mouseout',TinyMCE_AdvancedTheme._handleMenuEvent)}img=tinyMCE.selectNodes(document.getElementById(editor_id+"_backcolor"),function(n){return n.nodeName=="IMG"})[0];p=tinyMCE.getAbsPosition(img,document.getElementById(editor_id+'_toolbar'));bcp.moveTo(p.absLeft,p.absTop);bcp.getElement().style.backgroundColor=value!=null?value:tinyMCE.getInstanceById(editor_id).backColor;bcp.show();return false;case"HiliteColorMenu":
 TinyMCE_AdvancedTheme._hideMenus(editor_id);var ml=new TinyMCE_Layer(editor_id+'_bcMenu');if(!ml.exists())ml.create('div','mceMenu',document.body,TinyMCE_AdvancedTheme._getColorHTML(editor_id,'theme_advanced_background_colors','HiliteColor'));tinyMCE.switchClass(editor_id+'_backcolor','mceMenuButtonFocus');ml.moveRelativeTo(document.getElementById(editor_id+"_backcolor"),'bl');ml.moveBy(tinyMCE.isMSIE&&!tinyMCE.isOpera?-1:1,-1);if(tinyMCE.isOpera)ml.moveBy(0,-2);ml.show();return true;case"backcolorpicker":this._pickColor(editor_id,'HiliteColor');return true;case"mceColorPicker":if(user_interface){var template=[];if(!value['callback']&&!value['color'])value['color']=value['document'].getElementById(value['element_id']).value;template['file']='color_picker.htm';template['width']=380;template['height']=250;template['close_previous']="no";template['width']+=tinyMCE.getLang('lang_theme_advanced_colorpicker_delta_width',0);template['height']+=tinyMCE.getLang('lang_theme_advanced_c
 olorpicker_delta_height',0);if(typeof(value['store_selection'])=="undefined")value['store_selection']=true;tinyMCE.lastColorPickerValue=value;tinyMCE.openWindow(template,{editor_id:editor_id,mce_store_selection:value['store_selection'],inline:"yes",command:"mceColorPicker",input_color:value['color']})}else{var savedVal=tinyMCE.lastColorPickerValue,elm;if(savedVal['callback']){savedVal['callback'](value);return true}elm=savedVal['document'].getElementById(savedVal['element_id']);elm.value=value;if(elm.onchange!=null&&elm.onchange!='')eval('elm.onchange();')}return true;case"mceCodeEditor":var template=new Array();template['file']='source_editor.htm';template['width']=parseInt(tinyMCE.getParam("theme_advanced_source_editor_width",720));template['height']=parseInt(tinyMCE.getParam("theme_advanced_source_editor_height",580));tinyMCE.openWindow(template,{editor_id:editor_id,resizable:"yes",scrollbars:"no",inline:"yes"});return true;case"mceCharMap":var template=new Array();templa
 te['file']='charmap.htm';template['width']=550+(tinyMCE.isOpera?40:0);template['height']=250;template['width']+=tinyMCE.getLang('lang_theme_advanced_charmap_delta_width',0);template['height']+=tinyMCE.getLang('lang_theme_advanced_charmap_delta_height',0);tinyMCE.openWindow(template,{editor_id:editor_id,inline:"yes"});return true;case"mceInsertAnchor":var template=new Array();template['file']='anchor.htm';template['width']=320;template['height']=90+(tinyMCE.isNS7?30:0);template['width']+=tinyMCE.getLang('lang_theme_advanced_anchor_delta_width',0);template['height']+=tinyMCE.getLang('lang_theme_advanced_anchor_delta_height',0);tinyMCE.openWindow(template,{editor_id:editor_id,inline:"yes"});return true;case"mceNewDocument":if(confirm(tinyMCE.entityDecode(tinyMCE.getLang('lang_newdocument'))))tinyMCE.execInstanceCommand(editor_id,'mceSetContent',false,' ');return true}return false},getEditorTemplate:function(settings,editorId){function removeFromArray(in_array,remove_array){var 
 outArray=new Array(),skip;for(var i=0;i<in_array.length;i++){skip=false;for(var j=0;j<remove_array.length;j++){if(in_array[i]==remove_array[j]){skip=true}}if(!skip){outArray[outArray.length]=in_array[i]}}return outArray}function addToArray(in_array,add_array){for(var i=0;i<add_array.length;i++){in_array[in_array.length]=add_array[i]}return in_array}var template=new Array();var deltaHeight=0;var resizing=tinyMCE.getParam("theme_advanced_resizing",false);var path=tinyMCE.getParam("theme_advanced_path",true);var statusbarHTML='<div id="{$editor_id}_path" class="mceStatusbarPathText" style="display: '+(path?"block":"none")+'">&#160;</div><div id="{$editor_id}_resize" class="mceStatusbarResize" style="display: '+(resizing?"block":"none")+'" onmousedown="tinyMCE.themes.advanced._setResizing(event,\'{$editor_id}\',true);"></div><br style="clear: both" />';var layoutManager=tinyMCE.getParam("theme_advanced_layout_manager","SimpleLayout");var styleSelectHTML='<option value="">{$lang_
 theme_style_select}</option>';if(settings['theme_advanced_styles']){var stylesAr=settings['theme_advanced_styles'].split(';');for(var i=0;i<stylesAr.length;i++){var key,value;key=stylesAr[i].split('=')[0];value=stylesAr[i].split('=')[1];styleSelectHTML+='<option value="'+value+'">'+key+'</option>'}TinyMCE_AdvancedTheme._autoImportCSSClasses=false}switch(layoutManager){case"SimpleLayout":var toolbarHTML="";var toolbarLocation=tinyMCE.getParam("theme_advanced_toolbar_location","bottom");var toolbarAlign=tinyMCE.getParam("theme_advanced_toolbar_align","center");var pathLocation=tinyMCE.getParam("theme_advanced_path_location","none");var statusbarLocation=tinyMCE.getParam("theme_advanced_statusbar_location",pathLocation);var defVals={theme_advanced_buttons1:"bold,italic,underline,strikethrough,separator,justifyleft,justifycenter,justifyright,justifyfull,separator,styleselect,formatselect",theme_advanced_buttons2:"bullist,numlist,separator,outdent,indent,separator,undo,redo,separ
 ator,link,unlink,anchor,image,cleanup,help,code",theme_advanced_buttons3:"hr,removeformat,visualaid,separator,sub,sup,separator,charmap"};toolbarHTML+='<a href="#" accesskey="q" title="'+tinyMCE.getLang("lang_toolbar_focus")+'"';if(!tinyMCE.getParam("accessibility_focus"))toolbarHTML+=' onfocus="tinyMCE.getInstanceById(\''+editorId+'\').getWin().focus();"';toolbarHTML+='></a>';for(var i=1;i<100;i++){var def=defVals["theme_advanced_buttons"+i];var buttons=tinyMCE.getParam("theme_advanced_buttons"+i,def==null?'':def,true,',');if(buttons.length==0)break;buttons=removeFromArray(buttons,tinyMCE.getParam("theme_advanced_disable","",true,','));buttons=addToArray(buttons,tinyMCE.getParam("theme_advanced_buttons"+i+"_add","",true,','));buttons=addToArray(tinyMCE.getParam("theme_advanced_buttons"+i+"_add_before","",true,','),buttons);for(var b=0;b<buttons.length;b++)toolbarHTML+=tinyMCE.getControlHTML(buttons[b]);if(buttons.length>0){toolbarHTML+="<br />";deltaHeight-=23}}toolbarHTML+
 ='<a href="#" accesskey="z" onfocus="tinyMCE.getInstanceById(\''+editorId+'\').getWin().focus();"></a>';template['html']='<table class="mceEditor" border="0" cellpadding="0" cellspacing="0" width="{$width}" height="{$height}" style="width:{$width_style};height:{$height_style}"><tbody>';if(toolbarLocation=="top")template['html']+='<tr><td dir="ltr" class="mceToolbarTop" align="'+toolbarAlign+'" height="1" nowrap="nowrap"><span id="'+editorId+'_toolbar" class="mceToolbarContainer">'+toolbarHTML+'</span></td></tr>';if(statusbarLocation=="top"){template['html']+='<tr><td class="mceStatusbarTop" height="1">'+statusbarHTML+'</td></tr>';deltaHeight-=23}template['html']+='<tr><td align="center"><span id="{$editor_id}"></span></td></tr>';if(toolbarLocation=="bottom")template['html']+='<tr><td dir="ltr" class="mceToolbarBottom" align="'+toolbarAlign+'" height="1"><span id="'+editorId+'_toolbar" class="mceToolbarContainer">'+toolbarHTML+'</span></td></tr>';if(toolbarLocation=="external
 "){var bod=document.body;var elm=document.createElement("div");toolbarHTML=tinyMCE.replaceVar(toolbarHTML,'style_select_options',styleSelectHTML);toolbarHTML=tinyMCE.applyTemplate(toolbarHTML,{editor_id:editorId});elm.className="mceToolbarExternal";elm.id=editorId+"_toolbar";elm.innerHTML='<table width="100%" border="0" align="center"><tr><td align="center">'+toolbarHTML+'</td></tr></table>';bod.appendChild(elm);deltaHeight=0;tinyMCE.getInstanceById(editorId).toolbarElement=elm;}else{tinyMCE.getInstanceById(editorId).toolbarElement=null}if(statusbarLocation=="bottom"){template['html']+='<tr><td class="mceStatusbarBottom" height="1">'+statusbarHTML+'</td></tr>';deltaHeight-=23}template['html']+='</tbody></table>';break;case"RowLayout":template['html']='<table class="mceEditor" border="0" cellpadding="0" cellspacing="0" width="{$width}" height="{$height}" style="width:{$width}px;height:{$height}px"><tbody>';var containers=tinyMCE.getParam("theme_advanced_containers","",true,",
 ");var defaultContainerCSS=tinyMCE.getParam("theme_advanced_containers_default_class","container");var defaultContainerAlign=tinyMCE.getParam("theme_advanced_containers_default_align","center");for(var i=0;i<containers.length;i++){if(containers[i]=="mceEditor")template['html']+='<tr><td align="center" class="mceEditor_border"><span id="{$editor_id}"></span></td></tr>';else if(containers[i]=="mceElementpath"||containers[i]=="mceStatusbar"){var pathClass="mceStatusbar";if(i==containers.length-1){pathClass="mceStatusbarBottom"}else if(i==0){pathClass="mceStatusbar"}else{deltaHeight-=2}template['html']+='<tr><td class="'+pathClass+'" height="1">'+statusbarHTML+'</td></tr>';deltaHeight-=22}else{var curContainer=tinyMCE.getParam("theme_advanced_container_"+containers[i],"",true,',');var curContainerHTML="";var curAlign=tinyMCE.getParam("theme_advanced_container_"+containers[i]+"_align",defaultContainerAlign);var curCSS=tinyMCE.getParam("theme_advanced_container_"+containers[i]+"_c
 lass",defaultContainerCSS);curContainer=removeFromArray(curContainer,tinyMCE.getParam("theme_advanced_disable","",true,','));for(var j=0;j<curContainer.length;j++)curContainerHTML+=tinyMCE.getControlHTML(curContainer[j]);if(curContainer.length>0){curContainerHTML+="<br />";deltaHeight-=23}template['html']+='<tr><td class="'+curCSS+'" align="'+curAlign+'" height="1">'+curContainerHTML+'</td></tr>'}}template['html']+='</tbody></table>';break;case"CustomLayout":var customLayout=tinyMCE.getParam("theme_advanced_custom_layout","");if(customLayout!=""&&eval("typeof("+customLayout+")")!="undefined"){template=eval(customLayout+"(template);")}break}if(resizing)template['html']+='<span id="{$editor_id}_resize_box" class="mceResizeBox"></span>';template['html']=tinyMCE.replaceVar(template['html'],'style_select_options',styleSelectHTML);if(!template['delta_width'])template['delta_width']=0;if(!template['delta_height'])template['delta_height']=deltaHeight;return template},initInstance:fu
 nction(inst){if(tinyMCE.getParam("theme_advanced_resizing",false)){if(tinyMCE.getParam("theme_advanced_resizing_use_cookie",true)){var w=TinyMCE_AdvancedTheme._getCookie("TinyMCE_"+inst.editorId+"_width");var h=TinyMCE_AdvancedTheme._getCookie("TinyMCE_"+inst.editorId+"_height");TinyMCE_AdvancedTheme._resizeTo(inst,w,h,tinyMCE.getParam("theme_advanced_resize_horizontal",true))}}inst.addShortcut('ctrl','k','lang_link_desc','mceLink')},removeInstance:function(inst){new TinyMCE_Layer(inst.editorId+'_fcMenu').remove();new TinyMCE_Layer(inst.editorId+'_bcMenu').remove()},hideInstance:function(inst){TinyMCE_AdvancedTheme._hideMenus(inst.editorId)},_handleMenuEvent:function(e){var te=tinyMCE.isMSIE?window.event.srcElement:e.target;tinyMCE._menuButtonEvent(e.type=="mouseover"?"over":"out",document.getElementById(te._switchId));if(e.type=="click")tinyMCE.execInstanceCommand(te._editor_id,te._command)},_hideMenus:function(id){var fcml=new TinyMCE_Layer(id+'_fcMenu'),bcml=new TinyMCE_L
 ayer(id+'_bcMenu');if(fcml.exists()&&fcml.isVisible()){tinyMCE.switchClass(id+'_forecolor','mceMenuButton');fcml.hide()}if(bcml.exists()&&bcml.isVisible()){tinyMCE.switchClass(id+'_backcolor','mceMenuButton');bcml.hide()}},handleNodeChange:function(editor_id,node,undo_index,undo_levels,visual_aid,any_selection,setup_content){var alignNode,breakOut,classNode;function selectByValue(select_elm,value,first_index){first_index=typeof(first_index)=="undefined"?false:true;if(select_elm){for(var i=0;i<select_elm.options.length;i++){var ov=""+select_elm.options[i].value;if(first_index&&ov.toLowerCase().indexOf(value.toLowerCase())==0){select_elm.selectedIndex=i;return true}if(ov==value){select_elm.selectedIndex=i;return true}}}return false};if(node==null)return;var pathElm=document.getElementById(editor_id+"_path");var inst=tinyMCE.getInstanceById(editor_id);var doc=inst.getDoc();TinyMCE_AdvancedTheme._hideMenus(editor_id);if(pathElm){var parentNode=node;var path=new Array();while(par
 entNode!=null){if(parentNode.nodeName.toUpperCase()=="BODY"){break}if(parentNode.nodeType==1&&tinyMCE.getAttrib(parentNode,"class").indexOf('mceItemHidden')==-1){path[path.length]=parentNode}parentNode=parentNode.parentNode}var html="";for(var i=path.length-1;i>=0;i--){var nodeName=path[i].nodeName.toLowerCase();var nodeData="";if(nodeName.indexOf("html:")==0)nodeName=nodeName.substring(5);if(nodeName=="b"){nodeName="strong"}if(nodeName=="i"){nodeName="em"}if(nodeName=="span"){var cn=tinyMCE.getAttrib(path[i],"class");if(cn!=""&&cn.indexOf('mceItem')==-1)nodeData+="class: "+cn+" ";var st=tinyMCE.getAttrib(path[i],"style");if(st!=""){st=tinyMCE.serializeStyle(tinyMCE.parseStyle(st));nodeData+="style: "+tinyMCE.xmlEncode(st)+" "}}if(nodeName=="font"){if(tinyMCE.getParam("convert_fonts_to_spans"))nodeName="span";var face=tinyMCE.getAttrib(path[i],"face");if(face!="")nodeData+="font: "+tinyMCE.xmlEncode(face)+" ";var size=tinyMCE.getAttrib(path[i],"size");if(size!="")nodeData+="
 size: "+tinyMCE.xmlEncode(size)+" ";var color=tinyMCE.getAttrib(path[i],"color");if(color!="")nodeData+="color: "+tinyMCE.xmlEncode(color)+" "}if(tinyMCE.getAttrib(path[i],'id')!=""){nodeData+="id: "+path[i].getAttribute('id')+" "}var className=tinyMCE.getVisualAidClass(tinyMCE.getAttrib(path[i],"class"),false);if(className!=""&&className.indexOf('mceItem')==-1)nodeData+="class: "+className+" ";if(tinyMCE.getAttrib(path[i],'src')!=""){var src=tinyMCE.getAttrib(path[i],"mce_src");if(src=="")src=tinyMCE.getAttrib(path[i],"src");nodeData+="src: "+tinyMCE.xmlEncode(src)+" "}if(path[i].nodeName=='A'&&tinyMCE.getAttrib(path[i],'href')!=""){var href=tinyMCE.getAttrib(path[i],"mce_href");if(href=="")href=tinyMCE.getAttrib(path[i],"href");nodeData+="href: "+tinyMCE.xmlEncode(href)+" "}className=tinyMCE.getAttrib(path[i],"class");if((nodeName=="img"||nodeName=="span")&&className.indexOf('mceItem')!=-1){nodeName=className.replace(/mceItem([a-z]+)/gi,'$1').toLowerCase();nodeData=path[i]
 .getAttribute('title')}if(nodeName=="a"&&(anchor=tinyMCE.getAttrib(path[i],"name"))!=""){nodeName="a";nodeName+="#"+tinyMCE.xmlEncode(anchor);nodeData=""}if(tinyMCE.getAttrib(path[i],'name').indexOf("mce_")!=0){var className=tinyMCE.getVisualAidClass(tinyMCE.getAttrib(path[i],"class"),false);if(className!=""&&className.indexOf('mceItem')==-1){nodeName+="."+className}}var cmd='tinyMCE.execInstanceCommand(\''+editor_id+'\',\'mceSelectNodeDepth\',false,\''+i+'\');';html+='<a title="'+nodeData+'" href="javascript:'+cmd+'" onclick="'+cmd+'return false;" onmousedown="return false;" target="_self" class="mcePathItem">'+nodeName+'</a>';if(i>0){html+=" &raquo; "}}pathElm.innerHTML='<a href="#" accesskey="x"></a>'+tinyMCE.getLang('lang_theme_path')+": "+html+'&#160;'}tinyMCE.switchClass(editor_id+'_justifyleft','mceButtonNormal');tinyMCE.switchClass(editor_id+'_justifyright','mceButtonNormal');tinyMCE.switchClass(editor_id+'_justifycenter','mceButtonNormal');tinyMCE.switchClass(editor
 _id+'_justifyfull','mceButtonNormal');tinyMCE.switchClass(editor_id+'_bold','mceButtonNormal');tinyMCE.switchClass(editor_id+'_italic','mceButtonNormal');tinyMCE.switchClass(editor_id+'_underline','mceButtonNormal');tinyMCE.switchClass(editor_id+'_strikethrough','mceButtonNormal');tinyMCE.switchClass(editor_id+'_bullist','mceButtonNormal');tinyMCE.switchClass(editor_id+'_numlist','mceButtonNormal');tinyMCE.switchClass(editor_id+'_sub','mceButtonNormal');tinyMCE.switchClass(editor_id+'_sup','mceButtonNormal');tinyMCE.switchClass(editor_id+'_anchor','mceButtonNormal');tinyMCE.switchClass(editor_id+'_link','mceButtonDisabled');tinyMCE.switchClass(editor_id+'_unlink','mceButtonDisabled');tinyMCE.switchClass(editor_id+'_outdent','mceButtonDisabled');tinyMCE.switchClass(editor_id+'_image','mceButtonNormal');tinyMCE.switchClass(editor_id+'_hr','mceButtonNormal');if(node.nodeName=="A"&&tinyMCE.getAttrib(node,"class").indexOf('mceItemAnchor')!=-1)tinyMCE.switchClass(editor_id+'_ancho
 r','mceButtonSelected');var anchorLink=tinyMCE.getParentElement(node,"a","href");if(anchorLink||any_selection){tinyMCE.switchClass(editor_id+'_link',anchorLink?'mceButtonSelected':'mceButtonNormal');tinyMCE.switchClass(editor_id+'_unlink',anchorLink?'mceButtonSelected':'mceButtonNormal')}tinyMCE.switchClass(editor_id+'_visualaid',visual_aid?'mceButtonSelected':'mceButtonNormal');if(undo_levels!=-1){tinyMCE.switchClass(editor_id+'_undo','mceButtonDisabled');tinyMCE.switchClass(editor_id+'_redo','mceButtonDisabled')}if(tinyMCE.getParentElement(node,"li,blockquote"))tinyMCE.switchClass(editor_id+'_outdent','mceButtonNormal');if(undo_index!=-1&&(undo_index<undo_levels-1&&undo_levels>0))tinyMCE.switchClass(editor_id+'_redo','mceButtonNormal');if(undo_index!=-1&&(undo_index>0&&undo_levels>0))tinyMCE.switchClass(editor_id+'_undo','mceButtonNormal');var selectElm=document.getElementById(editor_id+"_styleSelect");if(selectElm){TinyMCE_AdvancedTheme._setupCSSClasses(editor_id);classNo
 de=node;breakOut=false;var index=0;do{if(classNode&&classNode.className){for(var i=0;i<selectElm.options.length;i++){if(selectElm.options[i].value==classNode.className){index=i;breakOut=true;break}}}}while(!breakOut&&classNode!=null&&(classNode=classNode.parentNode)!=null);selectElm.selectedIndex=index}var selectElm=document.getElementById(editor_id+"_formatSelect");if(selectElm){var elm=tinyMCE.getParentElement(node,"p,div,h1,h2,h3,h4,h5,h6,pre,address");if(elm)selectByValue(selectElm,"<"+elm.nodeName.toLowerCase()+">");else selectByValue(selectElm,"")}var selectElm=document.getElementById(editor_id+"_fontNameSelect");if(selectElm){if(!tinyMCE.isSafari&&!(tinyMCE.isMSIE&&!tinyMCE.isOpera)){var face=inst.queryCommandValue('FontName');face=face==null||face==""?"":face;selectByValue(selectElm,face,face!="")}else{var elm=tinyMCE.getParentElement(node,"font","face");if(elm){var family=tinyMCE.getAttrib(elm,"face");if(family=='')family=''+elm.style.fontFamily;if(!selectByValue(se
 lectElm,family,family!=""))selectByValue(selectElm,"")}else selectByValue(selectElm,"")}}var selectElm=document.getElementById(editor_id+"_fontSizeSelect");if(selectElm){if(!tinyMCE.isSafari&&!tinyMCE.isOpera){var size=inst.queryCommandValue('FontSize');selectByValue(selectElm,size==null||size==""?"0":size)}else{var elm=tinyMCE.getParentElement(node,"font","size");if(elm){var size=tinyMCE.getAttrib(elm,"size");if(size==''){var sizes=new Array('','8px','10px','12px','14px','18px','24px','36px');size=''+elm.style.fontSize;for(var i=0;i<sizes.length;i++){if((''+sizes[i])==size){size=i;break}}}if(!selectByValue(selectElm,size))selectByValue(selectElm,"")}else selectByValue(selectElm,"0")}}alignNode=node;breakOut=false;do{if(!alignNode.getAttribute||!alignNode.getAttribute('align'))continue;switch(alignNode.getAttribute('align').toLowerCase()){case"left":tinyMCE.switchClass(editor_id+'_justifyleft','mceButtonSelected');breakOut=true;break;case"right":tinyMCE.switchClass(editor_id
 +'_justifyright','mceButtonSelected');breakOut=true;break;case"middle":case"center":tinyMCE.switchClass(editor_id+'_justifycenter','mceButtonSelected');breakOut=true;break;case"justify":tinyMCE.switchClass(editor_id+'_justifyfull','mceButtonSelected');breakOut=true;break}}while(!breakOut&&(alignNode=alignNode.parentNode)!=null);var div=tinyMCE.getParentElement(node,"div");if(div&&div.style.textAlign=="center")tinyMCE.switchClass(editor_id+'_justifycenter','mceButtonSelected');if(!setup_content){var ar=new Array("Bold","_bold","Italic","_italic","Strikethrough","_strikethrough","superscript","_sup","subscript","_sub");for(var i=0;i<ar.length;i+=2){if(inst.queryCommandState(ar[i]))tinyMCE.switchClass(editor_id+ar[i+1],'mceButtonSelected')}if(inst.queryCommandState("Underline")&&(node.parentNode==null||node.parentNode.nodeName!="A"))tinyMCE.switchClass(editor_id+'_underline','mceButtonSelected')}do{switch(node.nodeName){case"UL":tinyMCE.switchClass(editor_id+'_bullist','mceButt
 onSelected');break;case"OL":tinyMCE.switchClass(editor_id+'_numlist','mceButtonSelected');break;case"HR":tinyMCE.switchClass(editor_id+'_hr','mceButtonSelected');break;case"IMG":if(tinyMCE.getAttrib(node,'name').indexOf('mce_')!=0&&tinyMCE.getAttrib(node,'class').indexOf('mceItem')==-1){tinyMCE.switchClass(editor_id+'_image','mceButtonSelected')}break}}while((node=node.parentNode)!=null)},_setupCSSClasses:function(editor_id){var i,selectElm;if(!TinyMCE_AdvancedTheme._autoImportCSSClasses)return;selectElm=document.getElementById(editor_id+'_styleSelect');if(selectElm&&selectElm.getAttribute('cssImported')!='true'){var csses=tinyMCE.getCSSClasses(editor_id);if(csses&&selectElm){for(i=0;i<csses.length;i++)selectElm.options[selectElm.options.length]=new Option(csses[i],csses[i])}if(csses!=null&&csses.length>0)selectElm.setAttribute('cssImported','true')}},_setCookie:function(name,value,expires,path,domain,secure){var curCookie=name+"="+escape(value)+((expires)?"; expires="+expir
 es.toGMTString():"")+((path)?"; path="+escape(path):"")+((domain)?"; domain="+domain:"")+((secure)?"; secure":"");document.cookie=curCookie},_getCookie:function(name){var dc=document.cookie;var prefix=name+"=";var begin=dc.indexOf("; "+prefix);if(begin==-1){begin=dc.indexOf(prefix);if(begin!=0)return null}else begin+=2;var end=document.cookie.indexOf(";",begin);if(end==-1)end=dc.length;return unescape(dc.substring(begin+prefix.length,end))},_resizeTo:function(inst,w,h,set_w){var editorContainer=document.getElementById(inst.editorId+'_parent');var tableElm=editorContainer.firstChild;var iframe=inst.iframeElement;if(w==null||w=="null"){set_w=false;w=0}if(h==null||h=="null")return;w=parseInt(w);h=parseInt(h);if(tinyMCE.isGecko){w+=2;h+=2}var dx=w-tableElm.clientWidth;var dy=h-tableElm.clientHeight;w=w<1?30:w;h=h<1?30:h;if(set_w)tableElm.style.width=w+"px";tableElm.style.height=h+"px";iw=iframe.clientWidth+dx;ih=iframe.clientHeight+dy;iw=iw<1?30:iw;ih=ih<1?30:ih;if(tinyMCE.isGec
 ko){iw-=2;ih-=2}if(set_w)iframe.style.width=iw+"px";iframe.style.height=ih+"px";if(set_w){var tableBodyElm=tableElm.firstChild;var minIframeWidth=tableBodyElm.scrollWidth;if(inst.iframeElement.clientWidth<minIframeWidth){dx=minIframeWidth-inst.iframeElement.clientWidth;inst.iframeElement.style.width=(iw+dx)+"px"}}inst.useCSS=false},_resizeEventHandler:function(e){var resizer=TinyMCE_AdvancedTheme._resizer;if(!resizer.resizing)return;e=typeof(e)=="undefined"?window.event:e;var dx=e.screenX-resizer.downX;var dy=e.screenY-resizer.downY;var resizeBox=resizer.resizeBox;var editorId=resizer.editorId;switch(e.type){case"mousemove":var w,h;w=resizer.width+dx;h=resizer.height+dy;w=w<1?1:w;h=h<1?1:h;if(resizer.horizontal)resizeBox.style.width=w+"px";resizeBox.style.height=h+"px";break;case"mouseup":TinyMCE_AdvancedTheme._setResizing(e,editorId,false);TinyMCE_AdvancedTheme._resizeTo(tinyMCE.getInstanceById(editorId),resizer.width+dx,resizer.height+dy,resizer.horizontal);if(tinyMCE.getP
 aram("theme_advanced_resizing_use_cookie",true)){var expires=new Date();expires.setTime(expires.getTime()+3600000*24*30);TinyMCE_AdvancedTheme._setCookie("TinyMCE_"+editorId+"_width",""+(resizer.horizontal?resizer.width+dx:""),expires);TinyMCE_AdvancedTheme._setCookie("TinyMCE_"+editorId+"_height",""+(resizer.height+dy),expires)}break}},_setResizing:function(e,editor_id,state){e=typeof(e)=="undefined"?window.event:e;var resizer=TinyMCE_AdvancedTheme._resizer;var editorContainer=document.getElementById(editor_id+'_parent');var editorArea=document.getElementById(editor_id+'_parent').firstChild;var resizeBox=document.getElementById(editor_id+'_resize_box');var inst=tinyMCE.getInstanceById(editor_id);if(state){var width=editorArea.clientWidth;var height=editorArea.clientHeight;resizeBox.style.width=width+"px";resizeBox.style.height=height+"px";resizer.iframeWidth=inst.iframeElement.clientWidth;resizer.iframeHeight=inst.iframeElement.clientHeight;editorArea.style.display="none";r
 esizeBox.style.display="block";if(!resizer.eventHandlers){if(tinyMCE.isMSIE)tinyMCE.addEvent(document,"mousemove",TinyMCE_AdvancedTheme._resizeEventHandler);else tinyMCE.addEvent(window,"mousemove",TinyMCE_AdvancedTheme._resizeEventHandler);tinyMCE.addEvent(document,"mouseup",TinyMCE_AdvancedTheme._resizeEventHandler);resizer.eventHandlers=true}resizer.resizing=true;resizer.downX=e.screenX;resizer.downY=e.screenY;resizer.width=parseInt(resizeBox.style.width);resizer.height=parseInt(resizeBox.style.height);resizer.editorId=editor_id;resizer.resizeBox=resizeBox;resizer.horizontal=tinyMCE.getParam("theme_advanced_resize_horizontal",true)}else{resizer.resizing=false;resizeBox.style.display="none";editorArea.style.display=tinyMCE.isMSIE&&!tinyMCE.isOpera?"block":"table";tinyMCE.execCommand('mceResetDesignMode')}},_getColorHTML:function(id,n,cm){var i,h,cl;h='<span class="mceMenuLine"></span>';cl=tinyMCE.getParam(n,TinyMCE_AdvancedTheme._defColors).split(',');h+='<table class="mce
 Colors"><tr>';for(i=0;i<cl.length;i++){c='tinyMCE.execInstanceCommand(\''+id+'\', \''+cm+'\', false, \'#'+cl[i]+'\');';h+='<td><a href="javascript:'+c+'" style="background-color: #'+cl[i]+'" onclick="'+c+';return false;"></a></td>';if((i+1)%8==0)h+='</tr><tr>'}h+='</tr></table>';if(tinyMCE.getParam("theme_advanced_more_colors",true))h+='<a href="javascript:void(0);" onclick="TinyMCE_AdvancedTheme._pickColor(\''+id+'\',\''+cm+'\');" class="mceMoreColors">'+tinyMCE.getLang('lang_more_colors')+'</a>';return h},_pickColor:function(id,cm){var inputColor,inst=tinyMCE.selectedInstance;if(cm=='forecolor'&&inst)inputColor=inst.foreColor;if((cm=='backcolor'||cm=='HiliteColor')&&inst)inputColor=inst.backColor;tinyMCE.execCommand('mceColorPicker',true,{color:inputColor,callback:function(c){tinyMCE.execInstanceCommand(id,cm,false,c)}})},_insertImage:function(src,alt,border,hspace,vspace,width,height,align,title,onmouseover,onmouseout){tinyMCE.execCommand("mceInsertContent",false,tinyMCE.
 createTagHTML('img',{src:tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings['base_href'],src),mce_src:src,alt:alt,border:border,hspace:hspace,vspace:vspace,width:width,height:height,align:align,title:title,onmouseover:onmouseover,onmouseout:onmouseout}))},_insertLink:function(href,target,title,onclick,style_class){tinyMCE.execCommand('mceBeginUndoLevel');if(tinyMCE.selectedInstance&&tinyMCE.selectedElement&&tinyMCE.selectedElement.nodeName.toLowerCase()=="img"){var doc=tinyMCE.selectedInstance.getDoc();var linkElement=tinyMCE.getParentElement(tinyMCE.selectedElement,"a");var newLink=false;if(!linkElement){linkElement=doc.createElement("a");newLink=true}var mhref=href;var thref=eval(tinyMCE.settings['urlconverter_callback']+"(href, linkElement);");mhref=tinyMCE.getParam('convert_urls')?href:mhref;tinyMCE.setAttrib(linkElement,'href',thref);tinyMCE.setAttrib(linkElement,'mce_href',mhref);tinyMCE.setAttrib(linkElement,'target',target);tinyMCE.setAttrib(linkElement,'title',ti
 tle);tinyMCE.setAttrib(linkElement,'onclick',onclick);tinyMCE.setAttrib(linkElement,'class',style_class);if(newLink){linkElement.appendChild(tinyMCE.selectedElement.cloneNode(true));tinyMCE.selectedElement.parentNode.replaceChild(linkElement,tinyMCE.selectedElement)}return}if(!tinyMCE.linkElement&&tinyMCE.selectedInstance){if(tinyMCE.isSafari){tinyMCE.execCommand("mceInsertContent",false,'<a href="'+tinyMCE.uniqueURL+'">'+tinyMCE.selectedInstance.selection.getSelectedHTML()+'</a>')}else tinyMCE.selectedInstance.contentDocument.execCommand("createlink",false,tinyMCE.uniqueURL);tinyMCE.linkElement=tinyMCE.getElementByAttributeValue(tinyMCE.selectedInstance.contentDocument.body,"a","href",tinyMCE.uniqueURL);var elementArray=tinyMCE.getElementsByAttributeValue(tinyMCE.selectedInstance.contentDocument.body,"a","href",tinyMCE.uniqueURL);for(var i=0;i<elementArray.length;i++){var mhref=href;var thref=eval(tinyMCE.settings['urlconverter_callback']+"(href, elementArray[i]);");mhref=t
 inyMCE.getParam('convert_urls')?href:mhref;tinyMCE.setAttrib(elementArray[i],'href',thref);tinyMCE.setAttrib(elementArray[i],'mce_href',mhref);tinyMCE.setAttrib(elementArray[i],'target',target);tinyMCE.setAttrib(elementArray[i],'title',title);tinyMCE.setAttrib(elementArray[i],'onclick',onclick);tinyMCE.setAttrib(elementArray[i],'class',style_class)}tinyMCE.linkElement=elementArray[0]}if(tinyMCE.linkElement){var mhref=href;href=eval(tinyMCE.settings['urlconverter_callback']+"(href, tinyMCE.linkElement);");mhref=tinyMCE.getParam('convert_urls')?href:mhref;tinyMCE.setAttrib(tinyMCE.linkElement,'href',href);tinyMCE.setAttrib(tinyMCE.linkElement,'mce_href',mhref);tinyMCE.setAttrib(tinyMCE.linkElement,'target',target);tinyMCE.setAttrib(tinyMCE.linkElement,'title',title);tinyMCE.setAttrib(tinyMCE.linkElement,'onclick',onclick);tinyMCE.setAttrib(tinyMCE.linkElement,'class',style_class)}tinyMCE.execCommand('mceEndUndoLevel')}};tinyMCE.addTheme("advanced",TinyMCE_AdvancedTheme);tinyMC
 E.addButtonMap(TinyMCE_AdvancedTheme._buttonMap);
\ 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:["hel
 p_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,i
 talic,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_advan
 ced_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(k+"/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.f
 ontSize)}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.appen
 dChild(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":"mceIframeCont
 ainer"});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:funct
 ion(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.scree
 nY;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.clas
 sName.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.n
 odeName.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: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.ur
 l})},_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})},_m
 ceLink: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

Modified: plog/branches/lifetype-1.2/js/tinymce/themes/advanced/editor_template_src.js
===================================================================
--- plog/branches/lifetype-1.2/js/tinymce/themes/advanced/editor_template_src.js	2010-09-21 21:29:55 UTC (rev 7026)
+++ plog/branches/lifetype-1.2/js/tinymce/themes/advanced/editor_template_src.js	2010-09-21 23:00:22 UTC (rev 7027)
@@ -1,1516 +1,1217 @@
 /**
- * $Id: editor_template_src.js 296 2007-08-21 10:36:35Z spocke $
+ * editor_template_src.js
  *
- * @author Moxiecode
- * @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved.
+ * Copyright 2009, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://tinymce.moxiecode.com/license
+ * Contributing: http://tinymce.moxiecode.com/contributing
  */
 
-/* Import theme specific language pack */
-tinyMCE.importThemeLanguagePack('advanced');
+(function(tinymce) {
+	var DOM = tinymce.DOM, Event = tinymce.dom.Event, extend = tinymce.extend, each = tinymce.each, Cookie = tinymce.util.Cookie, lastExtID, explode = tinymce.explode;
 
-var TinyMCE_AdvancedTheme = {
-	// Private theme fields
-	_defColors : "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",
-	_autoImportCSSClasses : true,
-	_resizer : {},
-	_buttons : [
-		// Control id, button img, button title, command, user_interface, value
-		['bold', '{$lang_bold_img}', 'lang_bold_desc', 'Bold'],
-		['italic', '{$lang_italic_img}', 'lang_italic_desc', 'Italic'],
-		['underline', '{$lang_underline_img}', 'lang_underline_desc', 'Underline'],
-		['strikethrough', 'strikethrough.gif', 'lang_striketrough_desc', 'Strikethrough'],
-		['justifyleft', 'justifyleft.gif', 'lang_justifyleft_desc', 'JustifyLeft'],
-		['justifycenter', 'justifycenter.gif', 'lang_justifycenter_desc', 'JustifyCenter'],
-		['justifyright', 'justifyright.gif', 'lang_justifyright_desc', 'JustifyRight'],
-		['justifyfull', 'justifyfull.gif', 'lang_justifyfull_desc', 'JustifyFull'],
-		['bullist', 'bullist.gif', 'lang_bullist_desc', 'InsertUnorderedList'],
-		['numlist', 'numlist.gif', 'lang_numlist_desc', 'InsertOrderedList'],
-		['outdent', 'outdent.gif', 'lang_outdent_desc', 'Outdent'],
-		['indent', 'indent.gif', 'lang_indent_desc', 'Indent'],
-		['cut', 'cut.gif', 'lang_cut_desc', 'Cut'],
-		['copy', 'copy.gif', 'lang_copy_desc', 'Copy'],
-		['paste', 'paste.gif', 'lang_paste_desc', 'Paste'],
-		['undo', 'undo.gif', 'lang_undo_desc', 'Undo'],
-		['redo', 'redo.gif', 'lang_redo_desc', 'Redo'],
-		['link', 'link.gif', 'lang_link_desc', 'mceLink', true],
-		['unlink', 'unlink.gif', 'lang_unlink_desc', 'unlink'],
-		['image', 'image.gif', 'lang_image_desc', 'mceImage', true],
-		['cleanup', 'cleanup.gif', 'lang_cleanup_desc', 'mceCleanup'],
-		['help', 'help.gif', 'lang_help_desc', 'mceHelp'],
-		['code', 'code.gif', 'lang_theme_code_desc', 'mceCodeEditor'],
-		['hr', 'hr.gif', 'lang_theme_hr_desc', 'inserthorizontalrule'],
-		['removeformat', 'removeformat.gif', 'lang_theme_removeformat_desc', 'removeformat'],
-		['sub', 'sub.gif', 'lang_theme_sub_desc', 'subscript'],
-		['sup', 'sup.gif', 'lang_theme_sup_desc', 'superscript'],
-		['forecolor', 'forecolor.gif', 'lang_theme_forecolor_desc', 'forecolor', true],
-		['forecolorpicker', 'forecolor.gif', 'lang_theme_forecolor_desc', 'forecolorpicker', true],
-		['backcolor', 'backcolor.gif', 'lang_theme_backcolor_desc', 'HiliteColor', true],
-		['backcolorpicker', 'backcolor.gif', 'lang_theme_backcolor_desc', 'backcolorpicker', true],
-		['charmap', 'charmap.gif', 'lang_theme_charmap_desc', 'mceCharMap'],
-		['visualaid', 'visualaid.gif', 'lang_theme_visualaid_desc', 'mceToggleVisualAid'],
-		['anchor', 'anchor.gif', 'lang_theme_anchor_desc', 'mceInsertAnchor'],
-		['newdocument', 'newdocument.gif', 'lang_newdocument_desc', 'mceNewDocument']
-	],
+	// Tell it to load theme specific language pack(s)
+	tinymce.ThemeManager.requireLangPack('advanced');
 
-	_buttonMap : 'anchor,backcolor,bold,bullist,charmap,cleanup,code,copy,cut,forecolor,help,hr,image,indent,italic,justifycenter,justifyfull,justifyleft,justifyright,link,newdocument,numlist,outdent,paste,redo,removeformat,strikethrough,sub,sup,underline,undo,unlink,visualaid,advhr,ltr,rtl,emotions,flash,fullpage,fullscreen,iespell,insertdate,inserttime,pastetext,pasteword,selectall,preview,print,save,replace,search,table,cell_props,delete_col,delete_row,col_after,col_before,row_after,row_before,merge_cells,row_props,split_cells,delete_table',
+	tinymce.create('tinymce.themes.AdvancedTheme', {
+		sizes : [8, 10, 12, 14, 18, 24, 36],
 
-	/**
-	 * Returns HTML code for the specificed control.
-	 */
-	getControlHTML : function(button_name) {
-		var i, x, but;
+		// Control name lookup, format: title, command
+		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']
+		},
 
-		// Lookup button in button list
-		for (i=0; i<TinyMCE_AdvancedTheme._buttons.length; i++) {
-			but = TinyMCE_AdvancedTheme._buttons[i];
+		stateControls : ['bold', 'italic', 'underline', 'strikethrough', 'bullist', 'numlist', 'justifyleft', 'justifycenter', 'justifyright', 'justifyfull', 'sub', 'sup', 'blockquote'],
 
-			if (but[0] == button_name && (button_name == "forecolor" || button_name == "backcolor"))
-				return tinyMCE.getMenuButtonHTML(but[0], but[2], '{$themeurl}/images/' + but[1], but[3] + "Menu", but[3], (but.length > 4 ? but[4] : false), (but.length > 5 ? but[5] : null));
+		init : function(ed, url) {
+			var t = this, s, v, o;
+	
+			t.editor = ed;
+			t.url = url;
+			t.onResolveName = new tinymce.util.Dispatcher(this);
 
-			if (but[0] == button_name)
-				return tinyMCE.getButtonHTML(but[0], but[2], '{$themeurl}/images/' + but[1], but[3], (but.length > 4 ? but[4] : false), (but.length > 5 ? but[5] : null));
-		}
+			// Default settings
+			t.settings = s = extend({
+				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 : ed.settings.readonly
+			}, ed.settings);
 
-		// Custom controlls other than buttons
-		switch (button_name) {
-			case "formatselect":
-				var html = '<select id="{$editor_id}_formatSelect" name="{$editor_id}_formatSelect" onfocus="tinyMCE.addSelectAccessibility(event, this, window);" onchange="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'FormatBlock\',false,this.options[this.selectedIndex].value);" class="mceSelectList">';
-				var formats = tinyMCE.getParam("theme_advanced_blockformats", "p,address,pre,h1,h2,h3,h4,h5,h6", true).split(',');
-				var lookup = [
-					['p', '{$lang_theme_paragraph}'],
-					['address', '{$lang_theme_address}'],
-					['pre', '{$lang_theme_pre}'],
-					['h1', '{$lang_theme_h1}'],
-					['h2', '{$lang_theme_h2}'],
-					['h3', '{$lang_theme_h3}'],
-					['h4', '{$lang_theme_h4}'],
-					['h5', '{$lang_theme_h5}'],
-					['h6', '{$lang_theme_h6}'],
-					['div', '{$lang_theme_div}'],
-					['blockquote', '{$lang_theme_blockquote}'],
-					['code', '{$lang_theme_code}'],
-					['dt', '{$lang_theme_dt}'],
-					['dd', '{$lang_theme_dd}'],
-					['samp', '{$lang_theme_samp}']
-				];
+			// Setup default font_size_style_values
+			if (!s.font_size_style_values)
+				s.font_size_style_values = "8pt,10pt,12pt,14pt,18pt,24pt,36pt";
 
-				html += '<option value="">{$lang_theme_block}</option>';
+			if (tinymce.is(s.theme_advanced_font_sizes, 'string')) {
+				s.font_size_style_values = tinymce.explode(s.font_size_style_values);
+				s.font_size_classes = tinymce.explode(s.font_size_classes || '');
 
-				// Build format select
-				for (var i=0; i<formats.length; i++) {
-					for (var x=0; x<lookup.length; x++) {
-						if (formats[i] == lookup[x][0])
-							html += '<option value="&lt;' + lookup[x][0] + '&gt;">' + lookup[x][1] + '</option>';
-					}
-				}
+				// Parse string value
+				o = {};
+				ed.settings.theme_advanced_font_sizes = s.theme_advanced_font_sizes;
+				each(ed.getParam('theme_advanced_font_sizes', '', 'hash'), function(v, k) {
+					var cl;
 
-				html += '</select>';
-
-				return html;
-
-			case "styleselect":
-				return '<select id="{$editor_id}_styleSelect" onmousedown="tinyMCE.themes.advanced._setupCSSClasses(\'{$editor_id}\');" name="{$editor_id}_styleSelect" onfocus="tinyMCE.addSelectAccessibility(event,this,window);" onchange="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'mceSetCSSClass\',false,this.options[this.selectedIndex].value);" class="mceSelectList">{$style_select_options}</select>';
-
-			case "fontselect":
-				var fontHTML = '<select id="{$editor_id}_fontNameSelect" name="{$editor_id}_fontNameSelect" onfocus="tinyMCE.addSelectAccessibility(event, this, window);" onchange="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'FontName\',false,this.options[this.selectedIndex].value);" class="mceSelectList"><option value="">{$lang_theme_fontdefault}</option>';
-				var iFonts = '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';
-				var nFonts = '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';
-				var fonts = tinyMCE.getParam("theme_advanced_fonts", nFonts).split(';');
-				for (i=0; i<fonts.length; i++) {
-					if (fonts[i] != '') {
-						var parts = fonts[i].split('=');
-						fontHTML += '<option value="' + parts[1] + '">' + parts[0] + '</option>';
+					if (k == v && v >= 1 && v <= 7) {
+						k = v + ' (' + t.sizes[v - 1] + 'pt)';
+						cl = s.font_size_classes[v - 1];
+						v = s.font_size_style_values[v - 1] || (t.sizes[v - 1] + 'pt');
 					}
-				}
 
-				fontHTML += '</select>';
-				return fontHTML;
+					if (/^\s*\./.test(v))
+						cl = v.replace(/\./g, '');
 
-			case "fontsizeselect":
-				return '<select id="{$editor_id}_fontSizeSelect" name="{$editor_id}_fontSizeSelect" onfocus="tinyMCE.addSelectAccessibility(event, this, window);" onchange="tinyMCE.execInstanceCommand(\'{$editor_id}\',\'FontSize\',false,this.options[this.selectedIndex].value);" class="mceSelectList">'+
-						'<option value="0">{$lang_theme_font_size}</option>'+
-						'<option value="1">1 (8 pt)</option>'+
-						'<option value="2">2 (10 pt)</option>'+
-						'<option value="3">3 (12 pt)</option>'+
-						'<option value="4">4 (14 pt)</option>'+
-						'<option value="5">5 (18 pt)</option>'+
-						'<option value="6">6 (24 pt)</option>'+
-						'<option value="7">7 (36 pt)</option>'+
-						'</select>';
+					o[k] = cl ? {'class' : cl} : {fontSize : v};
+				});
 
-			case "|":
-			case "separator":
-				return '<img src="{$themeurl}/images/separator.gif" width="2" height="20" class="mceSeparatorLine" alt="" />';
+				s.theme_advanced_font_sizes = o;
+			}
 
-			case "spacer":
-				return '<img src="{$themeurl}/images/separator.gif" width="2" height="15" border="0" class="mceSeparatorLine" style="vertical-align: middle" alt="" />';
+			if ((v = s.theme_advanced_path_location) && v != 'none')
+				s.theme_advanced_statusbar_location = s.theme_advanced_path_location;
 
-			case "rowseparator":
-				return '<br />';
-		}
+			if (s.theme_advanced_statusbar_location == 'none')
+				s.theme_advanced_statusbar_location = 0;
 
-		return "";
-	},
+			// Init editor
+			ed.onInit.add(function() {
+				if (!ed.settings.readonly)
+					ed.onNodeChange.add(t._nodeChanged, t);
 
-	/**
-	 * Theme specific execcommand handling.
-	 */
-	execCommand : function(editor_id, element, command, user_interface, value) {
-		switch (command) {
-			case 'mceHelp':
-				tinyMCE.openWindow({
-					file : 'about.htm',
-					width : 480,
-					height : 380
-				}, {
-					tinymce_version : tinyMCE.majorVersion + "." + tinyMCE.minorVersion,
-					tinymce_releasedate : tinyMCE.releaseDate,
-					inline : "yes"
-				});
-			return true;
+				if (ed.settings.content_css !== false)
+					ed.dom.loadCSS(ed.baseURI.toAbsolute(url + "/skins/" + ed.settings.skin + "/content.css"));
+			});
 
-			case "mceLink":
-				var inst = tinyMCE.getInstanceById(editor_id);
-				var doc = inst.getDoc();
-				var selectedText = "";
+			ed.onSetProgressState.add(function(ed, b, ti) {
+				var co, id = ed.id, tb;
 
-				if (tinyMCE.isMSIE) {
-					var rng = doc.selection.createRange();
-					selectedText = rng.text;
-				} else
-					selectedText = inst.getSel().toString();
+				if (b) {
+					t.progressTimer = setTimeout(function() {
+						co = ed.getContainer();
+						co = co.insertBefore(DOM.create('DIV', {style : 'position:relative'}), co.firstChild);
+						tb = DOM.get(ed.id + '_tbl');
 
-				if (!tinyMCE.linkElement) {
-					if ((tinyMCE.selectedElement.nodeName.toLowerCase() != "img") && (selectedText.length <= 0))
-						return true;
+						DOM.add(co, 'div', {id : id + '_blocker', 'class' : 'mceBlocker', style : {width : tb.clientWidth + 2, height : tb.clientHeight + 2}});
+						DOM.add(co, 'div', {id : id + '_progress', 'class' : 'mceProgress', style : {left : tb.clientWidth / 2, top : tb.clientHeight / 2}});
+					}, ti || 0);
+				} else {
+					DOM.remove(id + '_blocker');
+					DOM.remove(id + '_progress');
+					clearTimeout(t.progressTimer);
 				}
+			});
 
-				var href = "", target = "", title = "", onclick = "", action = "insert", style_class = "";
+			DOM.loadCSS(s.editor_css ? ed.documentBaseURI.toAbsolute(s.editor_css) : url + "/skins/" + ed.settings.skin + "/ui.css");
 
-				if (tinyMCE.selectedElement.nodeName.toLowerCase() == "a")
-					tinyMCE.linkElement = tinyMCE.selectedElement;
+			if (s.skin_variant)
+				DOM.loadCSS(url + "/skins/" + ed.settings.skin + "/ui_" + s.skin_variant + ".css");
+		},
 
-				// Is anchor not a link
-				if (tinyMCE.linkElement != null && tinyMCE.getAttrib(tinyMCE.linkElement, 'href') == "")
-					tinyMCE.linkElement = null;
+		createControl : function(n, cf) {
+			var cd, c;
 
-				if (tinyMCE.linkElement) {
-					href = tinyMCE.getAttrib(tinyMCE.linkElement, 'href');
-					target = tinyMCE.getAttrib(tinyMCE.linkElement, 'target');
-					title = tinyMCE.getAttrib(tinyMCE.linkElement, 'title');
-					onclick = tinyMCE.getAttrib(tinyMCE.linkElement, 'onclick');
-					style_class = tinyMCE.getAttrib(tinyMCE.linkElement, 'class');
+			if (c = cf.createControl(n))
+				return c;
 
-					// Try old onclick to if copy/pasted content
-					if (onclick == "")
-						onclick = tinyMCE.getAttrib(tinyMCE.linkElement, 'onclick');
+			switch (n) {
+				case "styleselect":
+					return this._createStyleSelect();
 
-					onclick = tinyMCE.cleanupEventStr(onclick);
+				case "formatselect":
+					return this._createBlockFormats();
 
-					href = eval(tinyMCE.settings['urlconverter_callback'] + "(href, tinyMCE.linkElement, true);");
+				case "fontselect":
+					return this._createFontSelect();
 
-					// Use mce_href if defined
-					mceRealHref = tinyMCE.getAttrib(tinyMCE.linkElement, 'mce_href');
-					if (mceRealHref != "") {
-						href = mceRealHref;
+				case "fontsizeselect":
+					return this._createFontSizeSelect();
 
-						if (tinyMCE.getParam('convert_urls'))
-							href = eval(tinyMCE.settings['urlconverter_callback'] + "(href, tinyMCE.linkElement, true);");
-					}
+				case "forecolor":
+					return this._createForeColorMenu();
 
-					action = "update";
-				}
+				case "backcolor":
+					return this._createBackColorMenu();
+			}
 
-				var template = new Array();
+			if ((cd = this.controls[n]))
+				return cf.createButton(n, {title : "advanced." + cd[0], cmd : cd[1], ui : cd[2], value : cd[3]});
+		},
 
-				template['file'] = 'link.htm';
-				template['width'] = 310;
-				template['height'] = 200;
+		execCommand : function(cmd, ui, val) {
+			var f = this['_' + cmd];
 
-				// Language specific width and height addons
-				template['width'] += tinyMCE.getLang('lang_insert_link_delta_width', 0);
-				template['height'] += tinyMCE.getLang('lang_insert_link_delta_height', 0);
-
-				if (inst.settings['insertlink_callback']) {
-					var returnVal = eval(inst.settings['insertlink_callback'] + "(href, target, title, onclick, action, style_class);");
-					if (returnVal && returnVal['href'])
-						TinyMCE_AdvancedTheme._insertLink(returnVal['href'], returnVal['target'], returnVal['title'], returnVal['onclick'], returnVal['style_class']);
-				} else {
-					tinyMCE.openWindow(template, {href : href, target : target, title : title, onclick : onclick, action : action, className : style_class, inline : "yes"});
-				}
-
+			if (f) {
+				f.call(this, ui, val);
 				return true;
+			}
 
-			case "mceImage":
-				var src = "", alt = "", border = "", hspace = "", vspace = "", width = "", height = "", align = "";
-				var title = "", onmouseover = "", onmouseout = "", action = "insert";
-				var img = tinyMCE.imgElement;
-				var inst = tinyMCE.getInstanceById(editor_id);
+			return false;
+		},
 
-				if (tinyMCE.selectedElement != null && tinyMCE.selectedElement.nodeName.toLowerCase() == "img") {
-					img = tinyMCE.selectedElement;
-					tinyMCE.imgElement = img;
-				}
+		_importClasses : function(e) {
+			var ed = this.editor, ctrl = ed.controlManager.get('styleselect');
 
-				if (img) {
-					// Is it a internal MCE visual aid image, then skip this one.
-					if (tinyMCE.getAttrib(img, 'name').indexOf('mce_') == 0)
-						return true;
+			if (ctrl.getLength() == 0) {
+				each(ed.dom.getClasses(), function(o, idx) {
+					var name = 'style_' + idx;
 
-					src = tinyMCE.getAttrib(img, 'src');
-					alt = tinyMCE.getAttrib(img, 'alt');
+					ed.formatter.register(name, {
+						inline : 'span',
+						attributes : {'class' : o['class']},
+						selector : '*'
+					});
 
-					// Try polling out the title
-					if (alt == "")
-						alt = tinyMCE.getAttrib(img, 'title');
+					ctrl.add(o['class'], name);
+				});
+			}
+		},
 
-					// Fix width/height attributes if the styles is specified
-					if (tinyMCE.isGecko) {
-						var w = img.style.width;
-						if (w != null && w != "")
-							img.setAttribute("width", w);
+		_createStyleSelect : function(n) {
+			var t = this, ed = t.editor, ctrlMan = ed.controlManager, ctrl;
 
-						var h = img.style.height;
-						if (h != null && h != "")
-							img.setAttribute("height", h);
-					}
+			// Setup style select box
+			ctrl = ctrlMan.createListBox('styleselect', {
+				title : 'advanced.style_select',
+				onselect : function(name) {
+					var matches, formatNames = [];
 
-					border = tinyMCE.getAttrib(img, 'border');
-					hspace = tinyMCE.getAttrib(img, 'hspace');
-					vspace = tinyMCE.getAttrib(img, 'vspace');
-					width = tinyMCE.getAttrib(img, 'width');
-					height = tinyMCE.getAttrib(img, 'height');
-					align = tinyMCE.getAttrib(img, 'align');
-					onmouseover = tinyMCE.getAttrib(img, 'onmouseover');
-					onmouseout = tinyMCE.getAttrib(img, 'onmouseout');
-					title = tinyMCE.getAttrib(img, 'title');
+					each(ctrl.items, function(item) {
+						formatNames.push(item.value);
+					});
 
-					// Is realy specified?
-					if (tinyMCE.isMSIE) {
-						width = img.attributes['width'].specified ? width : "";
-						height = img.attributes['height'].specified ? height : "";
-					}
+					ed.focus();
+					ed.undoManager.add();
 
-					//onmouseover = tinyMCE.getImageSrc(tinyMCE.cleanupEventStr(onmouseover));
-					//onmouseout = tinyMCE.getImageSrc(tinyMCE.cleanupEventStr(onmouseout));
+					// Toggle off the current format
+					matches = ed.formatter.matchAll(formatNames);
+					if (!name || matches[0] == name)
+						ed.formatter.remove(matches[0]);
+					else
+						ed.formatter.apply(name);
 
-					src = eval(tinyMCE.settings['urlconverter_callback'] + "(src, img, true);");
+					ed.undoManager.add();
+					ed.nodeChanged();
 
-					// Use mce_src if defined
-					mceRealSrc = tinyMCE.getAttrib(img, 'mce_src');
-					if (mceRealSrc != "") {
-						src = mceRealSrc;
-
-						if (tinyMCE.getParam('convert_urls'))
-							src = eval(tinyMCE.settings['urlconverter_callback'] + "(src, img, true);");
-					}
-
-					//if (onmouseover != "")
-					//	onmouseover = eval(tinyMCE.settings['urlconverter_callback'] + "(onmouseover, img, true);");
-
-					//if (onmouseout != "")
-					//	onmouseout = eval(tinyMCE.settings['urlconverter_callback'] + "(onmouseout, img, true);");
-
-					action = "update";
+					return false; // No auto select
 				}
+			});
 
-				var template = new Array();
+			// Handle specified format
+			ed.onInit.add(function() {
+				var counter = 0, formats = ed.getParam('style_formats');
 
-				template['file'] = 'image.htm?src={$src}';
-				template['width'] = 355;
-				template['height'] = 265 + (tinyMCE.isMSIE ? 25 : 0);
+				if (formats) {
+					each(formats, function(fmt) {
+						var name, keys = 0;
 
-				// Language specific width and height addons
-				template['width'] += tinyMCE.getLang('lang_insert_image_delta_width', 0);
-				template['height'] += tinyMCE.getLang('lang_insert_image_delta_height', 0);
+						each(fmt, function() {keys++;});
 
-				if (inst.settings['insertimage_callback']) {
-					var returnVal = eval(inst.settings['insertimage_callback'] + "(src, alt, border, hspace, vspace, width, height, align, title, onmouseover, onmouseout, action);");
-					if (returnVal && returnVal['src'])
-						TinyMCE_AdvancedTheme._insertImage(returnVal['src'], returnVal['alt'], returnVal['border'], returnVal['hspace'], returnVal['vspace'], returnVal['width'], returnVal['height'], returnVal['align'], returnVal['title'], returnVal['onmouseover'], returnVal['onmouseout']);
-				} else
-					tinyMCE.openWindow(template, {src : src, alt : alt, border : border, hspace : hspace, vspace : vspace, width : width, height : height, align : align, title : title, onmouseover : onmouseover, onmouseout : onmouseout, action : action, inline : "yes"});
+						if (keys > 1) {
+							name = fmt.name = fmt.name || 'style_' + (counter++);
+							ed.formatter.register(name, fmt);
+							ctrl.add(fmt.title, name);
+						} else
+							ctrl.add(fmt.title);
+					});
+				} else {
+					each(ed.getParam('theme_advanced_styles', '', 'hash'), function(val, key) {
+						var name;
 
-				return true;
+						if (val) {
+							name = 'style_' + (counter++);
 
-			case "forecolor":
-				var fcp = new TinyMCE_Layer(editor_id + '_fcPreview', false), p, img, elm;
+							ed.formatter.register(name, {
+								inline : 'span',
+								classes : val,
+								selector : '*'
+							});
 
-				TinyMCE_AdvancedTheme._hideMenus(editor_id);
-
-				if (!fcp.exists()) {
-					fcp.create('div', 'mceColorPreview', document.getElementById(editor_id + '_toolbar'));
-					elm = fcp.getElement();
-					elm._editor_id = editor_id;
-					elm._command = "forecolor";
-					elm._switchId = editor_id + "_forecolor";
-					tinyMCE.addEvent(elm, 'click', TinyMCE_AdvancedTheme._handleMenuEvent);
-					tinyMCE.addEvent(elm, 'mouseover', TinyMCE_AdvancedTheme._handleMenuEvent);
-					tinyMCE.addEvent(elm, 'mouseout', TinyMCE_AdvancedTheme._handleMenuEvent);
+							ctrl.add(t.editor.translate(key), name);
+						}
+					});
 				}
+			});
 
-				img = tinyMCE.selectNodes(document.getElementById(editor_id + "_forecolor"), function(n) {return n.nodeName == "IMG";})[0];
-				p = tinyMCE.getAbsPosition(img, document.getElementById(editor_id + '_toolbar'));
+			// Auto import classes if the ctrl box is empty
+			if (ctrl.getLength() == 0) {
+				ctrl.onPostRender.add(function(ed, n) {
+					if (!ctrl.NativeListBox) {
+						Event.add(n.id + '_text', 'focus', t._importClasses, t);
+						Event.add(n.id + '_text', 'mousedown', t._importClasses, t);
+						Event.add(n.id + '_open', 'focus', t._importClasses, t);
+						Event.add(n.id + '_open', 'mousedown', t._importClasses, t);
+					} else
+						Event.add(n.id, 'focus', t._importClasses, t);
+				});
+			}
 
-				fcp.moveTo(p.absLeft, p.absTop);
-				fcp.getElement().style.backgroundColor = value != null ? value : tinyMCE.getInstanceById(editor_id).foreColor;
-				fcp.show();
+			return ctrl;
+		},
 
-				return false;
+		_createFontSelect : function() {
+			var c, t = this, ed = t.editor;
 
-			case "forecolorpicker":
-				this._pickColor(editor_id, 'forecolor');
-				return true;
+			c = ed.controlManager.createListBox('fontselect', {
+				title : 'advanced.fontdefault',
+				onselect : function(v) {
+					var cur = c.items[c.selectedIndex];
 
-			case "forecolorMenu":
-				TinyMCE_AdvancedTheme._hideMenus(editor_id);
+					if (!v && cur) {
+						ed.execCommand('FontName', false, cur.value);
+						return;
+					}
 
-				// Create color layer
-				var ml = new TinyMCE_Layer(editor_id + '_fcMenu');
+					ed.execCommand('FontName', false, v);
 
-				if (!ml.exists())
-					ml.create('div', 'mceMenu', document.body, TinyMCE_AdvancedTheme._getColorHTML(editor_id, 'theme_advanced_text_colors', 'forecolor'));
+					// Fake selection, execCommand will fire a nodeChange and update the selection
+					c.select(function(sv) {
+						return v == sv;
+					});
 
-				tinyMCE.switchClass(editor_id + '_forecolor', 'mceMenuButtonFocus');
-				ml.moveRelativeTo(document.getElementById(editor_id + "_forecolor"), 'bl');
-
-				ml.moveBy(tinyMCE.isMSIE && !tinyMCE.isOpera ? -1 : 1, -1);
-
-				if (tinyMCE.isOpera)
-					ml.moveBy(0, -2);
-
-				ml.show();
-			return true;
-
-			case "HiliteColor":
-				var bcp = new TinyMCE_Layer(editor_id + '_bcPreview', false), p, img;
-
-				TinyMCE_AdvancedTheme._hideMenus(editor_id);
-
-				if (!bcp.exists()) {
-					bcp.create('div', 'mceColorPreview', document.getElementById(editor_id + '_toolbar'));
-					elm = bcp.getElement();
-					elm._editor_id = editor_id;
-					elm._command = "HiliteColor";
-					elm._switchId = editor_id + "_backcolor";
-					tinyMCE.addEvent(elm, 'click', TinyMCE_AdvancedTheme._handleMenuEvent);
-					tinyMCE.addEvent(elm, 'mouseover', TinyMCE_AdvancedTheme._handleMenuEvent);
-					tinyMCE.addEvent(elm, 'mouseout', TinyMCE_AdvancedTheme._handleMenuEvent);
+					return false; // No auto select
 				}
+			});
 
-				img = tinyMCE.selectNodes(document.getElementById(editor_id + "_backcolor"), function(n) {return n.nodeName == "IMG";})[0];
-				p = tinyMCE.getAbsPosition(img, document.getElementById(editor_id + '_toolbar'));
+			if (c) {
+				each(ed.getParam('theme_advanced_fonts', t.settings.theme_advanced_fonts, 'hash'), function(v, k) {
+					c.add(ed.translate(k), v, {style : v.indexOf('dings') == -1 ? 'font-family:' + v : ''});
+				});
+			}
 
-				bcp.moveTo(p.absLeft, p.absTop);
-				bcp.getElement().style.backgroundColor = value != null ? value : tinyMCE.getInstanceById(editor_id).backColor;
-				bcp.show();
+			return c;
+		},
 
-				return false;
+		_createFontSizeSelect : function() {
+			var t = this, ed = t.editor, c, i = 0, cl = [];
 
-			case "HiliteColorMenu":
-				TinyMCE_AdvancedTheme._hideMenus(editor_id);
+			c = ed.controlManager.createListBox('fontsizeselect', {title : 'advanced.font_size', onselect : function(v) {
+				var cur = c.items[c.selectedIndex];
 
-				// Create color layer
-				var ml = new TinyMCE_Layer(editor_id + '_bcMenu');
+				if (!v && cur) {
+					cur = cur.value;
 
-				if (!ml.exists())
-					ml.create('div', 'mceMenu', document.body, TinyMCE_AdvancedTheme._getColorHTML(editor_id, 'theme_advanced_background_colors', 'HiliteColor'));
-
-				tinyMCE.switchClass(editor_id + '_backcolor', 'mceMenuButtonFocus');
-				ml.moveRelativeTo(document.getElementById(editor_id + "_backcolor"), 'bl');
-
-				ml.moveBy(tinyMCE.isMSIE && !tinyMCE.isOpera ? -1 : 1, -1);
-
-				if (tinyMCE.isOpera)
-					ml.moveBy(0, -2);
-
-				ml.show();
-			return true;
-	
-			case "backcolorpicker":
-				this._pickColor(editor_id, 'HiliteColor');
-				return true;
-
-			case "mceColorPicker":
-				if (user_interface) {
-					var template = [];
-	
-					if (!value['callback'] && !value['color'])
-						value['color'] = value['document'].getElementById(value['element_id']).value;
-
-					template['file'] = 'color_picker.htm';
-					template['width'] = 380;
-					template['height'] = 250;
-					template['close_previous'] = "no";
-
-					template['width'] += tinyMCE.getLang('lang_theme_advanced_colorpicker_delta_width', 0);
-					template['height'] += tinyMCE.getLang('lang_theme_advanced_colorpicker_delta_height', 0);
-
-					if (typeof(value['store_selection']) == "undefined")
-						value['store_selection'] = true;
-
-					tinyMCE.lastColorPickerValue = value;
-					tinyMCE.openWindow(template, {editor_id : editor_id, mce_store_selection : value['store_selection'], inline : "yes", command : "mceColorPicker", input_color : value['color']});
-				} else {
-					var savedVal = tinyMCE.lastColorPickerValue, elm;
-
-					if (savedVal['callback']) {
-						savedVal['callback'](value);
-						return true;
+					if (cur['class']) {
+						ed.formatter.toggle('fontsize_class', {value : cur['class']});
+						ed.undoManager.add();
+						ed.nodeChanged();
+					} else {
+						ed.execCommand('FontSize', false, cur.fontSize);
 					}
 
-					elm = savedVal['document'].getElementById(savedVal['element_id']);
-					elm.value = value;
-
-					if (elm.onchange != null && elm.onchange != '')
-						eval('elm.onchange();');
+					return;
 				}
-			return true;
 
-			case "mceCodeEditor":
-				var template = new Array();
+				if (v['class']) {
+					ed.focus();
+					ed.undoManager.add();
+					ed.formatter.toggle('fontsize_class', {value : v['class']});
+					ed.undoManager.add();
+					ed.nodeChanged();
+				} else
+					ed.execCommand('FontSize', false, v.fontSize);
 
-				template['file'] = 'source_editor.htm';
-				template['width'] = parseInt(tinyMCE.getParam("theme_advanced_source_editor_width", 720));
-				template['height'] = parseInt(tinyMCE.getParam("theme_advanced_source_editor_height", 580));
+				// Fake selection, execCommand will fire a nodeChange and update the selection
+				c.select(function(sv) {
+					return v == sv;
+				});
 
-				tinyMCE.openWindow(template, {editor_id : editor_id, resizable : "yes", scrollbars : "no", inline : "yes"});
-				return true;
+				return false; // No auto select
+			}});
 
-			case "mceCharMap":
-				var template = new Array();
+			if (c) {
+				each(t.settings.theme_advanced_font_sizes, function(v, k) {
+					var fz = v.fontSize;
 
-				template['file'] = 'charmap.htm';
-				template['width'] = 550 + (tinyMCE.isOpera ? 40 : 0);
-				template['height'] = 250;
+					if (fz >= 1 && fz <= 7)
+						fz = t.sizes[parseInt(fz) - 1] + 'pt';
 
-				template['width'] += tinyMCE.getLang('lang_theme_advanced_charmap_delta_width', 0);
-				template['height'] += tinyMCE.getLang('lang_theme_advanced_charmap_delta_height', 0);
+					c.add(k, v, {'style' : 'font-size:' + fz, 'class' : 'mceFontSize' + (i++) + (' ' + (v['class'] || ''))});
+				});
+			}
 
-				tinyMCE.openWindow(template, {editor_id : editor_id, inline : "yes"});
-				return true;
+			return c;
+		},
 
-			case "mceInsertAnchor":
-				var template = new Array();
+		_createBlockFormats : function() {
+			var c, fmts = {
+				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'
+			}, t = this;
 
-				template['file'] = 'anchor.htm';
-				template['width'] = 320;
-				template['height'] = 90 + (tinyMCE.isNS7 ? 30 : 0);
+			c = t.editor.controlManager.createListBox('formatselect', {title : 'advanced.block', cmd : 'FormatBlock'});
+			if (c) {
+				each(t.editor.getParam('theme_advanced_blockformats', t.settings.theme_advanced_blockformats, 'hash'), function(v, k) {
+					c.add(t.editor.translate(k != v ? k : fmts[v]), v, {'class' : 'mce_formatPreview mce_' + v});
+				});
+			}
 
-				template['width'] += tinyMCE.getLang('lang_theme_advanced_anchor_delta_width', 0);
-				template['height'] += tinyMCE.getLang('lang_theme_advanced_anchor_delta_height', 0);
+			return c;
+		},
 
-				tinyMCE.openWindow(template, {editor_id : editor_id, inline : "yes"});
-				return true;
+		_createForeColorMenu : function() {
+			var c, t = this, s = t.settings, o = {}, v;
 
-			case "mceNewDocument":
-				if (confirm(tinyMCE.entityDecode(tinyMCE.getLang('lang_newdocument'))))
-					tinyMCE.execInstanceCommand(editor_id, 'mceSetContent', false, ' ');
-
-				return true;
-		}
-
-		return false;
-	},
-
-	/**
-	 * Editor instance template function.
-	 */
-	getEditorTemplate : function(settings, editorId) {
-		function removeFromArray(in_array, remove_array) {
-			var outArray = new Array(), skip;
-			
-			for (var i=0; i<in_array.length; i++) {
-				skip = false;
-
-				for (var j=0; j<remove_array.length; j++) {
-					if (in_array[i] == remove_array[j]) {
-						skip = true;
-					}
-				}
-
-				if (!skip) {
-					outArray[outArray.length] = in_array[i];
-				}
+			if (s.theme_advanced_more_colors) {
+				o.more_colors_func = function() {
+					t._mceColorPicker(0, {
+						color : c.value,
+						func : function(co) {
+							c.setColor(co);
+						}
+					});
+				};
 			}
 
-			return outArray;
-		}
+			if (v = s.theme_advanced_text_colors)
+				o.colors = v;
 
-		function addToArray(in_array, add_array) {
-			for (var i=0; i<add_array.length; i++) {
-				in_array[in_array.length] = add_array[i];
-			}
+			if (s.theme_advanced_default_foreground_color)
+				o.default_color = s.theme_advanced_default_foreground_color;
 
-			return in_array;
-		}
+			o.title = 'advanced.forecolor_desc';
+			o.cmd = 'ForeColor';
+			o.scope = this;
 
-		var template = new Array();
-		var deltaHeight = 0;
-		var resizing = tinyMCE.getParam("theme_advanced_resizing", false);
-		var path = tinyMCE.getParam("theme_advanced_path", true);
-		var statusbarHTML = '<div id="{$editor_id}_path" class="mceStatusbarPathText" style="display: ' + (path ? "block" : "none") + '">&#160;</div><div id="{$editor_id}_resize" class="mceStatusbarResize" style="display: ' + (resizing ? "block" : "none") + '" onmousedown="tinyMCE.themes.advanced._setResizing(event,\'{$editor_id}\',true);"></div><br style="clear: both" />';
-		var layoutManager = tinyMCE.getParam("theme_advanced_layout_manager", "SimpleLayout");
+			c = t.editor.controlManager.createColorSplitButton('forecolor', o);
 
-		// Setup style select options -- MOVED UP FOR EXTERNAL TOOLBAR COMPATABILITY!
-		var styleSelectHTML = '<option value="">{$lang_theme_style_select}</option>';
-		if (settings['theme_advanced_styles']) {
-			var stylesAr = settings['theme_advanced_styles'].split(';');
-			
-			for (var i=0; i<stylesAr.length; i++) {
-				var key, value;
+			return c;
+		},
 
-				key = stylesAr[i].split('=')[0];
-				value = stylesAr[i].split('=')[1];
+		_createBackColorMenu : function() {
+			var c, t = this, s = t.settings, o = {}, v;
 
-				styleSelectHTML += '<option value="' + value + '">' + key + '</option>';
+			if (s.theme_advanced_more_colors) {
+				o.more_colors_func = function() {
+					t._mceColorPicker(0, {
+						color : c.value,
+						func : function(co) {
+							c.setColor(co);
+						}
+					});
+				};
 			}
 
-			TinyMCE_AdvancedTheme._autoImportCSSClasses = false;
-		}
+			if (v = s.theme_advanced_background_colors)
+				o.colors = v;
 
-		switch(layoutManager) {
-			case "SimpleLayout" : //the default TinyMCE Layout (for backwards compatibility)...
-				var toolbarHTML = "";
-				var toolbarLocation = tinyMCE.getParam("theme_advanced_toolbar_location", "bottom");
-				var toolbarAlign = tinyMCE.getParam("theme_advanced_toolbar_align", "center");
-				var pathLocation = tinyMCE.getParam("theme_advanced_path_location", "none"); // Compatiblity
-				var statusbarLocation = tinyMCE.getParam("theme_advanced_statusbar_location", pathLocation);
-				var defVals = {
-					theme_advanced_buttons1 : "bold,italic,underline,strikethrough,separator,justifyleft,justifycenter,justifyright,justifyfull,separator,styleselect,formatselect",
-					theme_advanced_buttons2 : "bullist,numlist,separator,outdent,indent,separator,undo,redo,separator,link,unlink,anchor,image,cleanup,help,code",
-					theme_advanced_buttons3 : "hr,removeformat,visualaid,separator,sub,sup,separator,charmap"
-				};
+			if (s.theme_advanced_default_background_color)
+				o.default_color = s.theme_advanced_default_background_color;
 
-				// Add accessibility control
-				toolbarHTML += '<a href="#" accesskey="q" title="' + tinyMCE.getLang("lang_toolbar_focus") + '"';
+			o.title = 'advanced.backcolor_desc';
+			o.cmd = 'HiliteColor';
+			o.scope = this;
 
-				if (!tinyMCE.getParam("accessibility_focus"))
-					toolbarHTML += ' onfocus="tinyMCE.getInstanceById(\'' + editorId + '\').getWin().focus();"';
+			c = t.editor.controlManager.createColorSplitButton('backcolor', o);
 
-				toolbarHTML += '></a>';
+			return c;
+		},
 
-				// Render rows
-				for (var i=1; i<100; i++) {
-					var def = defVals["theme_advanced_buttons" + i];
+		renderUI : function(o) {
+			var n, ic, tb, t = this, ed = t.editor, s = t.settings, sc, p, nl;
 
-					var buttons = tinyMCE.getParam("theme_advanced_buttons" + i, def == null ? '' : def, true, ',');
-					if (buttons.length == 0)
-						break;
+			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) : '')});
 
-					buttons = removeFromArray(buttons, tinyMCE.getParam("theme_advanced_disable", "", true, ','));
-					buttons = addToArray(buttons, tinyMCE.getParam("theme_advanced_buttons" + i + "_add", "", true, ','));
-					buttons = addToArray(tinyMCE.getParam("theme_advanced_buttons" + i + "_add_before", "", true, ','), buttons);
+			if (!DOM.boxModel)
+				n = DOM.add(n, 'div', {'class' : 'mceOldBoxModel'});
 
-					for (var b=0; b<buttons.length; b++)
-						toolbarHTML += tinyMCE.getControlHTML(buttons[b]);
+			n = sc = DOM.add(n, 'table', {id : ed.id + '_tbl', 'class' : 'mceLayout', cellSpacing : 0, cellPadding : 0});
+			n = tb = DOM.add(n, 'tbody');
 
-					if (buttons.length > 0) {
-						toolbarHTML += "<br />";
-						deltaHeight -= 23;
-					}
-				}
+			switch ((s.theme_advanced_layout_manager || '').toLowerCase()) {
+				case "rowlayout":
+					ic = t._rowLayout(s, tb, o);
+					break;
 
-				// Add accessibility control
-				toolbarHTML += '<a href="#" accesskey="z" onfocus="tinyMCE.getInstanceById(\'' + editorId + '\').getWin().focus();"></a>';
+				case "customlayout":
+					ic = ed.execCallback("theme_advanced_custom_layout", s, tb, o, p);
+					break;
 
-				// Setup template html
-				template['html'] = '<table class="mceEditor" border="0" cellpadding="0" cellspacing="0" width="{$width}" height="{$height}" style="width:{$width_style};height:{$height_style}"><tbody>';
+				default:
+					ic = t._simpleLayout(s, tb, o, p);
+			}
 
-				if (toolbarLocation == "top")
-					template['html'] += '<tr><td dir="ltr" class="mceToolbarTop" align="' + toolbarAlign + '" height="1" nowrap="nowrap"><span id="' + editorId + '_toolbar" class="mceToolbarContainer">' + toolbarHTML + '</span></td></tr>';
+			n = o.targetNode;
 
-				if (statusbarLocation == "top") {
-					template['html'] += '<tr><td class="mceStatusbarTop" height="1">' + statusbarHTML + '</td></tr>';
-					deltaHeight -= 23;
-				}
+			// Add classes to first and last TRs
+			nl = DOM.stdMode ? sc.getElementsByTagName('tr') : sc.rows; // Quick fix for IE 8
+			DOM.addClass(nl[0], 'mceFirst');
+			DOM.addClass(nl[nl.length - 1], 'mceLast');
 
-				template['html'] += '<tr><td align="center"><span id="{$editor_id}"></span></td></tr>';
+			// Add classes to first and last TDs
+			each(DOM.select('tr', tb), function(n) {
+				DOM.addClass(n.firstChild, 'mceFirst');
+				DOM.addClass(n.childNodes[n.childNodes.length - 1], 'mceLast');
+			});
 
-				if (toolbarLocation == "bottom")
-					template['html'] += '<tr><td dir="ltr" class="mceToolbarBottom" align="' + toolbarAlign + '" height="1"><span id="' + editorId + '_toolbar" class="mceToolbarContainer">' + toolbarHTML + '</span></td></tr>';
+			if (DOM.get(s.theme_advanced_toolbar_container))
+				DOM.get(s.theme_advanced_toolbar_container).appendChild(p);
+			else
+				DOM.insertAfter(p, n);
 
-				// External toolbar changes
-				if (toolbarLocation == "external") {
-					var bod = document.body;
-					var elm = document.createElement ("div");
+			Event.add(ed.id + '_path_row', 'click', function(e) {
+				e = e.target;
 
-					toolbarHTML = tinyMCE.replaceVar(toolbarHTML, 'style_select_options', styleSelectHTML);
-					toolbarHTML = tinyMCE.applyTemplate(toolbarHTML, {editor_id : editorId});
+				if (e.nodeName == 'A') {
+					t._sel(e.className.replace(/^.*mcePath_([0-9]+).*$/, '$1'));
 
-					elm.className = "mceToolbarExternal";
-					elm.id = editorId+"_toolbar";
-					elm.innerHTML = '<table width="100%" border="0" align="center"><tr><td align="center">'+toolbarHTML+'</td></tr></table>';
-					bod.appendChild (elm);
-					// bod.style.marginTop = elm.offsetHeight + "px";
-
-					deltaHeight = 0;
-					tinyMCE.getInstanceById(editorId).toolbarElement = elm;
-
-					//template['html'] = '<div id="mceExternalToolbar" align="center" class="mceToolbarExternal"><table width="100%" border="0" align="center"><tr><td align="center">'+toolbarHTML+'</td></tr></table></div>' + template["html"];
-				} else {
-					tinyMCE.getInstanceById(editorId).toolbarElement = null;
+					return Event.cancel(e);
 				}
+			});
+/*
+			if (DOM.get(ed.id + '_path_row')) {
+				Event.add(ed.id + '_tbl', 'mouseover', function(e) {
+					var re;
+	
+					e = e.target;
 
-				if (statusbarLocation == "bottom") {
-					template['html'] += '<tr><td class="mceStatusbarBottom" height="1">' + statusbarHTML + '</td></tr>';
-					deltaHeight -= 23;
-				}
+					if (e.nodeName == 'SPAN' && DOM.hasClass(e.parentNode, 'mceButton')) {
+						re = DOM.get(ed.id + '_path_row');
+						t.lastPath = re.innerHTML;
+						DOM.setHTML(re, e.parentNode.title);
+					}
+				});
 
-				template['html'] += '</tbody></table>';
-				//"SimpleLayout"
-			break;
+				Event.add(ed.id + '_tbl', 'mouseout', function(e) {
+					if (t.lastPath) {
+						DOM.setHTML(ed.id + '_path_row', t.lastPath);
+						t.lastPath = 0;
+					}
+				});
+			}
+*/
 
-			case "RowLayout" : //Container Layout - containers defined in "theme_advanced_containers" are rendered from top to bottom.
-				template['html'] = '<table class="mceEditor" border="0" cellpadding="0" cellspacing="0" width="{$width}" height="{$height}" style="width:{$width}px;height:{$height}px"><tbody>';
+			if (!ed.getParam('accessibility_focus'))
+				Event.add(DOM.add(p, 'a', {href : '#'}, '<!-- IE -->'), 'focus', function() {tinyMCE.get(ed.id).focus();});
 
-				var containers = tinyMCE.getParam("theme_advanced_containers", "", true, ",");
-				var defaultContainerCSS = tinyMCE.getParam("theme_advanced_containers_default_class", "container");
-				var defaultContainerAlign = tinyMCE.getParam("theme_advanced_containers_default_align", "center");
+			if (s.theme_advanced_toolbar_location == 'external')
+				o.deltaHeight = 0;
 
-				//Render Containers:
-				for (var i = 0; i < containers.length; i++)
-				{
-					if (containers[i] == "mceEditor") //Exceptions for mceEditor and ...
-						template['html'] += '<tr><td align="center" class="mceEditor_border"><span id="{$editor_id}"></span></td></tr>';
-					else if (containers[i] == "mceElementpath" || containers[i] == "mceStatusbar") // ... mceElementpath:
-					{
-						var pathClass = "mceStatusbar";
+			t.deltaHeight = o.deltaHeight;
+			o.targetNode = null;
 
-						if (i == containers.length-1)
-						{
-							pathClass = "mceStatusbarBottom";
-						}
-						else if (i == 0)
-						{
-							pathClass = "mceStatusbar";
-						}
-						else
-						{
-							deltaHeight-=2;
-						}
+			return {
+				iframeContainer : ic,
+				editorContainer : ed.id + '_parent',
+				sizeContainer : sc,
+				deltaHeight : o.deltaHeight
+			};
+		},
 
-						template['html'] += '<tr><td class="' + pathClass + '" height="1">' + statusbarHTML + '</td></tr>';
-						deltaHeight -= 22;
-					} else { // Render normal Container
-						var curContainer = tinyMCE.getParam("theme_advanced_container_"+containers[i], "", true, ',');
-						var curContainerHTML = "";
-						var curAlign = tinyMCE.getParam("theme_advanced_container_"+containers[i]+"_align", defaultContainerAlign);
-						var curCSS = tinyMCE.getParam("theme_advanced_container_"+containers[i]+"_class", defaultContainerCSS);
+		getInfo : function() {
+			return {
+				longname : 'Advanced theme',
+				author : 'Moxiecode Systems AB',
+				authorurl : 'http://tinymce.moxiecode.com',
+				version : tinymce.majorVersion + "." + tinymce.minorVersion
+			}
+		},
 
-						curContainer = removeFromArray(curContainer, tinyMCE.getParam("theme_advanced_disable", "", true, ','));
+		resizeBy : function(dw, dh) {
+			var e = DOM.get(this.editor.id + '_tbl');
 
-						for (var j=0; j<curContainer.length; j++)
-							curContainerHTML += tinyMCE.getControlHTML(curContainer[j]);
+			this.resizeTo(e.clientWidth + dw, e.clientHeight + dh);
+		},
 
-						if (curContainer.length > 0) {
-							curContainerHTML += "<br />";
-							deltaHeight -= 23;
-						}
+		resizeTo : function(w, h) {
+			var ed = this.editor, s = this.settings, e = DOM.get(ed.id + '_tbl'), ifr = DOM.get(ed.id + '_ifr');
 
-						template['html'] += '<tr><td class="' + curCSS + '" align="' + curAlign + '" height="1">' + curContainerHTML + '</td></tr>';
-					}
-				}
+			// Boundery fix box
+			w = Math.max(s.theme_advanced_resizing_min_width || 100, w);
+			h = Math.max(s.theme_advanced_resizing_min_height || 100, h);
+			w = Math.min(s.theme_advanced_resizing_max_width || 0xFFFF, w);
+			h = Math.min(s.theme_advanced_resizing_max_height || 0xFFFF, h);
 
-				template['html'] += '</tbody></table>';
-				//RowLayout
-			break;
+			// Resize iframe and container
+			DOM.setStyle(e, 'height', '');
+			DOM.setStyle(ifr, 'height', h);
 
-			case "CustomLayout" : //User defined layout callback...
-				var customLayout = tinyMCE.getParam("theme_advanced_custom_layout","");
+			if (s.theme_advanced_resize_horizontal) {
+				DOM.setStyle(e, 'width', '');
+				DOM.setStyle(ifr, 'width', w);
 
-				if (customLayout != "" && eval("typeof(" + customLayout + ")") != "undefined") {
-					template = eval(customLayout + "(template);");
-				}
-			break;
-		}
+				// Make sure that the size is never smaller than the over all ui
+				if (w < e.clientWidth)
+					DOM.setStyle(ifr, 'width', e.clientWidth);
+			}
+		},
 
-		if (resizing)
-			template['html'] += '<span id="{$editor_id}_resize_box" class="mceResizeBox"></span>';
+		destroy : function() {
+			var id = this.editor.id;
 
-		template['html'] = tinyMCE.replaceVar(template['html'], 'style_select_options', styleSelectHTML);
+			Event.clear(id + '_resize');
+			Event.clear(id + '_path_row');
+			Event.clear(id + '_external_close');
+		},
 
-		// Set to default values
-		if (!template['delta_width'])
-			template['delta_width'] = 0;
+		// Internal functions
 
-		if (!template['delta_height'])
-			template['delta_height'] = deltaHeight;
+		_simpleLayout : function(s, tb, o, p) {
+			var t = this, ed = t.editor, lo = s.theme_advanced_toolbar_location, sl = s.theme_advanced_statusbar_location, n, ic, etb, c;
 
-		return template;
-	},
-
-	initInstance : function(inst) {
-		if (tinyMCE.getParam("theme_advanced_resizing", false)) {
-			if (tinyMCE.getParam("theme_advanced_resizing_use_cookie", true)) {
-				var w = TinyMCE_AdvancedTheme._getCookie("TinyMCE_" + inst.editorId + "_width");
-				var h = TinyMCE_AdvancedTheme._getCookie("TinyMCE_" + inst.editorId + "_height");
-
-				TinyMCE_AdvancedTheme._resizeTo(inst, w, h, tinyMCE.getParam("theme_advanced_resize_horizontal", true));
+			if (s.readonly) {
+				n = DOM.add(tb, 'tr');
+				n = ic = DOM.add(n, 'td', {'class' : 'mceIframeContainer'});
+				return ic;
 			}
-		}
 
-		inst.addShortcut('ctrl', 'k', 'lang_link_desc', 'mceLink');
-	},
+			// Create toolbar container at top
+			if (lo == 'top')
+				t._addToolbars(tb, o);
 
-	removeInstance : function(inst) {
-		new TinyMCE_Layer(inst.editorId + '_fcMenu').remove();
-		new TinyMCE_Layer(inst.editorId + '_bcMenu').remove();
-	},
+			// Create external toolbar
+			if (lo == 'external') {
+				n = c = DOM.create('div', {style : 'position:relative'});
+				n = DOM.add(n, 'div', {id : ed.id + '_external', 'class' : 'mceExternalToolbar'});
+				DOM.add(n, 'a', {id : ed.id + '_external_close', href : 'javascript:;', 'class' : 'mceExternalClose'});
+				n = DOM.add(n, 'table', {id : ed.id + '_tblext', cellSpacing : 0, cellPadding : 0});
+				etb = DOM.add(n, 'tbody');
 
-	hideInstance : function(inst) {
-		TinyMCE_AdvancedTheme._hideMenus(inst.editorId);
-	},
+				if (p.firstChild.className == 'mceOldBoxModel')
+					p.firstChild.appendChild(c);
+				else
+					p.insertBefore(c, p.firstChild);
 
-	_handleMenuEvent : function(e) {
-		var te = tinyMCE.isMSIE ? window.event.srcElement : e.target;
-		tinyMCE._menuButtonEvent(e.type == "mouseover" ? "over" : "out", document.getElementById(te._switchId));
+				t._addToolbars(etb, o);
 
-		if (e.type == "click")
-			tinyMCE.execInstanceCommand(te._editor_id, te._command);
-	},
+				ed.onMouseUp.add(function() {
+					var e = DOM.get(ed.id + '_external');
+					DOM.show(e);
 
-	_hideMenus : function(id) {
-		var fcml = new TinyMCE_Layer(id + '_fcMenu'), bcml = new TinyMCE_Layer(id + '_bcMenu');
+					DOM.hide(lastExtID);
 
-		if (fcml.exists() && fcml.isVisible()) {
-			tinyMCE.switchClass(id + '_forecolor', 'mceMenuButton');
-			fcml.hide();
-		}
+					var f = Event.add(ed.id + '_external_close', 'click', function() {
+						DOM.hide(ed.id + '_external');
+						Event.remove(ed.id + '_external_close', 'click', f);
+					});
 
-		if (bcml.exists() && bcml.isVisible()) {
-			tinyMCE.switchClass(id + '_backcolor', 'mceMenuButton');
-			bcml.hide();
-		}
-	},
+					DOM.show(e);
+					DOM.setStyle(e, 'top', 0 - DOM.getRect(ed.id + '_tblext').h - 1);
 
-	/**
-	 * Node change handler.
-	 */
-	handleNodeChange : function(editor_id, node, undo_index, undo_levels, visual_aid, any_selection, setup_content) {
-		var alignNode, breakOut, classNode;
+					// Fixes IE rendering bug
+					DOM.hide(e);
+					DOM.show(e);
+					e.style.filter = '';
 
-		function selectByValue(select_elm, value, first_index) {
-			first_index = typeof(first_index) == "undefined" ? false : true;
+					lastExtID = ed.id + '_external';
 
-			if (select_elm) {
-				for (var i=0; i<select_elm.options.length; i++) {
-					var ov = "" + select_elm.options[i].value;
+					e = null;
+				});
+			}
 
-					if (first_index && ov.toLowerCase().indexOf(value.toLowerCase()) == 0) {
-						select_elm.selectedIndex = i;
-						return true;
-					}
+			if (sl == 'top')
+				t._addStatusBar(tb, o);
 
-					if (ov == value) {
-						select_elm.selectedIndex = i;
-						return true;
-					}
-				}
+			// Create iframe container
+			if (!s.theme_advanced_toolbar_container) {
+				n = DOM.add(tb, 'tr');
+				n = ic = DOM.add(n, 'td', {'class' : 'mceIframeContainer'});
 			}
 
-			return false;
-		};
+			// Create toolbar container at bottom
+			if (lo == 'bottom')
+				t._addToolbars(tb, o);
 
-		// No node provided
-		if (node == null)
-			return;
+			if (sl == 'bottom')
+				t._addStatusBar(tb, o);
 
-		// Update path
-		var pathElm = document.getElementById(editor_id + "_path");
-		var inst = tinyMCE.getInstanceById(editor_id);
-		var doc = inst.getDoc();
-		TinyMCE_AdvancedTheme._hideMenus(editor_id);
+			return ic;
+		},
 
-		if (pathElm) {
-			// Get node path
-			var parentNode = node;
-			var path = new Array();
-			
-			while (parentNode != null) {
-				if (parentNode.nodeName.toUpperCase() == "BODY") {
-					break;
-				}
+		_rowLayout : function(s, tb, o) {
+			var t = this, ed = t.editor, dc, da, cf = ed.controlManager, n, ic, to, a;
 
-				// Only append element nodes to path
-				if (parentNode.nodeType == 1 && tinyMCE.getAttrib(parentNode, "class").indexOf('mceItemHidden') == -1) {
-					path[path.length] = parentNode;
-				}
+			dc = s.theme_advanced_containers_default_class || '';
+			da = s.theme_advanced_containers_default_align || 'center';
 
-				parentNode = parentNode.parentNode;
-			}
+			each(explode(s.theme_advanced_containers || ''), function(c, i) {
+				var v = s['theme_advanced_container_' + c] || '';
 
-			// Setup HTML
-			var html = "";
-			for (var i=path.length-1; i>=0; i--) {
-				var nodeName = path[i].nodeName.toLowerCase();
-				var nodeData = "";
+				switch (v.toLowerCase()) {
+					case 'mceeditor':
+						n = DOM.add(tb, 'tr');
+						n = ic = DOM.add(n, 'td', {'class' : 'mceIframeContainer'});
+						break;
 
-				if (nodeName.indexOf("html:") == 0)
-					nodeName = nodeName.substring(5);
+					case 'mceelementpath':
+						t._addStatusBar(tb, o);
+						break;
 
-				if (nodeName == "b") {
-					nodeName = "strong";
-				}
+					default:
+						a = (s['theme_advanced_container_' + c + '_align'] || da).toLowerCase();
+						a = 'mce' + t._ufirst(a);
 
-				if (nodeName == "i") {
-					nodeName = "em";
-				}
+						n = DOM.add(DOM.add(tb, 'tr'), 'td', {
+							'class' : 'mceToolbar ' + (s['theme_advanced_container_' + c + '_class'] || dc) + ' ' + a || da
+						});
 
-				if (nodeName == "span") {
-					var cn = tinyMCE.getAttrib(path[i], "class");
-					if (cn != "" && cn.indexOf('mceItem') == -1)
-						nodeData += "class: " + cn + " ";
-
-					var st = tinyMCE.getAttrib(path[i], "style");
-					if (st != "") {
-						st = tinyMCE.serializeStyle(tinyMCE.parseStyle(st));
-						nodeData += "style: " + tinyMCE.xmlEncode(st) + " ";
-					}
+						to = cf.createToolbar("toolbar" + i);
+						t._addControls(v, to);
+						DOM.setHTML(n, to.renderHTML());
+						o.deltaHeight -= s.theme_advanced_row_height;
 				}
+			});
 
-				if (nodeName == "font") {
-					if (tinyMCE.getParam("convert_fonts_to_spans"))
-						nodeName = "span";
+			return ic;
+		},
 
-					var face = tinyMCE.getAttrib(path[i], "face");
-					if (face != "")
-						nodeData += "font: " + tinyMCE.xmlEncode(face) + " ";
+		_addControls : function(v, tb) {
+			var t = this, s = t.settings, di, cf = t.editor.controlManager;
 
-					var size = tinyMCE.getAttrib(path[i], "size");
-					if (size != "")
-						nodeData += "size: " + tinyMCE.xmlEncode(size) + " ";
+			if (s.theme_advanced_disable && !t._disabled) {
+				di = {};
 
-					var color = tinyMCE.getAttrib(path[i], "color");
-					if (color != "")
-						nodeData += "color: " + tinyMCE.xmlEncode(color) + " ";
-				}
+				each(explode(s.theme_advanced_disable), function(v) {
+					di[v] = 1;
+				});
 
-				if (tinyMCE.getAttrib(path[i], 'id') != "") {
-					nodeData += "id: " + path[i].getAttribute('id') + " ";
-				}
+				t._disabled = di;
+			} else
+				di = t._disabled;
 
-				var className = tinyMCE.getVisualAidClass(tinyMCE.getAttrib(path[i], "class"), false);
-				if (className != "" && className.indexOf('mceItem') == -1)
-					nodeData += "class: " + className + " ";
+			each(explode(v), function(n) {
+				var c;
 
-				if (tinyMCE.getAttrib(path[i], 'src') != "") {
-					var src = tinyMCE.getAttrib(path[i], "mce_src");
+				if (di && di[n])
+					return;
 
-					if (src == "")
-						 src = tinyMCE.getAttrib(path[i], "src");
+				// Compatiblity with 2.x
+				if (n == 'tablecontrols') {
+					each(["table","|","row_props","cell_props","|","row_before","row_after","delete_row","|","col_before","col_after","delete_col","|","split_cells","merge_cells"], function(n) {
+						n = t.createControl(n, cf);
 
-					nodeData += "src: " + tinyMCE.xmlEncode(src) + " ";
+						if (n)
+							tb.add(n);
+					});
+
+					return;
 				}
 
-				if (path[i].nodeName == 'A' && tinyMCE.getAttrib(path[i], 'href') != "") {
-					var href = tinyMCE.getAttrib(path[i], "mce_href");
+				c = t.createControl(n, cf);
 
-					if (href == "")
-						 href = tinyMCE.getAttrib(path[i], "href");
+				if (c)
+					tb.add(c);
+			});
+		},
 
-					nodeData += "href: " + tinyMCE.xmlEncode(href) + " ";
-				}
+		_addToolbars : function(c, o) {
+			var t = this, i, tb, ed = t.editor, s = t.settings, v, cf = ed.controlManager, di, n, h = [], a;
 
-				className = tinyMCE.getAttrib(path[i], "class");
-				if ((nodeName == "img" || nodeName == "span") && className.indexOf('mceItem') != -1) {
-					nodeName = className.replace(/mceItem([a-z]+)/gi, '$1').toLowerCase();
-					nodeData = path[i].getAttribute('title');
-				}
+			a = s.theme_advanced_toolbar_align.toLowerCase();
+			a = 'mce' + t._ufirst(a);
 
-				if (nodeName == "a" && (anchor = tinyMCE.getAttrib(path[i], "name")) != "") {
-					nodeName = "a";
-					nodeName += "#" + tinyMCE.xmlEncode(anchor);
-					nodeData = "";
-				}
+			n = DOM.add(DOM.add(c, 'tr'), 'td', {'class' : 'mceToolbar ' + a});
 
-				if (tinyMCE.getAttrib(path[i], 'name').indexOf("mce_") != 0) {
-					var className = tinyMCE.getVisualAidClass(tinyMCE.getAttrib(path[i], "class"), false);
-					if (className != "" && className.indexOf('mceItem') == -1) {
-						nodeName += "." + className;
-					}
-				}
+			if (!ed.getParam('accessibility_focus'))
+				h.push(DOM.createHTML('a', {href : '#', onfocus : 'tinyMCE.get(\'' + ed.id + '\').focus();'}, '<!-- IE -->'));
 
-				var cmd = 'tinyMCE.execInstanceCommand(\'' + editor_id + '\',\'mceSelectNodeDepth\',false,\'' + i + '\');';
-				html += '<a title="' + nodeData + '" href="javascript:' + cmd + '" onclick="' + cmd + 'return false;" onmousedown="return false;" target="_self" class="mcePathItem">' + nodeName + '</a>';
+			h.push(DOM.createHTML('a', {href : '#', accesskey : 'q', title : ed.getLang("advanced.toolbar_focus")}, '<!-- IE -->'));
 
-				if (i > 0) {
-					html += " &raquo; ";
-				}
-			}
+			// Create toolbar and add the controls
+			for (i=1; (v = s['theme_advanced_buttons' + i]); i++) {
+				tb = cf.createToolbar("toolbar" + i, {'class' : 'mceToolbarRow' + i});
 
-			pathElm.innerHTML = '<a href="#" accesskey="x"></a>' + tinyMCE.getLang('lang_theme_path') + ": " + html + '&#160;';
-		}
+				if (s['theme_advanced_buttons' + i + '_add'])
+					v += ',' + s['theme_advanced_buttons' + i + '_add'];
 
-		// Reset old states
-		tinyMCE.switchClass(editor_id + '_justifyleft', 'mceButtonNormal');
-		tinyMCE.switchClass(editor_id + '_justifyright', 'mceButtonNormal');
-		tinyMCE.switchClass(editor_id + '_justifycenter', 'mceButtonNormal');
-		tinyMCE.switchClass(editor_id + '_justifyfull', 'mceButtonNormal');
-		tinyMCE.switchClass(editor_id + '_bold', 'mceButtonNormal');
-		tinyMCE.switchClass(editor_id + '_italic', 'mceButtonNormal');
-		tinyMCE.switchClass(editor_id + '_underline', 'mceButtonNormal');
-		tinyMCE.switchClass(editor_id + '_strikethrough', 'mceButtonNormal');
-		tinyMCE.switchClass(editor_id + '_bullist', 'mceButtonNormal');
-		tinyMCE.switchClass(editor_id + '_numlist', 'mceButtonNormal');
-		tinyMCE.switchClass(editor_id + '_sub', 'mceButtonNormal');
-		tinyMCE.switchClass(editor_id + '_sup', 'mceButtonNormal');
-		tinyMCE.switchClass(editor_id + '_anchor', 'mceButtonNormal');
-		tinyMCE.switchClass(editor_id + '_link', 'mceButtonDisabled');
-		tinyMCE.switchClass(editor_id + '_unlink', 'mceButtonDisabled');
-		tinyMCE.switchClass(editor_id + '_outdent', 'mceButtonDisabled');
-		tinyMCE.switchClass(editor_id + '_image', 'mceButtonNormal');
-		tinyMCE.switchClass(editor_id + '_hr', 'mceButtonNormal');
+				if (s['theme_advanced_buttons' + i + '_add_before'])
+					v = s['theme_advanced_buttons' + i + '_add_before'] + ',' + v;
 
-		if (node.nodeName == "A" && tinyMCE.getAttrib(node, "class").indexOf('mceItemAnchor') != -1)
-			tinyMCE.switchClass(editor_id + '_anchor', 'mceButtonSelected');
+				t._addControls(v, tb);
 
-		// Get link
-		var anchorLink = tinyMCE.getParentElement(node, "a", "href");
+				//n.appendChild(n = tb.render());
+				h.push(tb.renderHTML());
 
-		if (anchorLink || any_selection) {
-			tinyMCE.switchClass(editor_id + '_link', anchorLink ? 'mceButtonSelected' : 'mceButtonNormal');
-			tinyMCE.switchClass(editor_id + '_unlink', anchorLink ? 'mceButtonSelected' : 'mceButtonNormal');
-		}
+				o.deltaHeight -= s.theme_advanced_row_height;
+			}
 
-		// Handle visual aid
-		tinyMCE.switchClass(editor_id + '_visualaid', visual_aid ? 'mceButtonSelected' : 'mceButtonNormal');
+			h.push(DOM.createHTML('a', {href : '#', accesskey : 'z', title : ed.getLang("advanced.toolbar_focus"), onfocus : 'tinyMCE.getInstanceById(\'' + ed.id + '\').focus();'}, '<!-- IE -->'));
+			DOM.setHTML(n, h.join(''));
+		},
 
-		if (undo_levels != -1) {
-			tinyMCE.switchClass(editor_id + '_undo', 'mceButtonDisabled');
-			tinyMCE.switchClass(editor_id + '_redo', 'mceButtonDisabled');
-		}
+		_addStatusBar : function(tb, o) {
+			var n, t = this, ed = t.editor, s = t.settings, r, mf, me, td;
 
-		// Within li, blockquote
-		if (tinyMCE.getParentElement(node, "li,blockquote"))
-			tinyMCE.switchClass(editor_id + '_outdent', 'mceButtonNormal');
+			n = DOM.add(tb, 'tr');
+			n = td = DOM.add(n, 'td', {'class' : 'mceStatusbar'});
+			n = DOM.add(n, 'div', {id : ed.id + '_path_row'}, s.theme_advanced_path ? ed.translate('advanced.path') + ': ' : '&#160;');
+			DOM.add(n, 'a', {href : '#', accesskey : 'x'});
 
-		// Has redo levels
-		if (undo_index != -1 && (undo_index < undo_levels-1 && undo_levels > 0))
-			tinyMCE.switchClass(editor_id + '_redo', 'mceButtonNormal');
+			if (s.theme_advanced_resizing) {
+				DOM.add(td, 'a', {id : ed.id + '_resize', href : 'javascript:;', onclick : "return false;", 'class' : 'mceResize'});
 
-		// Has undo levels
-		if (undo_index != -1 && (undo_index > 0 && undo_levels > 0))
-			tinyMCE.switchClass(editor_id + '_undo', 'mceButtonNormal');
+				if (s.theme_advanced_resizing_use_cookie) {
+					ed.onPostRender.add(function() {
+						var o = Cookie.getHash("TinyMCE_" + ed.id + "_size"), c = DOM.get(ed.id + '_tbl');
 
-		// Select class in select box
-		var selectElm = document.getElementById(editor_id + "_styleSelect");
-		
-		if (selectElm) {
-			TinyMCE_AdvancedTheme._setupCSSClasses(editor_id);
+						if (!o)
+							return;
 
-			classNode = node;
-			breakOut = false;
-			var index = 0;
-
-			do {
-				if (classNode && classNode.className) {
-					for (var i=0; i<selectElm.options.length; i++) {
-						if (selectElm.options[i].value == classNode.className) {
-							index = i;
-							breakOut = true;
-							break;
-						}
-					}
+						t.resizeTo(o.cw, o.ch);
+					});
 				}
-			} while (!breakOut && classNode != null && (classNode = classNode.parentNode) != null);
 
-			selectElm.selectedIndex = index;
-		}
+				ed.onPostRender.add(function() {
+					Event.add(ed.id + '_resize', 'mousedown', function(e) {
+						var mouseMoveHandler1, mouseMoveHandler2,
+							mouseUpHandler1, mouseUpHandler2,
+							startX, startY, startWidth, startHeight, width, height, ifrElm;
 
-		// Select formatblock
-		var selectElm = document.getElementById(editor_id + "_formatSelect");
-		if (selectElm) {
-			var elm = tinyMCE.getParentElement(node, "p,div,h1,h2,h3,h4,h5,h6,pre,address");
+						function resizeOnMove(e) {
+							width = startWidth + (e.screenX - startX);
+							height = startHeight + (e.screenY - startY);
 
-			if (elm)
-				selectByValue(selectElm, "<" + elm.nodeName.toLowerCase() + ">");
-			else
-				selectByValue(selectElm, "");
-		}
+							t.resizeTo(width, height);
+						};
 
-		// Select fontselect
-		var selectElm = document.getElementById(editor_id + "_fontNameSelect");
-		if (selectElm) {
-			if (!tinyMCE.isSafari && !(tinyMCE.isMSIE && !tinyMCE.isOpera)) {
-				var face = inst.queryCommandValue('FontName');
+						function endResize(e) {
+							// Stop listening
+							Event.remove(DOM.doc, 'mousemove', mouseMoveHandler1);
+							Event.remove(ed.getDoc(), 'mousemove', mouseMoveHandler2);
+							Event.remove(DOM.doc, 'mouseup', mouseUpHandler1);
+							Event.remove(ed.getDoc(), 'mouseup', mouseUpHandler2);
 
-				face = face == null || face == "" ? "" : face;
+							// Store away the size
+							if (s.theme_advanced_resizing_use_cookie) {
+								Cookie.setHash("TinyMCE_" + ed.id + "_size", {
+									cw : width,
+									ch : height
+								});
+							}
+						};
 
-				selectByValue(selectElm, face, face != "");
-			} else {
-				var elm = tinyMCE.getParentElement(node, "font", "face");
+						e.preventDefault();
 
-				if (elm) {
-					var family = tinyMCE.getAttrib(elm, "face");
+						// Get the current rect size
+						startX = e.screenX;
+						startY = e.screenY;
+						ifrElm = DOM.get(t.editor.id + '_ifr');
+						startWidth = width = ifrElm.clientWidth;
+						startHeight = height = ifrElm.clientHeight;
 
-					if (family == '')
-						family = '' + elm.style.fontFamily;
-
-					if (!selectByValue(selectElm, family, family != ""))
-						selectByValue(selectElm, "");
-				} else
-					selectByValue(selectElm, "");
+						// Register envent handlers
+						mouseMoveHandler1 = Event.add(DOM.doc, 'mousemove', resizeOnMove);
+						mouseMoveHandler2 = Event.add(ed.getDoc(), 'mousemove', resizeOnMove);
+						mouseUpHandler1 = Event.add(DOM.doc, 'mouseup', endResize);
+						mouseUpHandler2 = Event.add(ed.getDoc(), 'mouseup', endResize);
+					});
+				});
 			}
-		}
 
-		// Select fontsize
-		var selectElm = document.getElementById(editor_id + "_fontSizeSelect");
-		if (selectElm) {
-			if (!tinyMCE.isSafari && !tinyMCE.isOpera) {
-				var size = inst.queryCommandValue('FontSize');
-				selectByValue(selectElm, size == null || size == "" ? "0" : size);
-			} else {
-				var elm = tinyMCE.getParentElement(node, "font", "size");
-				if (elm) {
-					var size = tinyMCE.getAttrib(elm, "size");
+			o.deltaHeight -= 21;
+			n = tb = null;
+		},
 
-					if (size == '') {
-						var sizes = new Array('', '8px', '10px', '12px', '14px', '18px', '24px', '36px');
+		_nodeChanged : function(ed, cm, n, co, ob) {
+			var t = this, p, de = 0, v, c, s = t.settings, cl, fz, fn, formatNames, matches;
 
-						size = '' + elm.style.fontSize;
+			tinymce.each(t.stateControls, function(c) {
+				cm.setActive(c, ed.queryCommandState(t.controls[c][1]));
+			});
 
-						for (var i=0; i<sizes.length; i++) {
-							if (('' + sizes[i]) == size) {
-								size = i;
-								break;
-							}
-						}
-					}
+			function getParent(name) {
+				var i, parents = ob.parents, func = name;
 
-					if (!selectByValue(selectElm, size))
-						selectByValue(selectElm, "");
-				} else
-					selectByValue(selectElm, "0");
-			}
-		}
+				if (typeof(name) == 'string') {
+					func = function(node) {
+						return node.nodeName == name;
+					};
+				}
 
-		// Handle align attributes
-		alignNode = node;
-		breakOut = false;
-		do {
-			if (!alignNode.getAttribute || !alignNode.getAttribute('align'))
-				continue;
+				for (i = 0; i < parents.length; i++) {
+					if (func(parents[i]))
+						return parents[i];
+				}
+			};
 
-			switch (alignNode.getAttribute('align').toLowerCase()) {
-				case "left":
-					tinyMCE.switchClass(editor_id + '_justifyleft', 'mceButtonSelected');
-					breakOut = true;
-				break;
+			cm.setActive('visualaid', ed.hasVisual);
+			cm.setDisabled('undo', !ed.undoManager.hasUndo() && !ed.typing);
+			cm.setDisabled('redo', !ed.undoManager.hasRedo());
+			cm.setDisabled('outdent', !ed.queryCommandState('Outdent'));
 
-				case "right":
-					tinyMCE.switchClass(editor_id + '_justifyright', 'mceButtonSelected');
-					breakOut = true;
-				break;
+			p = getParent('A');
+			if (c = cm.get('link')) {
+				if (!p || !p.name) {
+					c.setDisabled(!p && co);
+					c.setActive(!!p);
+				}
+			}
 
-				case "middle":
-				case "center":
-					tinyMCE.switchClass(editor_id + '_justifycenter', 'mceButtonSelected');
-					breakOut = true;
-				break;
-
-				case "justify":
-					tinyMCE.switchClass(editor_id + '_justifyfull', 'mceButtonSelected');
-					breakOut = true;
-				break;
+			if (c = cm.get('unlink')) {
+				c.setDisabled(!p && co);
+				c.setActive(!!p && !p.name);
 			}
-		} while (!breakOut && (alignNode = alignNode.parentNode) != null);
 
-		// Div justification
-		var div = tinyMCE.getParentElement(node, "div");
-		if (div && div.style.textAlign == "center")
-			tinyMCE.switchClass(editor_id + '_justifycenter', 'mceButtonSelected');
-
-		// Do special text
-		if (!setup_content) {
-			// , "JustifyLeft", "_justifyleft", "JustifyCenter", "justifycenter", "JustifyRight", "justifyright", "JustifyFull", "justifyfull", "InsertUnorderedList", "bullist", "InsertOrderedList", "numlist", "InsertUnorderedList", "bullist", "Outdent", "outdent", "Indent", "indent", "subscript", "sub"
-			var ar = new Array("Bold", "_bold", "Italic", "_italic", "Strikethrough", "_strikethrough", "superscript", "_sup", "subscript", "_sub");
-			for (var i=0; i<ar.length; i+=2) {
-				if (inst.queryCommandState(ar[i]))
-					tinyMCE.switchClass(editor_id + ar[i+1], 'mceButtonSelected');
+			if (c = cm.get('anchor')) {
+				c.setActive(!!p && p.name);
 			}
 
-			if (inst.queryCommandState("Underline") && (node.parentNode == null || node.parentNode.nodeName != "A"))
-				tinyMCE.switchClass(editor_id + '_underline', 'mceButtonSelected');
-		}
+			p = getParent('IMG');
+			if (c = cm.get('image'))
+				c.setActive(!!p && n.className.indexOf('mceItem') == -1);
 
-		// Handle elements
-		do {
-			switch (node.nodeName) {
-				case "UL":
-					tinyMCE.switchClass(editor_id + '_bullist', 'mceButtonSelected');
-				break;
+			if (c = cm.get('styleselect')) {
+				t._importClasses();
 
-				case "OL":
-					tinyMCE.switchClass(editor_id + '_numlist', 'mceButtonSelected');
-				break;
+				formatNames = [];
+				each(c.items, function(item) {
+					formatNames.push(item.value);
+				});
 
-				case "HR":
-					 tinyMCE.switchClass(editor_id + '_hr', 'mceButtonSelected');
-				break;
-
-				case "IMG":
-				if (tinyMCE.getAttrib(node, 'name').indexOf('mce_') != 0 && tinyMCE.getAttrib(node, 'class').indexOf('mceItem') == -1) {
-					tinyMCE.switchClass(editor_id + '_image', 'mceButtonSelected');
-				}
-				break;
+				matches = ed.formatter.matchAll(formatNames);
+				c.select(matches[0]);
 			}
-		} while ((node = node.parentNode) != null);
-	},
 
-	// Private theme internal functions
+			if (c = cm.get('formatselect')) {
+				p = getParent(DOM.isBlock);
 
-	// This function auto imports CSS classes into the class selection droplist
-	_setupCSSClasses : function(editor_id) {
-		var i, selectElm;
-
-		if (!TinyMCE_AdvancedTheme._autoImportCSSClasses)
-			return;
-
-		selectElm = document.getElementById(editor_id + '_styleSelect');
-
-		if (selectElm && selectElm.getAttribute('cssImported') != 'true') {
-			var csses = tinyMCE.getCSSClasses(editor_id);
-			if (csses && selectElm)	{
-				for (i=0; i<csses.length; i++)
-					selectElm.options[selectElm.options.length] = new Option(csses[i], csses[i]);
+				if (p)
+					c.select(p.nodeName.toLowerCase());
 			}
 
-			// Only do this once
-			if (csses != null && csses.length > 0)
-				selectElm.setAttribute('cssImported', 'true');
-		}
-	},
+			// Find out current fontSize, fontFamily and fontClass
+			getParent(function(n) {
+				if (n.nodeName === 'SPAN') {
+					if (!cl && n.className)
+						cl = n.className;
 
-	_setCookie : function(name, value, expires, path, domain, secure) {
-		var curCookie = name + "=" + escape(value) +
-			((expires) ? "; expires=" + expires.toGMTString() : "") +
-			((path) ? "; path=" + escape(path) : "") +
-			((domain) ? "; domain=" + domain : "") +
-			((secure) ? "; secure" : "");
+					if (!fz && n.style.fontSize)
+						fz = n.style.fontSize;
 
-		document.cookie = curCookie;
-	},
+					if (!fn && n.style.fontFamily)
+						fn = n.style.fontFamily.replace(/[\"\']+/g, '').replace(/^([^,]+).*/, '$1').toLowerCase();
+				}
 
-	_getCookie : function(name) {
-		var dc = document.cookie;
-		var prefix = name + "=";
-		var begin = dc.indexOf("; " + prefix);
+				return false;
+			});
 
-		if (begin == -1) {
-			begin = dc.indexOf(prefix);
+			if (c = cm.get('fontselect')) {
+				c.select(function(v) {
+					return v.replace(/^([^,]+).*/, '$1').toLowerCase() == fn;
+				});
+			}
 
-			if (begin != 0)
-				return null;
-		} else
-			begin += 2;
+			// Select font size
+			if (c = cm.get('fontsizeselect')) {
+				// Use computed style
+				if (s.theme_advanced_runtime_fontsize && !fz && !cl)
+					fz = ed.dom.getStyle(n, 'fontSize', true);
 
-		var end = document.cookie.indexOf(";", begin);
+				c.select(function(v) {
+					if (v.fontSize && v.fontSize === fz)
+						return true;
 
-		if (end == -1)
-			end = dc.length;
+					if (v['class'] && v['class'] === cl)
+						return true;
+				});
+			}
 
-		return unescape(dc.substring(begin + prefix.length, end));
-	},
+			if (s.theme_advanced_path && s.theme_advanced_statusbar_location) {
+				p = DOM.get(ed.id + '_path') || DOM.add(ed.id + '_path_row', 'span', {id : ed.id + '_path'});
+				DOM.setHTML(p, '');
 
-	_resizeTo : function(inst, w, h, set_w) {
-		var editorContainer = document.getElementById(inst.editorId + '_parent');
-		var tableElm = editorContainer.firstChild;
-		var iframe = inst.iframeElement;
+				getParent(function(n) {
+					var na = n.nodeName.toLowerCase(), u, pi, ti = '';
 
-		if (w == null || w == "null") {
-			set_w = false;
-			w = 0;
-		}
+					/*if (n.getAttribute('_mce_bogus'))
+						return;
+*/
+					// Ignore non element and hidden elements
+					if (n.nodeType != 1 || n.nodeName === 'BR' || (DOM.hasClass(n, 'mceItemHidden') || DOM.hasClass(n, 'mceItemRemoved')))
+						return;
 
-		if (h == null || h == "null")
-			return;
+					// Fake name
+					if (v = DOM.getAttrib(n, 'mce_name'))
+						na = v;
 
-		w = parseInt(w);
-		h = parseInt(h);
+					// Handle prefix
+					if (tinymce.isIE && n.scopeName !== 'HTML')
+						na = n.scopeName + ':' + na;
 
-		if (tinyMCE.isGecko) {
-			w += 2;
-			h += 2;
-		}
+					// Remove internal prefix
+					na = na.replace(/mce\:/g, '');
 
-		var dx = w - tableElm.clientWidth;
-		var dy = h - tableElm.clientHeight;
+					// Handle node name
+					switch (na) {
+						case 'b':
+							na = 'strong';
+							break;
 
-		w = w < 1 ? 30 : w;
-		h = h < 1 ? 30 : h;
+						case 'i':
+							na = 'em';
+							break;
 
-		if (set_w)
-			tableElm.style.width = w + "px";
+						case 'img':
+							if (v = DOM.getAttrib(n, 'src'))
+								ti += 'src: ' + v + ' ';
 
-		tableElm.style.height = h + "px";
+							break;
 
-		iw = iframe.clientWidth + dx;
-		ih = iframe.clientHeight + dy;
+						case 'a':
+							if (v = DOM.getAttrib(n, 'name')) {
+								ti += 'name: ' + v + ' ';
+								na += '#' + v;
+							}
 
-		iw = iw < 1 ? 30 : iw;
-		ih = ih < 1 ? 30 : ih;
+							if (v = DOM.getAttrib(n, 'href'))
+								ti += 'href: ' + v + ' ';
 
-		if (tinyMCE.isGecko) {
-			iw -= 2;
-			ih -= 2;
-		}
+							break;
 
-		if (set_w)
-			iframe.style.width = iw + "px";
+						case 'font':
+							if (v = DOM.getAttrib(n, 'face'))
+								ti += 'font: ' + v + ' ';
 
-		iframe.style.height = ih + "px";
+							if (v = DOM.getAttrib(n, 'size'))
+								ti += 'size: ' + v + ' ';
 
-		// Is it to small, make it bigger again
-		if (set_w) {
-			var tableBodyElm = tableElm.firstChild;
-			var minIframeWidth = tableBodyElm.scrollWidth;
-			if (inst.iframeElement.clientWidth < minIframeWidth) {
-				dx = minIframeWidth - inst.iframeElement.clientWidth;
+							if (v = DOM.getAttrib(n, 'color'))
+								ti += 'color: ' + v + ' ';
 
-				inst.iframeElement.style.width = (iw + dx) + "px";
-			}
-		}
+							break;
 
-		// Remove pesky table controls
-		inst.useCSS = false;
-	},
+						case 'span':
+							if (v = DOM.getAttrib(n, 'style'))
+								ti += 'style: ' + v + ' ';
 
-	/**
-	 * Handles resizing events.
-	 */
-	_resizeEventHandler : function(e) {
-		var resizer = TinyMCE_AdvancedTheme._resizer;
+							break;
+					}
 
-		// Do nothing
-		if (!resizer.resizing)
-			return;
+					if (v = DOM.getAttrib(n, 'id'))
+						ti += 'id: ' + v + ' ';
 
-		e = typeof(e) == "undefined" ? window.event : e;
+					if (v = n.className) {
+						v = v.replace(/\b\s*(webkit|mce|Apple-)\w+\s*\b/g, '')
 
-		var dx = e.screenX - resizer.downX;
-		var dy = e.screenY - resizer.downY;
-		var resizeBox = resizer.resizeBox;
-		var editorId = resizer.editorId;
+						if (v) {
+							ti += 'class: ' + v + ' ';
 
-		switch (e.type) {
-			case "mousemove":
-				var w, h;
+							if (DOM.isBlock(n) || na == 'img' || na == 'span')
+								na += '.' + v;
+						}
+					}
 
-				w = resizer.width + dx;
-				h = resizer.height + dy;
+					na = na.replace(/(html:)/g, '');
+					na = {name : na, node : n, title : ti};
+					t.onResolveName.dispatch(t, na);
+					ti = na.title;
+					na = na.name;
 
-				w = w < 1 ? 1 : w;
-				h = h < 1 ? 1 : h;
+					//u = "javascript:tinymce.EditorManager.get('" + ed.id + "').theme._sel('" + (de++) + "');";
+					pi = DOM.create('a', {'href' : "javascript:;", onmousedown : "return false;", title : ti, 'class' : 'mcePath_' + (de++)}, na);
 
-				if (resizer.horizontal)
-					resizeBox.style.width = w + "px";
-
-				resizeBox.style.height = h + "px";
-				break;
-
-			case "mouseup":
-				TinyMCE_AdvancedTheme._setResizing(e, editorId, false);
-				TinyMCE_AdvancedTheme._resizeTo(tinyMCE.getInstanceById(editorId), resizer.width + dx, resizer.height + dy, resizer.horizontal);
-
-				// Expire in a month
-				if (tinyMCE.getParam("theme_advanced_resizing_use_cookie", true)) {
-					var expires = new Date();
-					expires.setTime(expires.getTime() + 3600000 * 24 * 30);
-
-					// Set the cookies
-					TinyMCE_AdvancedTheme._setCookie("TinyMCE_" + editorId + "_width", "" + (resizer.horizontal ? resizer.width + dx : ""), expires);
-					TinyMCE_AdvancedTheme._setCookie("TinyMCE_" + editorId + "_height", "" + (resizer.height + dy), expires);
-				}
-				break;
-		}
-	},
-
-	/**
-	 * Starts/stops the editor resizing.
-	 */
-	_setResizing : function(e, editor_id, state) {
-		e = typeof(e) == "undefined" ? window.event : e;
-
-		var resizer = TinyMCE_AdvancedTheme._resizer;
-		var editorContainer = document.getElementById(editor_id + '_parent');
-		var editorArea = document.getElementById(editor_id + '_parent').firstChild;
-		var resizeBox = document.getElementById(editor_id + '_resize_box');
-		var inst = tinyMCE.getInstanceById(editor_id);
-
-		if (state) {
-			// Place box over editor area
-			var width = editorArea.clientWidth;
-			var height = editorArea.clientHeight;
-
-			resizeBox.style.width = width + "px";
-			resizeBox.style.height = height + "px";
-
-			resizer.iframeWidth = inst.iframeElement.clientWidth;
-			resizer.iframeHeight = inst.iframeElement.clientHeight;
-
-			// Hide editor and show resize box
-			editorArea.style.display = "none";
-			resizeBox.style.display = "block";
-
-			// Add event handlers, only once
-			if (!resizer.eventHandlers) {
-				if (tinyMCE.isMSIE)
-					tinyMCE.addEvent(document, "mousemove", TinyMCE_AdvancedTheme._resizeEventHandler);
-				else
-					tinyMCE.addEvent(window, "mousemove", TinyMCE_AdvancedTheme._resizeEventHandler);
-
-				tinyMCE.addEvent(document, "mouseup", TinyMCE_AdvancedTheme._resizeEventHandler);
-
-				resizer.eventHandlers = true;
+					if (p.hasChildNodes()) {
+						p.insertBefore(DOM.doc.createTextNode(' \u00bb '), p.firstChild);
+						p.insertBefore(pi, p.firstChild);
+					} else
+						p.appendChild(pi);
+				}, ed.getBody());
 			}
+		},
 
-			resizer.resizing = true;
-			resizer.downX = e.screenX;
-			resizer.downY = e.screenY;
-			resizer.width = parseInt(resizeBox.style.width);
-			resizer.height = parseInt(resizeBox.style.height);
-			resizer.editorId = editor_id;
-			resizer.resizeBox = resizeBox;
-			resizer.horizontal = tinyMCE.getParam("theme_advanced_resize_horizontal", true);
-		} else {
-			resizer.resizing = false;
-			resizeBox.style.display = "none";
-			editorArea.style.display = tinyMCE.isMSIE && !tinyMCE.isOpera ? "block" : "table";
-			tinyMCE.execCommand('mceResetDesignMode');
-		}
-	},
+		// Commands gets called by execCommand
 
-	_getColorHTML : function(id, n, cm) {
-		var i, h, cl;
+		_sel : function(v) {
+			this.editor.execCommand('mceSelectNodeDepth', false, v);
+		},
 
-		h = '<span class="mceMenuLine"></span>';
-		cl = tinyMCE.getParam(n, TinyMCE_AdvancedTheme._defColors).split(',');
+		_mceInsertAnchor : function(ui, v) {
+			var ed = this.editor;
 
-		h += '<table class="mceColors"><tr>';
-		for (i=0; i<cl.length; i++) {
-			c = 'tinyMCE.execInstanceCommand(\'' + id + '\', \'' + cm + '\', false, \'#' + cl[i] + '\');';
-			h += '<td><a href="javascript:' + c + '" style="background-color: #' + cl[i] + '" onclick="' + c + ';return false;"></a></td>';
+			ed.windowManager.open({
+				url : this.url + '/anchor.htm',
+				width : 320 + parseInt(ed.getLang('advanced.anchor_delta_width', 0)),
+				height : 90 + parseInt(ed.getLang('advanced.anchor_delta_height', 0)),
+				inline : true
+			}, {
+				theme_url : this.url
+			});
+		},
 
-			if ((i+1) % 8 == 0)
-				h += '</tr><tr>';
-		}
+		_mceCharMap : function() {
+			var ed = this.editor;
 
-		h += '</tr></table>';
+			ed.windowManager.open({
+				url : this.url + '/charmap.htm',
+				width : 550 + parseInt(ed.getLang('advanced.charmap_delta_width', 0)),
+				height : 250 + parseInt(ed.getLang('advanced.charmap_delta_height', 0)),
+				inline : true
+			}, {
+				theme_url : this.url
+			});
+		},
 
-		if (tinyMCE.getParam("theme_advanced_more_colors", true))
-			h += '<a href="javascript:void(0);" onclick="TinyMCE_AdvancedTheme._pickColor(\'' + id + '\',\'' + cm + '\');" class="mceMoreColors">' + tinyMCE.getLang('lang_more_colors') + '</a>';
+		_mceHelp : function() {
+			var ed = this.editor;
 
-		return h;
-	},
+			ed.windowManager.open({
+				url : this.url + '/about.htm',
+				width : 480,
+				height : 380,
+				inline : true
+			}, {
+				theme_url : this.url
+			});
+		},
 
-	_pickColor : function(id, cm) {
-		var inputColor, inst = tinyMCE.selectedInstance;
+		_mceColorPicker : function(u, v) {
+			var ed = this.editor;
 
-		if (cm == 'forecolor' && inst)
-			inputColor = inst.foreColor;
+			v = v || {};
 
-		if ((cm == 'backcolor' || cm == 'HiliteColor') && inst)
-			inputColor = inst.backColor;
+			ed.windowManager.open({
+				url : this.url + '/color_picker.htm',
+				width : 375 + parseInt(ed.getLang('advanced.colorpicker_delta_width', 0)),
+				height : 250 + parseInt(ed.getLang('advanced.colorpicker_delta_height', 0)),
+				close_previous : false,
+				inline : true
+			}, {
+				input_color : v.color,
+				func : v.func,
+				theme_url : this.url
+			});
+		},
 
-		tinyMCE.execCommand('mceColorPicker', true, {color : inputColor, callback : function(c) {
-			tinyMCE.execInstanceCommand(id, cm, false, c);
-		}});
-	},
+		_mceCodeEditor : function(ui, val) {
+			var ed = this.editor;
 
-	_insertImage : function(src, alt, border, hspace, vspace, width, height, align, title, onmouseover, onmouseout) {
-		tinyMCE.execCommand("mceInsertContent", false, tinyMCE.createTagHTML('img', {
-			src : tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings['base_href'], src), // Force absolute
-			mce_src : src,
-			alt : alt,
-			border : border,
-			hspace : hspace,
-			vspace : vspace,
-			width : width,
-			height : height,
-			align : align,
-			title : title,
-			onmouseover : onmouseover,
-			onmouseout : onmouseout
-		}));
-	},
+			ed.windowManager.open({
+				url : this.url + '/source_editor.htm',
+				width : parseInt(ed.getParam("theme_advanced_source_editor_width", 720)),
+				height : parseInt(ed.getParam("theme_advanced_source_editor_height", 580)),
+				inline : true,
+				resizable : true,
+				maximizable : true
+			}, {
+				theme_url : this.url
+			});
+		},
 
-	_insertLink : function(href, target, title, onclick, style_class) {
-		tinyMCE.execCommand('mceBeginUndoLevel');
+		_mceImage : function(ui, val) {
+			var ed = this.editor;
 
-		if (tinyMCE.selectedInstance && tinyMCE.selectedElement && tinyMCE.selectedElement.nodeName.toLowerCase() == "img") {
-			var doc = tinyMCE.selectedInstance.getDoc();
-			var linkElement = tinyMCE.getParentElement(tinyMCE.selectedElement, "a");
-			var newLink = false;
+			// Internal image object like a flash placeholder
+			if (ed.dom.getAttrib(ed.selection.getNode(), 'class').indexOf('mceItem') != -1)
+				return;
 
-			if (!linkElement) {
-				linkElement = doc.createElement("a");
-				newLink = true;
-			}
+			ed.windowManager.open({
+				url : this.url + '/image.htm',
+				width : 355 + parseInt(ed.getLang('advanced.image_delta_width', 0)),
+				height : 275 + parseInt(ed.getLang('advanced.image_delta_height', 0)),
+				inline : true
+			}, {
+				theme_url : this.url
+			});
+		},
 
-			var mhref = href;
-			var thref = eval(tinyMCE.settings['urlconverter_callback'] + "(href, linkElement);");
-			mhref = tinyMCE.getParam('convert_urls') ? href : mhref;
+		_mceLink : function(ui, val) {
+			var ed = this.editor;
 
-			tinyMCE.setAttrib(linkElement, 'href', thref);
-			tinyMCE.setAttrib(linkElement, 'mce_href', mhref);
-			tinyMCE.setAttrib(linkElement, 'target', target);
-			tinyMCE.setAttrib(linkElement, 'title', title);
-			tinyMCE.setAttrib(linkElement, 'onclick', onclick);
-			tinyMCE.setAttrib(linkElement, 'class', style_class);
+			ed.windowManager.open({
+				url : this.url + '/link.htm',
+				width : 310 + parseInt(ed.getLang('advanced.link_delta_width', 0)),
+				height : 200 + parseInt(ed.getLang('advanced.link_delta_height', 0)),
+				inline : true
+			}, {
+				theme_url : this.url
+			});
+		},
 
-			if (newLink) {
-				linkElement.appendChild(tinyMCE.selectedElement.cloneNode(true));
-				tinyMCE.selectedElement.parentNode.replaceChild(linkElement, tinyMCE.selectedElement);
-			}
+		_mceNewDocument : function() {
+			var ed = this.editor;
 
-			return;
-		}
+			ed.windowManager.confirm('advanced.newdocument', function(s) {
+				if (s)
+					ed.execCommand('mceSetContent', false, '');
+			});
+		},
 
-		if (!tinyMCE.linkElement && tinyMCE.selectedInstance) {
-			if (tinyMCE.isSafari) {
-				tinyMCE.execCommand("mceInsertContent", false, '<a href="' + tinyMCE.uniqueURL + '">' + tinyMCE.selectedInstance.selection.getSelectedHTML() + '</a>');
-			} else
-				tinyMCE.selectedInstance.contentDocument.execCommand("createlink", false, tinyMCE.uniqueURL);
+		_mceForeColor : function() {
+			var t = this;
 
-			tinyMCE.linkElement = tinyMCE.getElementByAttributeValue(tinyMCE.selectedInstance.contentDocument.body, "a", "href", tinyMCE.uniqueURL);
+			this._mceColorPicker(0, {
+				color: t.fgColor,
+				func : function(co) {
+					t.fgColor = co;
+					t.editor.execCommand('ForeColor', false, co);
+				}
+			});
+		},
 
-			var elementArray = tinyMCE.getElementsByAttributeValue(tinyMCE.selectedInstance.contentDocument.body, "a", "href", tinyMCE.uniqueURL);
+		_mceBackColor : function() {
+			var t = this;
 
-			for (var i=0; i<elementArray.length; i++) {
-				var mhref = href;
-				var thref = eval(tinyMCE.settings['urlconverter_callback'] + "(href, elementArray[i]);");
-				mhref = tinyMCE.getParam('convert_urls') ? href : mhref;
+			this._mceColorPicker(0, {
+				color: t.bgColor,
+				func : function(co) {
+					t.bgColor = co;
+					t.editor.execCommand('HiliteColor', false, co);
+				}
+			});
+		},
 
-				tinyMCE.setAttrib(elementArray[i], 'href', thref);
-				tinyMCE.setAttrib(elementArray[i], 'mce_href', mhref);
-				tinyMCE.setAttrib(elementArray[i], 'target', target);
-				tinyMCE.setAttrib(elementArray[i], 'title', title);
-				tinyMCE.setAttrib(elementArray[i], 'onclick', onclick);
-				tinyMCE.setAttrib(elementArray[i], 'class', style_class);
-			}
-
-			tinyMCE.linkElement = elementArray[0];
+		_ufirst : function(s) {
+			return s.substring(0, 1).toUpperCase() + s.substring(1);
 		}
+	});
 
-		if (tinyMCE.linkElement) {
-			var mhref = href;
-			href = eval(tinyMCE.settings['urlconverter_callback'] + "(href, tinyMCE.linkElement);");
-			mhref = tinyMCE.getParam('convert_urls') ? href : mhref;
-
-			tinyMCE.setAttrib(tinyMCE.linkElement, 'href', href);
-			tinyMCE.setAttrib(tinyMCE.linkElement, 'mce_href', mhref);
-			tinyMCE.setAttrib(tinyMCE.linkElement, 'target', target);
-			tinyMCE.setAttrib(tinyMCE.linkElement, 'title', title);
-			tinyMCE.setAttrib(tinyMCE.linkElement, 'onclick', onclick);
-			tinyMCE.setAttrib(tinyMCE.linkElement, 'class', style_class);
-		}
-
-		tinyMCE.execCommand('mceEndUndoLevel');
-	}
-};
-
-tinyMCE.addTheme("advanced", TinyMCE_AdvancedTheme);
-
-// Add default buttons maps for advanced theme and all internal plugins
-tinyMCE.addButtonMap(TinyMCE_AdvancedTheme._buttonMap);
+	tinymce.ThemeManager.add('advanced', tinymce.themes.AdvancedTheme);
+}(tinymce));
\ No newline at end of file

Modified: plog/branches/lifetype-1.2/js/tinymce/themes/advanced/image.htm
===================================================================
--- plog/branches/lifetype-1.2/js/tinymce/themes/advanced/image.htm	2010-09-21 21:29:55 UTC (rev 7026)
+++ plog/branches/lifetype-1.2/js/tinymce/themes/advanced/image.htm	2010-09-21 23:00:22 UTC (rev 7027)
@@ -1,17 +1,17 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml">
 <head>
-	<title>{$lang_insert_image_title}</title>
-	<script language="javascript" type="text/javascript" src="../../tiny_mce_popup.js"></script>
-	<script language="javascript" type="text/javascript" src="../../utils/mctabs.js"></script>
-	<script language="javascript" type="text/javascript" src="../../utils/form_utils.js"></script>
-	<script language="javascript" type="text/javascript" src="jscripts/image.js"></script>
-	<base target="_self" />
+	<title>{#advanced_dlg.image_title}</title>
+	<script type="text/javascript" src="../../tiny_mce_popup.js"></script>
+	<script type="text/javascript" src="../../utils/mctabs.js"></script>
+	<script type="text/javascript" src="../../utils/form_utils.js"></script>
+	<script type="text/javascript" src="js/image.js"></script>
 </head>
-<body id="image" onload="tinyMCEPopup.executeOnLoad('init();');" style="display: none">
-<form onsubmit="insertImage();return false;" action="#">
+<body id="image" style="display: none">
+<form onsubmit="ImageDialog.update();return false;" action="#">
 	<div class="tabs">
 		<ul>
-			<li id="general_tab" class="current"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{$lang_insert_image_title}</a></span></li>
+			<li id="general_tab" class="current"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{#advanced_dlg.image_title}</a></span></li>
 		</ul>
 	</div>
 
@@ -19,81 +19,61 @@
 		<div id="general_panel" class="panel current">
      <table border="0" cellpadding="4" cellspacing="0">
           <tr>
-            <td nowrap="nowrap"><label for="src">{$lang_insert_image_src}</label></td>
+            <td class="nowrap"><label for="src">{#advanced_dlg.image_src}</label></td>
             <td><table border="0" cellspacing="0" cellpadding="0">
                 <tr>
-                  <td><input id="src" name="src" type="text" value="" style="width: 200px" onchange="getImageData();" /></td>
+                  <td><input id="src" name="src" type="text" class="mceFocus" value="" style="width: 200px" onchange="ImageDialog.getImageData();" /></td>
                   <td id="srcbrowsercontainer">&nbsp;</td>
                 </tr>
               </table></td>
           </tr>
-		  <!-- Image list -->
-		  <script language="javascript">
-			if (typeof(tinyMCEImageList) != "undefined" && tinyMCEImageList.length > 0) {
-				var html = "";
-
-				html += '<tr><td><label for="image_list">{$lang_image_list}</label></td>';
-				html += '<td><select id="image_list" name="image_list" style="width: 200px" onchange="this.form.src.value=this.options[this.selectedIndex].value;resetImageData();getImageData();">';
-				html += '<option value="">---</option>';
-
-				for (var i=0; i<tinyMCEImageList.length; i++)
-					html += '<option value="' + tinyMCEImageList[i][1] + '">' + tinyMCEImageList[i][0] + '</option>';
-
-				html += '</select></td></tr>';
-
-				document.write(html);
-			}
-		  </script>
-		  <!-- /Image list -->
+		  <tr>
+			<td><label for="image_list">{#advanced_dlg.image_list}</label></td>
+			<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>
+		  </tr>
           <tr>
-            <td nowrap="nowrap"><label for="alt">{$lang_insert_image_alt}</label></td>
+            <td class="nowrap"><label for="alt">{#advanced_dlg.image_alt}</label></td>
             <td><input id="alt" name="alt" type="text" value="" style="width: 200px" /></td>
           </tr>
           <tr>
-            <td nowrap="nowrap"><label for="align">{$lang_insert_image_align}</label></td>
-            <td><select id="align" name="align">
-                <option value="">{$lang_insert_image_align_default}</option>
-                <option value="baseline">{$lang_insert_image_align_baseline}</option>
-                <option value="top">{$lang_insert_image_align_top}</option>
-                <option value="middle">{$lang_insert_image_align_middle}</option>
-                <option value="bottom">{$lang_insert_image_align_bottom}</option>
-                <option value="texttop">{$lang_insert_image_align_texttop}</option>
-                <option value="absmiddle">{$lang_insert_image_align_absmiddle}</option>
-                <option value="absbottom">{$lang_insert_image_align_absbottom}</option>
-                <option value="left">{$lang_insert_image_align_left}</option>
-                <option value="right">{$lang_insert_image_align_right}</option>
+            <td class="nowrap"><label for="align">{#advanced_dlg.image_align}</label></td>
+            <td><select id="align" name="align" onchange="ImageDialog.updateStyle();">
+                <option value="">{#not_set}</option>
+                <option value="baseline">{#advanced_dlg.image_align_baseline}</option>
+                <option value="top">{#advanced_dlg.image_align_top}</option>
+                <option value="middle">{#advanced_dlg.image_align_middle}</option>
+                <option value="bottom">{#advanced_dlg.image_align_bottom}</option>
+                <option value="text-top">{#advanced_dlg.image_align_texttop}</option>
+                <option value="text-bottom">{#advanced_dlg.image_align_textbottom}</option>
+                <option value="left">{#advanced_dlg.image_align_left}</option>
+                <option value="right">{#advanced_dlg.image_align_right}</option>
               </select></td>
           </tr>
           <tr>
-            <td nowrap="nowrap"><label for="width">{$lang_insert_image_dimensions}</label></td>
+            <td class="nowrap"><label for="width">{#advanced_dlg.image_dimensions}</label></td>
             <td><input id="width" name="width" type="text" value="" size="3" maxlength="5" />
               x
               <input id="height" name="height" type="text" value="" size="3" maxlength="5" /></td>
           </tr>
           <tr>
-            <td nowrap="nowrap"><label for="border">{$lang_insert_image_border}</label></td>
-            <td><input id="border" name="border" type="text" value="" size="3" maxlength="3" /></td>
+            <td class="nowrap"><label for="border">{#advanced_dlg.image_border}</label></td>
+            <td><input id="border" name="border" type="text" value="" size="3" maxlength="3" onchange="ImageDialog.updateStyle();" /></td>
           </tr>
           <tr>
-            <td nowrap="nowrap"><label for="vspace">{$lang_insert_image_vspace}</label></td>
-            <td><input id="vspace" name="vspace" type="text" value="" size="3" maxlength="3" /></td>
+            <td class="nowrap"><label for="vspace">{#advanced_dlg.image_vspace}</label></td>
+            <td><input id="vspace" name="vspace" type="text" value="" size="3" maxlength="3" onchange="ImageDialog.updateStyle();" /></td>
           </tr>
           <tr>
-            <td nowrap="nowrap"><label for="hspace">{$lang_insert_image_hspace}</label></td>
-            <td><input id="hspace" name="hspace" type="text" value="" size="3" maxlength="3" /></td>
+            <td class="nowrap"><label for="hspace">{#advanced_dlg.image_hspace}</label></td>
+            <td><input id="hspace" name="hspace" type="text" value="" size="3" maxlength="3" onchange="ImageDialog.updateStyle();" /></td>
           </tr>
         </table>
 		</div>
 	</div>
 
 	<div class="mceActionPanel">
-		<div style="float: left">
-			<input type="button" id="insert" name="insert" value="{$lang_insert}" onclick="insertImage();" />
-		</div>
-
-		<div style="float: right">
-			<input type="button" id="cancel" name="cancel" value="{$lang_cancel}" onclick="tinyMCEPopup.close();" />
-		</div>
+		<input type="submit" id="insert" name="insert" value="{#insert}" />
+		<input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
 	</div>
 </form>
 </body>

Added: plog/branches/lifetype-1.2/js/tinymce/themes/advanced/img/colorpicker.jpg
===================================================================
(Binary files differ)


Property changes on: plog/branches/lifetype-1.2/js/tinymce/themes/advanced/img/colorpicker.jpg
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: plog/branches/lifetype-1.2/js/tinymce/themes/advanced/img/icons.gif
===================================================================
(Binary files differ)


Property changes on: plog/branches/lifetype-1.2/js/tinymce/themes/advanced/img/icons.gif
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Modified: plog/branches/lifetype-1.2/js/tinymce/themes/advanced/js/about.js
===================================================================
--- plog/branches/lifetype-1.2/js/tinymce/themes/advanced/jscripts/about.js	2010-09-21 21:29:55 UTC (rev 7026)
+++ plog/branches/lifetype-1.2/js/tinymce/themes/advanced/js/about.js	2010-09-21 23:00:22 UTC (rev 7027)
@@ -1,75 +1,72 @@
+tinyMCEPopup.requireLangPack();
+
 function init() {
-	var inst;
+	var ed, tcont;
 
 	tinyMCEPopup.resizeToInnerSize();
-	inst = tinyMCE.selectedInstance;
+	ed = tinyMCEPopup.editor;
 
 	// Give FF some time
-	window.setTimeout('insertHelpIFrame();', 10);
+	window.setTimeout(insertHelpIFrame, 10);
 
-	var tcont = document.getElementById('plugintablecontainer');
-	var plugins = tinyMCE.getParam('plugins', '', true, ',');
-	if (plugins.length == 0)
-		document.getElementById('plugins_tab').style.display = 'none';
+	tcont = document.getElementById('plugintablecontainer');
+	document.getElementById('plugins_tab').style.display = 'none';
 
 	var html = "";
 	html += '<table id="plugintable">';
 	html += '<thead>';
 	html += '<tr>';
-	html += '<td>' + tinyMCE.getLang('lang_plugin') + '</td>';
-	html += '<td>' + tinyMCE.getLang('lang_author') + '</td>';
-	html += '<td>' + tinyMCE.getLang('lang_version') + '</td>';
+	html += '<td>' + ed.getLang('advanced_dlg.about_plugin') + '</td>';
+	html += '<td>' + ed.getLang('advanced_dlg.about_author') + '</td>';
+	html += '<td>' + ed.getLang('advanced_dlg.about_version') + '</td>';
 	html += '</tr>';
 	html += '</thead>';
 	html += '<tbody>';
 
-	for (var i=0; i<inst.plugins.length; i++) {
-		var info = getPluginInfo(inst.plugins[i]);
+	tinymce.each(ed.plugins, function(p, n) {
+		var info;
 
+		if (!p.getInfo)
+			return;
+
 		html += '<tr>';
 
+		info = p.getInfo();
+
 		if (info.infourl != null && info.infourl != '')
-			html += '<td width="50%" title="' + plugins[i] + '"><a href="' + info.infourl + '" target="mceplugin">' + info.longname + '</a></td>';
+			html += '<td width="50%" title="' + n + '"><a href="' + info.infourl + '" target="_blank">' + info.longname + '</a></td>';
 		else
-			html += '<td width="50%" title="' + plugins[i] + '">' + info.longname + '</td>';
+			html += '<td width="50%" title="' + n + '">' + info.longname + '</td>';
 
 		if (info.authorurl != null && info.authorurl != '')
-			html += '<td width="35%"><a href="' + info.authorurl + '" target="mceplugin">' + info.author + '</a></td>';
+			html += '<td width="35%"><a href="' + info.authorurl + '" target="_blank">' + info.author + '</a></td>';
 		else
 			html += '<td width="35%">' + info.author + '</td>';
 
 		html += '<td width="15%">' + info.version + '</td>';
 		html += '</tr>';
-	}
 
+		document.getElementById('plugins_tab').style.display = '';
+
+	});
+
 	html += '</tbody>';
 	html += '</table>';
 
 	tcont.innerHTML = html;
-}
 
-function getPluginInfo(name) {
-	if (tinyMCE.plugins[name].getInfo)
-		return tinyMCE.plugins[name].getInfo();
-
-	return {
-		longname : name,
-		authorurl : '',
-		infourl : '',
-		author : '--',
-		version : '--'
-	};
+	tinyMCEPopup.dom.get('version').innerHTML = tinymce.majorVersion + "." + tinymce.minorVersion;
+	tinyMCEPopup.dom.get('date').innerHTML = tinymce.releaseDate;
 }
 
 function insertHelpIFrame() {
-	var html = '<iframe width="100%" height="300" src="' + tinyMCE.themeURL + "/docs/" + tinyMCE.settings['docs_language'] + "/index.htm" + '"></iframe>';
+	var html;
 
-	document.getElementById('iframecontainer').innerHTML = html;
-
-	html = '';
-	html += '<a href="http://www.moxiecode.com" target="_blank"><img src="http://tinymce.moxiecode.com/images/gotmoxie.png" alt="Got Moxie?" border="0" /></a> ';
-	html += '<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> ';
-	html += '<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> ';
-
-	document.getElementById('buttoncontainer').innerHTML = html;
+	if (tinyMCEPopup.getParam('docs_url')) {
+		html = '<iframe width="100%" height="300" src="' + tinyMCEPopup.editor.baseURI.toAbsolute(tinyMCEPopup.getParam('docs_url')) + '"></iframe>';
+		document.getElementById('iframecontainer').innerHTML = html;
+		document.getElementById('help_tab').style.display = 'block';
+	}
 }
+
+tinyMCEPopup.onInit.add(init);

Modified: plog/branches/lifetype-1.2/js/tinymce/themes/advanced/js/anchor.js
===================================================================
--- plog/branches/lifetype-1.2/js/tinymce/themes/advanced/jscripts/anchor.js	2010-09-21 21:29:55 UTC (rev 7026)
+++ plog/branches/lifetype-1.2/js/tinymce/themes/advanced/js/anchor.js	2010-09-21 23:00:22 UTC (rev 7027)
@@ -1,74 +1,37 @@
-var action, element;
+tinyMCEPopup.requireLangPack();
 
-function init() {
-	tinyMCEPopup.resizeToInnerSize();
+var AnchorDialog = {
+	init : function(ed) {
+		var action, elm, f = document.forms[0];
 
-	var inst = tinyMCE.getInstanceById(tinyMCE.getWindowArg('editor_id'));
-	var anchor = tinyMCE.getParentElement(inst.getFocusElement(), "a", "name");
-	var img = inst.getFocusElement();
-	action = 'insert';
+		this.editor = ed;
+		elm = ed.dom.getParent(ed.selection.getNode(), 'A');
+		v = ed.dom.getAttrib(elm, 'name');
 
-	if (anchor != null) {
-		element = anchor;
-		action = "update";
-	}
+		if (v) {
+			this.action = 'update';
+			f.anchorName.value = v;
+		}
 
-	if (tinyMCE.getAttrib(img, "class") == "mceItemAnchor") {
-		element = img;
-		action = "update";
-	}
+		f.insert.value = ed.getLang(elm ? 'update' : 'insert');
+	},
 
-	if (action == "update")
-		document.forms[0].anchorName.value = element.nodeName == "IMG" ? element.getAttribute("title") : element.getAttribute("name");
+	update : function() {
+		var ed = this.editor, elm, name = document.forms[0].anchorName.value;
 
-	document.forms[0].insert.value = tinyMCE.getLang('lang_' + action, 'Insert', true);
-}
+		tinyMCEPopup.restoreSelection();
 
-function insertAnchor() {
-	var inst = tinyMCE.getInstanceById(tinyMCE.getWindowArg('editor_id'));
-	var name = document.forms[0].anchorName.value, e;
+		if (this.action != 'update')
+			ed.selection.collapse(1);
 
-	tinyMCEPopup.execCommand("mceBeginUndoLevel");
-
-	if (action == "update") {
-		if (element.nodeName == "IMG")
-			element.setAttribute("title", name);
+		elm = ed.dom.getParent(ed.selection.getNode(), 'A');
+		if (elm)
+			elm.name = name;
 		else
-			element.setAttribute("name", name);
-	} else {
-		var rng = inst.getRng();
+			ed.execCommand('mceInsertContent', 0, ed.dom.createHTML('a', {name : name, 'class' : 'mceItemAnchor'}, ''));
 
-		if (rng.collapse)
-			rng.collapse(false);
-
-		name = name.replace(/&/g, '&amp;');
-		name = name.replace(/\"/g, '&quot;');
-		name = name.replace(/</g, '&lt;');
-		name = name.replace(/>/g, '&gt;');
-
-		// Fix for bug #1447335
-		if (tinyMCE.isGecko)
-			html = '<a id="mceNewAnchor" name="' + name + '"></a>';
-		else
-			html = '<a name="' + name + '"></a>';
-
-		tinyMCEPopup.execCommand("mceInsertContent", false, html);
-
-		// Fix for bug #1447335 force cursor after the anchor element
-		if (tinyMCE.isGecko) {
-			e = inst.getDoc().getElementById('mceNewAnchor');
-
-			if (e) {
-				inst.selection.selectNode(e, true, false, false);
-				e.removeAttribute('id');
-			}
-		}
-
-		tinyMCE.handleVisualAid(inst.getBody(), true, inst.visualAid, inst);
+		tinyMCEPopup.close();
 	}
+};
 
-	tinyMCEPopup.execCommand("mceEndUndoLevel");
-
-	tinyMCE.triggerNodeChange();
-	tinyMCEPopup.close();
-}
+tinyMCEPopup.onInit.add(AnchorDialog.init, AnchorDialog);

Modified: plog/branches/lifetype-1.2/js/tinymce/themes/advanced/js/charmap.js
===================================================================
--- plog/branches/lifetype-1.2/js/tinymce/themes/advanced/jscripts/charmap.js	2010-09-21 21:29:55 UTC (rev 7026)
+++ plog/branches/lifetype-1.2/js/tinymce/themes/advanced/js/charmap.js	2010-09-21 23:00:22 UTC (rev 7027)
@@ -1,13 +1,16 @@
-function init() {
-	tinyMCEPopup.resizeToInnerSize();
-}
+/**
+ * charmap.js
+ *
+ * Copyright 2009, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://tinymce.moxiecode.com/license
+ * Contributing: http://tinymce.moxiecode.com/contributing
+ */
 
-var charmap = new Array();
+tinyMCEPopup.requireLangPack();
 
-// for mor details please see w3c.org
-// now here is the complete list ;)
-
-charmap = [
+var charmap = [
 	['&nbsp;',    '&#160;',  true, 'no-break space'],
 	['&amp;',     '&#38;',   true, 'ampersand'],
 	['&quot;',    '&#34;',   true, 'quotation mark'],
@@ -270,32 +273,37 @@
 	['&shy;',     '&#173;',  false,'soft hyphen']
 ];
 
+tinyMCEPopup.onInit.add(function() {
+	tinyMCEPopup.dom.setHTML('charmapView', renderCharMapHTML());
+});
+
 function renderCharMapHTML() {
-	var charsPerRow = 20, tdWidth=20, tdHeight=20;
+	var charsPerRow = 20, tdWidth=20, tdHeight=20, i;
 	var html = '<table border="0" cellspacing="1" cellpadding="0" width="' + (tdWidth*charsPerRow) + '"><tr height="' + tdHeight + '">';
 	var cols=-1;
-	for (var i=0; i<charmap.length; i++) {
+
+	for (i=0; i<charmap.length; i++) {
 		if (charmap[i][2]==true) {
 			cols++;
 			html += ''
-				+ '<td width="' + tdWidth + '" height="' + tdHeight + '" class="charmap"'
-				+ ' onmouseover="this.className=\'charmapOver\';'
-				+ 'previewChar(\'' + charmap[i][1].substring(1,charmap[i][1].length) + '\',\'' + charmap[i][0].substring(1,charmap[i][0].length) + '\',\'' + charmap[i][3] + '\');"'
-				+ ' onmouseout="this.className=\'charmap\';"'
-				+ ' nowrap="nowrap" onclick="insertChar(\'' + charmap[i][1].substring(2,charmap[i][1].length-1) + '\');"><a style="text-decoration: none;" 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:insertChar(\'' + charmap[i][1].substring(2,charmap[i][1].length-1) + '\');" onclick="return false;" onmousedown="return false;" title="' + charmap[i][3] + '">'
+				+ '<td class="charmap">'
+				+ '<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] + '">'
 				+ charmap[i][1]
 				+ '</a></td>';
 			if ((cols+1) % charsPerRow == 0)
 				html += '</tr><tr height="' + tdHeight + '">';
 		}
 	 }
+
 	if (cols % charsPerRow > 0) {
 		var padd = charsPerRow - (cols % charsPerRow);
 		for (var i=0; i<padd-1; i++)
 			html += '<td width="' + tdWidth + '" height="' + tdHeight + '" class="charmap">&nbsp;</td>';
 	}
+
 	html += '</tr></table>';
-	document.write(html);
+
+	return html;
 }
 
 function insertChar(chr) {
@@ -305,6 +313,7 @@
 	if (tinyMCEPopup.isWindow)
 		window.focus();
 
+	tinyMCEPopup.editor.focus();
 	tinyMCEPopup.close();
 }
 

Modified: plog/branches/lifetype-1.2/js/tinymce/themes/advanced/js/color_picker.js
===================================================================
--- plog/branches/lifetype-1.2/js/tinymce/themes/advanced/jscripts/color_picker.js	2010-09-21 21:29:55 UTC (rev 7026)
+++ plog/branches/lifetype-1.2/js/tinymce/themes/advanced/js/color_picker.js	2010-09-21 23:00:22 UTC (rev 7027)
@@ -1,6 +1,8 @@
+tinyMCEPopup.requireLangPack();
+
 var detail = 50, strhex = "0123456789abcdef", i, isMouseDown = false, isMouseOver = false;
 
-var colors = new Array(
+var colors = [
 	"#000000","#000033","#000066","#000099","#0000cc","#0000ff","#330000","#330033",
 	"#330066","#330099","#3300cc","#3300ff","#660000","#660033","#660066","#660099",
 	"#6600cc","#6600ff","#990000","#990033","#990066","#990099","#9900cc","#9900ff",
@@ -28,7 +30,7 @@
 	"#66ff00","#66ff33","#66ff66","#66ff99","#66ffcc","#66ffff","#99ff00","#99ff33",
 	"#99ff66","#99ff99","#99ffcc","#99ffff","#ccff00","#ccff33","#ccff66","#ccff99",
 	"#ccffcc","#ccffff","#ffff00","#ffff33","#ffff66","#ffff99","#ffffcc","#ffffff"
-);
+];
 
 var named = {
 	'#F0F8FF':'AliceBlue','#FAEBD7':'AntiqueWhite','#00FFFF':'Aqua','#7FFFD4':'Aquamarine','#F0FFFF':'Azure','#F5F5DC':'Beige',
@@ -57,10 +59,9 @@
 };
 
 function init() {
-	var inputColor = convertRGBToHex(tinyMCE.getWindowArg('input_color'));
+	var inputColor = convertRGBToHex(tinyMCEPopup.getWindowArg('input_color'));
 
-	if (tinyMCE.isMSIE)
-		tinyMCEPopup.resizeToInnerSize();
+	tinyMCEPopup.resizeToInnerSize();
 
 	generatePicker();
 
@@ -75,9 +76,13 @@
 }
 
 function insertAction() {
-	var color = document.getElementById("color").value;
+	var color = document.getElementById("color").value, f = tinyMCEPopup.getWindowArg('func');
 
-	tinyMCEPopup.execCommand(tinyMCE.getWindowArg('command'), false, color);
+	tinyMCEPopup.restoreSelection();
+
+	if (f)
+		f(color);
+
 	tinyMCEPopup.close();
 }
 
@@ -86,7 +91,7 @@
 		document.getElementById("colorname").innerHTML = name;
 
 	document.getElementById("preview").style.backgroundColor = color;
-	document.getElementById("color").value = color;
+	document.getElementById("color").value = color.toLowerCase();
 }
 
 function convertRGBToHex(col) {
@@ -152,9 +157,9 @@
 		+ '<tr>';
 
 	for (i=0; i<colors.length; i++) {
-		h += '<td bgcolor="' + colors[i] + '">'
-			+ '<a href="javascript:insertAction();" onfocus="showColor(\'' + colors[i] +  '\');" onmouseover="showColor(\'' + colors[i] +  '\');">'
-			+ '<img border="0" src="images/spacer.gif" width="10" height="10" title="' + colors[i] +  '" alt="' + colors[i] +  '" /></a></td>';
+		h += '<td bgcolor="' + colors[i] + '" width="10" height="10">'
+			+ '<a href="javascript:insertAction();" onfocus="showColor(\'' + colors[i] +  '\');" onmouseover="showColor(\'' + colors[i] +  '\');" style="display:block;width:10px;height:10px;overflow:hidden;">'
+			+ '</a></td>';
 		if ((i+1) % 18 == 0)
 			h += '</tr><tr>';
 	}
@@ -190,9 +195,9 @@
 	x = e.offsetX ? e.offsetX : (e.target ? e.clientX - e.target.x : 0);
 	y = e.offsetY ? e.offsetY : (e.target ? e.clientY - e.target.y : 0);
 
-	partWidth = document.getElementById('colorpicker').width / 6;
+	partWidth = document.getElementById('colors').width / 6;
 	partDetail = detail / 2;
-	imHeight = document.getElementById('colorpicker').height;
+	imHeight = document.getElementById('colors').height;
 
 	r = (x >= 0)*(x < partWidth)*255 + (x >= partWidth)*(x < 2*partWidth)*(2*255 - x * 255 / partWidth) + (x >= 4*partWidth)*(x < 5*partWidth)*(-4*255 + x * 255 / partWidth) + (x >= 5*partWidth)*(x < 6*partWidth)*255;
 	g = (x >= 0)*(x < partWidth)*(x * 255 / partWidth) + (x >= partWidth)*(x < 3*partWidth)*255	+ (x >= 3*partWidth)*(x < 4*partWidth)*(4*255 - x * 255 / partWidth);
@@ -225,7 +230,7 @@
 
 		color = finalR + finalG + finalB;
 
-		document.getElementById('gs' + i).style.backgroundColor = '#'+color;
+		setCol('gs' + i, '#'+color);
 	}
 }
 
@@ -233,8 +238,16 @@
 	if (color.indexOf('#') == -1)
 		color = convertRGBToHex(color);
 
-	document.getElementById('preview').style.backgroundColor = color;
+	setCol('preview', color);
 	document.getElementById('color').value = color;
 }
 
-window.focus();
\ No newline at end of file
+function setCol(e, c) {
+	try {
+		document.getElementById(e).style.backgroundColor = c;
+	} catch (ex) {
+		// Ignore IE warning
+	}
+}
+
+tinyMCEPopup.onInit.add(init);

Modified: plog/branches/lifetype-1.2/js/tinymce/themes/advanced/js/image.js
===================================================================
--- plog/branches/lifetype-1.2/js/tinymce/themes/advanced/jscripts/image.js	2010-09-21 21:29:55 UTC (rev 7026)
+++ plog/branches/lifetype-1.2/js/tinymce/themes/advanced/js/image.js	2010-09-21 23:00:22 UTC (rev 7027)
@@ -1,81 +1,245 @@
-var url = tinyMCE.getParam("external_image_list_url");
-if (url != null) {
-	// Fix relative
-	if (url.charAt(0) != '/' && url.indexOf('://') == -1)
-		url = tinyMCE.documentBasePath + "/" + url;
+var ImageDialog = {
+	preInit : function() {
+		var url;
 
-	document.write('<sc'+'ript language="javascript" type="text/javascript" src="' + url + '"></sc'+'ript>');
-}
+		tinyMCEPopup.requireLangPack();
 
-function insertImage() {
-	var src = document.forms[0].src.value;
-	var alt = document.forms[0].alt.value;
-	var border = document.forms[0].border.value;
-	var vspace = document.forms[0].vspace.value;
-	var hspace = document.forms[0].hspace.value;
-	var width = document.forms[0].width.value;
-	var height = document.forms[0].height.value;
-	var align = document.forms[0].align.options[document.forms[0].align.selectedIndex].value;
+		if (url = tinyMCEPopup.getParam("external_image_list_url"))
+			document.write('<script language="javascript" type="text/javascript" src="' + tinyMCEPopup.editor.documentBaseURI.toAbsolute(url) + '"></script>');
+	},
 
-	tinyMCEPopup.restoreSelection();
-	tinyMCE.themes['advanced']._insertImage(src, alt, border, hspace, vspace, width, height, align);
-	tinyMCEPopup.close();
-}
+	init : function() {
+		var f = document.forms[0], ed = tinyMCEPopup.editor;
 
-function init() {
-	tinyMCEPopup.resizeToInnerSize();
+		// Setup browse button
+		document.getElementById('srcbrowsercontainer').innerHTML = getBrowserHTML('srcbrowser','src','image','theme_advanced_image');
+		if (isVisible('srcbrowser'))
+			document.getElementById('src').style.width = '180px';
 
-	document.getElementById('srcbrowsercontainer').innerHTML = getBrowserHTML('srcbrowser','src','image','theme_advanced_image');
+		e = ed.selection.getNode();
 
-	var formObj = document.forms[0];
+		this.fillFileList('image_list', 'tinyMCEImageList');
 
-	for (var i=0; i<document.forms[0].align.options.length; i++) {
-		if (document.forms[0].align.options[i].value == tinyMCE.getWindowArg('align'))
-			document.forms[0].align.options.selectedIndex = i;
-	}
+		if (e.nodeName == 'IMG') {
+			f.src.value = ed.dom.getAttrib(e, 'src');
+			f.alt.value = ed.dom.getAttrib(e, 'alt');
+			f.border.value = this.getAttrib(e, 'border');
+			f.vspace.value = this.getAttrib(e, 'vspace');
+			f.hspace.value = this.getAttrib(e, 'hspace');
+			f.width.value = ed.dom.getAttrib(e, 'width');
+			f.height.value = ed.dom.getAttrib(e, 'height');
+			f.insert.value = ed.getLang('update');
+			this.styleVal = ed.dom.getAttrib(e, 'style');
+			selectByValue(f, 'image_list', f.src.value);
+			selectByValue(f, 'align', this.getAttrib(e, 'align'));
+			this.updateStyle();
+		}
+	},
 
-	formObj.src.value = tinyMCE.getWindowArg('src');
-	formObj.alt.value = tinyMCE.getWindowArg('alt');
-	formObj.border.value = tinyMCE.getWindowArg('border');
-	formObj.vspace.value = tinyMCE.getWindowArg('vspace');
-	formObj.hspace.value = tinyMCE.getWindowArg('hspace');
-	formObj.width.value = tinyMCE.getWindowArg('width');
-	formObj.height.value = tinyMCE.getWindowArg('height');
-	formObj.insert.value = tinyMCE.getLang('lang_' + tinyMCE.getWindowArg('action'), 'Insert', true); 
+	fillFileList : function(id, l) {
+		var dom = tinyMCEPopup.dom, lst = dom.get(id), v, cl;
 
-	// Handle file browser
-	if (isVisible('srcbrowser'))
-		document.getElementById('src').style.width = '180px';
+		l = window[l];
 
-	// Auto select image in list
-	if (typeof(tinyMCEImageList) != "undefined" && tinyMCEImageList.length > 0) {
-		for (var i=0; i<formObj.image_list.length; i++) {
-			if (formObj.image_list.options[i].value == tinyMCE.getWindowArg('src'))
-				formObj.image_list.options[i].selected = true;
+		if (l && l.length > 0) {
+			lst.options[lst.options.length] = new Option('', '');
+
+			tinymce.each(l, function(o) {
+				lst.options[lst.options.length] = new Option(o[0], o[1]);
+			});
+		} else
+			dom.remove(dom.getParent(id, 'tr'));
+	},
+
+	update : function() {
+		var f = document.forms[0], nl = f.elements, ed = tinyMCEPopup.editor, args = {}, el;
+
+		tinyMCEPopup.restoreSelection();
+
+		if (f.src.value === '') {
+			if (ed.selection.getNode().nodeName == 'IMG') {
+				ed.dom.remove(ed.selection.getNode());
+				ed.execCommand('mceRepaint');
+			}
+
+			tinyMCEPopup.close();
+			return;
 		}
-	}
-}
 
-var preloadImg = new Image();
+		if (!ed.settings.inline_styles) {
+			args = tinymce.extend(args, {
+				vspace : nl.vspace.value,
+				hspace : nl.hspace.value,
+				border : nl.border.value,
+				align : getSelectValue(f, 'align')
+			});
+		} else
+			args.style = this.styleVal;
 
-function resetImageData() {
-	var formObj = document.forms[0];
-	formObj.width.value = formObj.height.value = "";	
-}
+		tinymce.extend(args, {
+			src : f.src.value,
+			alt : f.alt.value,
+			width : f.width.value,
+			height : f.height.value
+		});
 
-function updateImageData() {
-	var formObj = document.forms[0];
+		el = ed.selection.getNode();
 
-	if (formObj.width.value == "")
-		formObj.width.value = preloadImg.width;
+		if (el && el.nodeName == 'IMG') {
+			ed.dom.setAttribs(el, args);
+		} else {
+			ed.execCommand('mceInsertContent', false, '<img id="__mce_tmp" />', {skip_undo : 1});
+			ed.dom.setAttribs('__mce_tmp', args);
+			ed.dom.setAttrib('__mce_tmp', 'id', '');
+			ed.undoManager.add();
+		}
 
-	if (formObj.height.value == "")
-		formObj.height.value = preloadImg.height;
-}
+		tinyMCEPopup.close();
+	},
 
-function getImageData() {
-	preloadImg = new Image();
-	tinyMCE.addEvent(preloadImg, "load", updateImageData);
-	tinyMCE.addEvent(preloadImg, "error", function () {var formObj = document.forms[0];formObj.width.value = formObj.height.value = "";});
-	preloadImg.src = tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings['base_href'], document.forms[0].src.value);
-}
+	updateStyle : function() {
+		var dom = tinyMCEPopup.dom, st, v, f = document.forms[0];
+
+		if (tinyMCEPopup.editor.settings.inline_styles) {
+			st = tinyMCEPopup.dom.parseStyle(this.styleVal);
+
+			// Handle align
+			v = getSelectValue(f, 'align');
+			if (v) {
+				if (v == 'left' || v == 'right') {
+					st['float'] = v;
+					delete st['vertical-align'];
+				} else {
+					st['vertical-align'] = v;
+					delete st['float'];
+				}
+			} else {
+				delete st['float'];
+				delete st['vertical-align'];
+			}
+
+			// Handle border
+			v = f.border.value;
+			if (v || v == '0') {
+				if (v == '0')
+					st['border'] = '0';
+				else
+					st['border'] = v + 'px solid black';
+			} else
+				delete st['border'];
+
+			// Handle hspace
+			v = f.hspace.value;
+			if (v) {
+				delete st['margin'];
+				st['margin-left'] = v + 'px';
+				st['margin-right'] = v + 'px';
+			} else {
+				delete st['margin-left'];
+				delete st['margin-right'];
+			}
+
+			// Handle vspace
+			v = f.vspace.value;
+			if (v) {
+				delete st['margin'];
+				st['margin-top'] = v + 'px';
+				st['margin-bottom'] = v + 'px';
+			} else {
+				delete st['margin-top'];
+				delete st['margin-bottom'];
+			}
+
+			// Merge
+			st = tinyMCEPopup.dom.parseStyle(dom.serializeStyle(st), 'img');
+			this.styleVal = dom.serializeStyle(st, 'img');
+		}
+	},
+
+	getAttrib : function(e, at) {
+		var ed = tinyMCEPopup.editor, dom = ed.dom, v, v2;
+
+		if (ed.settings.inline_styles) {
+			switch (at) {
+				case 'align':
+					if (v = dom.getStyle(e, 'float'))
+						return v;
+
+					if (v = dom.getStyle(e, 'vertical-align'))
+						return v;
+
+					break;
+
+				case 'hspace':
+					v = dom.getStyle(e, 'margin-left')
+					v2 = dom.getStyle(e, 'margin-right');
+					if (v && v == v2)
+						return parseInt(v.replace(/[^0-9]/g, ''));
+
+					break;
+
+				case 'vspace':
+					v = dom.getStyle(e, 'margin-top')
+					v2 = dom.getStyle(e, 'margin-bottom');
+					if (v && v == v2)
+						return parseInt(v.replace(/[^0-9]/g, ''));
+
+					break;
+
+				case 'border':
+					v = 0;
+
+					tinymce.each(['top', 'right', 'bottom', 'left'], function(sv) {
+						sv = dom.getStyle(e, 'border-' + sv + '-width');
+
+						// False or not the same as prev
+						if (!sv || (sv != v && v !== 0)) {
+							v = 0;
+							return false;
+						}
+
+						if (sv)
+							v = sv;
+					});
+
+					if (v)
+						return parseInt(v.replace(/[^0-9]/g, ''));
+
+					break;
+			}
+		}
+
+		if (v = dom.getAttrib(e, at))
+			return v;
+
+		return '';
+	},
+
+	resetImageData : function() {
+		var f = document.forms[0];
+
+		f.width.value = f.height.value = "";	
+	},
+
+	updateImageData : function() {
+		var f = document.forms[0], t = ImageDialog;
+
+		if (f.width.value == "")
+			f.width.value = t.preloadImg.width;
+
+		if (f.height.value == "")
+			f.height.value = t.preloadImg.height;
+	},
+
+	getImageData : function() {
+		var f = document.forms[0];
+
+		this.preloadImg = new Image();
+		this.preloadImg.onload = this.updateImageData;
+		this.preloadImg.onerror = this.resetImageData;
+		this.preloadImg.src = tinyMCEPopup.editor.documentBaseURI.toAbsolute(f.src.value);
+	}
+};
+
+ImageDialog.preInit();
+tinyMCEPopup.onInit.add(ImageDialog.init, ImageDialog);

Modified: plog/branches/lifetype-1.2/js/tinymce/themes/advanced/js/link.js
===================================================================
--- plog/branches/lifetype-1.2/js/tinymce/themes/advanced/jscripts/link.js	2010-09-21 21:29:55 UTC (rev 7026)
+++ plog/branches/lifetype-1.2/js/tinymce/themes/advanced/js/link.js	2010-09-21 23:00:22 UTC (rev 7027)
@@ -1,74 +1,156 @@
-var url = tinyMCE.getParam("external_link_list_url");
-if (url != null) {
-	// Fix relative
-	if (url.charAt(0) != '/' && url.indexOf('://') == -1)
-		url = tinyMCE.documentBasePath + "/" + url;
+tinyMCEPopup.requireLangPack();
 
-	document.write('<sc'+'ript language="javascript" type="text/javascript" src="' + url + '"></sc'+'ript>');
-}
+var LinkDialog = {
+	preInit : function() {
+		var url;
 
-function init() {
-	tinyMCEPopup.resizeToInnerSize();
+		if (url = tinyMCEPopup.getParam("external_link_list_url"))
+			document.write('<script language="javascript" type="text/javascript" src="' + tinyMCEPopup.editor.documentBaseURI.toAbsolute(url) + '"></script>');
+	},
 
-	document.getElementById('hrefbrowsercontainer').innerHTML = getBrowserHTML('hrefbrowser','href','file','theme_advanced_link');
+	init : function() {
+		var f = document.forms[0], ed = tinyMCEPopup.editor;
 
-	// Handle file browser
-	if (isVisible('hrefbrowser'))
-		document.getElementById('href').style.width = '180px';
+		// Setup browse button
+		document.getElementById('hrefbrowsercontainer').innerHTML = getBrowserHTML('hrefbrowser', 'href', 'file', 'theme_advanced_link');
+		if (isVisible('hrefbrowser'))
+			document.getElementById('href').style.width = '180px';
 
-	var formObj = document.forms[0];
+		this.fillClassList('class_list');
+		this.fillFileList('link_list', 'tinyMCELinkList');
+		this.fillTargetList('target_list');
 
-	for (var i=0; i<document.forms[0].target.options.length; i++) {
-		var option = document.forms[0].target.options[i];
+		if (e = ed.dom.getParent(ed.selection.getNode(), 'A')) {
+			f.href.value = ed.dom.getAttrib(e, 'href');
+			f.linktitle.value = ed.dom.getAttrib(e, 'title');
+			f.insert.value = ed.getLang('update');
+			selectByValue(f, 'link_list', f.href.value);
+			selectByValue(f, 'target_list', ed.dom.getAttrib(e, 'target'));
+			selectByValue(f, 'class_list', ed.dom.getAttrib(e, 'class'));
+		}
+	},
 
-		if (option.value == tinyMCE.getWindowArg('target'))
-			option.selected = true;
-	}
+	update : function() {
+		var f = document.forms[0], ed = tinyMCEPopup.editor, e, b;
 
-	document.forms[0].href.value = tinyMCE.getWindowArg('href');
-	document.forms[0].linktitle.value = tinyMCE.getWindowArg('title');
-	document.forms[0].insert.value = tinyMCE.getLang('lang_' + tinyMCE.getWindowArg('action'), 'Insert', true); 
+		tinyMCEPopup.restoreSelection();
+		e = ed.dom.getParent(ed.selection.getNode(), 'A');
 
-	addClassesToList('styleSelect', 'theme_advanced_link_styles');
-	selectByValue(formObj, 'styleSelect', tinyMCE.getWindowArg('className'), true);
+		// Remove element if there is no href
+		if (!f.href.value) {
+			if (e) {
+				tinyMCEPopup.execCommand("mceBeginUndoLevel");
+				b = ed.selection.getBookmark();
+				ed.dom.remove(e, 1);
+				ed.selection.moveToBookmark(b);
+				tinyMCEPopup.execCommand("mceEndUndoLevel");
+				tinyMCEPopup.close();
+				return;
+			}
+		}
 
-	// Hide css select row if no CSS classes
-	if (formObj.styleSelect && formObj.styleSelect.options.length <= 1) {
-		var sr = document.getElementById('styleSelectRow');
-		sr.style.display = 'none';
-		sr.parentNode.removeChild(sr);
-	}
+		tinyMCEPopup.execCommand("mceBeginUndoLevel");
 
-	// Auto select link in list
-	if (typeof(tinyMCELinkList) != "undefined" && tinyMCELinkList.length > 0) {
-		var formObj = document.forms[0];
+		// Create new anchor elements
+		if (e == null) {
+			ed.getDoc().execCommand("unlink", false, null);
+			tinyMCEPopup.execCommand("CreateLink", false, "#mce_temp_url#", {skip_undo : 1});
 
-		for (var i=0; i<formObj.link_list.length; i++) {
-			if (formObj.link_list.options[i].value == tinyMCE.getWindowArg('href'))
-				formObj.link_list.options[i].selected = true;
+			tinymce.each(ed.dom.select("a"), function(n) {
+				if (ed.dom.getAttrib(n, 'href') == '#mce_temp_url#') {
+					e = n;
+
+					ed.dom.setAttribs(e, {
+						href : f.href.value,
+						title : f.linktitle.value,
+						target : f.target_list ? getSelectValue(f, "target_list") : null,
+						'class' : f.class_list ? getSelectValue(f, "class_list") : null
+					});
+				}
+			});
+		} else {
+			ed.dom.setAttribs(e, {
+				href : f.href.value,
+				title : f.linktitle.value,
+				target : f.target_list ? getSelectValue(f, "target_list") : null,
+				'class' : f.class_list ? getSelectValue(f, "class_list") : null
+			});
 		}
-	}
-}
 
-function checkPrefix(n) {
-	if (Validator.isEmail(n) && !/^\s*mailto:/i.test(n.value) && confirm(tinyMCE.getLang('lang_is_email')))
-		n.value = 'mailto:' + n.value;
+		// Don't move caret if selection was image
+		if (e.childNodes.length != 1 || e.firstChild.nodeName != 'IMG') {
+			ed.focus();
+			ed.selection.select(e);
+			ed.selection.collapse(0);
+			tinyMCEPopup.storeSelection();
+		}
 
-	if (/^\s*www./i.test(n.value) && confirm(tinyMCE.getLang('lang_is_external')))
-		n.value = 'http://' + n.value;
-}
+		tinyMCEPopup.execCommand("mceEndUndoLevel");
+		tinyMCEPopup.close();
+	},
 
-function insertLink() {
-	var href = document.forms[0].href.value;
-	var target = document.forms[0].target.options[document.forms[0].target.selectedIndex].value;
-	var title = document.forms[0].linktitle.value;
-	var style_class = document.forms[0].styleSelect ? document.forms[0].styleSelect.value : "";
-	var dummy;
+	checkPrefix : function(n) {
+		if (n.value && Validator.isEmail(n) && !/^\s*mailto:/i.test(n.value) && confirm(tinyMCEPopup.getLang('advanced_dlg.link_is_email')))
+			n.value = 'mailto:' + n.value;
 
-	if (target == '_self')
-		target = '';
+		if (/^\s*www\./i.test(n.value) && confirm(tinyMCEPopup.getLang('advanced_dlg.link_is_external')))
+			n.value = 'http://' + n.value;
+	},
 
-	tinyMCEPopup.restoreSelection();
-	tinyMCE.themes['advanced']._insertLink(href, target, title, dummy, style_class);
-	tinyMCEPopup.close();
-}
+	fillFileList : function(id, l) {
+		var dom = tinyMCEPopup.dom, lst = dom.get(id), v, cl;
+
+		l = window[l];
+
+		if (l && l.length > 0) {
+			lst.options[lst.options.length] = new Option('', '');
+
+			tinymce.each(l, function(o) {
+				lst.options[lst.options.length] = new Option(o[0], o[1]);
+			});
+		} else
+			dom.remove(dom.getParent(id, 'tr'));
+	},
+
+	fillClassList : function(id) {
+		var dom = tinyMCEPopup.dom, lst = dom.get(id), v, cl;
+
+		if (v = tinyMCEPopup.getParam('theme_advanced_styles')) {
+			cl = [];
+
+			tinymce.each(v.split(';'), function(v) {
+				var p = v.split('=');
+
+				cl.push({'title' : p[0], 'class' : p[1]});
+			});
+		} else
+			cl = tinyMCEPopup.editor.dom.getClasses();
+
+		if (cl.length > 0) {
+			lst.options[lst.options.length] = new Option(tinyMCEPopup.getLang('not_set'), '');
+
+			tinymce.each(cl, function(o) {
+				lst.options[lst.options.length] = new Option(o.title || o['class'], o['class']);
+			});
+		} else
+			dom.remove(dom.getParent(id, 'tr'));
+	},
+
+	fillTargetList : function(id) {
+		var dom = tinyMCEPopup.dom, lst = dom.get(id), v;
+
+		lst.options[lst.options.length] = new Option(tinyMCEPopup.getLang('not_set'), '');
+		lst.options[lst.options.length] = new Option(tinyMCEPopup.getLang('advanced_dlg.link_target_same'), '_self');
+		lst.options[lst.options.length] = new Option(tinyMCEPopup.getLang('advanced_dlg.link_target_blank'), '_blank');
+
+		if (v = tinyMCEPopup.getParam('theme_advanced_link_targets')) {
+			tinymce.each(v.split(','), function(v) {
+				v = v.split('=');
+				lst.options[lst.options.length] = new Option(v[0], v[1]);
+			});
+		}
+	}
+};
+
+LinkDialog.preInit();
+tinyMCEPopup.onInit.add(LinkDialog.init, LinkDialog);

Modified: plog/branches/lifetype-1.2/js/tinymce/themes/advanced/js/source_editor.js
===================================================================
--- plog/branches/lifetype-1.2/js/tinymce/themes/advanced/jscripts/source_editor.js	2010-09-21 21:29:55 UTC (rev 7026)
+++ plog/branches/lifetype-1.2/js/tinymce/themes/advanced/js/source_editor.js	2010-09-21 23:00:22 UTC (rev 7027)
@@ -1,33 +1,36 @@
+tinyMCEPopup.requireLangPack();
+tinyMCEPopup.onInit.add(onLoadInit);
+
 function saveContent() {
-	tinyMCE.setContent(document.getElementById('htmlSource').value);
-	tinyMCE.closeWindow(window);
+	tinyMCEPopup.editor.setContent(document.getElementById('htmlSource').value, {source_view : true});
+	tinyMCEPopup.close();
 }
 
 function onLoadInit() {
 	tinyMCEPopup.resizeToInnerSize();
 
 	// Remove Gecko spellchecking
-	if (tinyMCE.isGecko)
-		document.body.spellcheck = tinyMCE.getParam("gecko_spellcheck");
+	if (tinymce.isGecko)
+		document.body.spellcheck = tinyMCEPopup.editor.getParam("gecko_spellcheck");
 
-	document.getElementById('htmlSource').value = tinyMCE.getContent(tinyMCE.getWindowArg('editor_id'));
+	document.getElementById('htmlSource').value = tinyMCEPopup.editor.getContent({source_view : true});
 
-	resizeInputs();
-
-	if (tinyMCE.getParam("theme_advanced_source_editor_wrap", true)) {
+	if (tinyMCEPopup.editor.getParam("theme_advanced_source_editor_wrap", true)) {
 		setWrap('soft');
 		document.getElementById('wraped').checked = true;
 	}
+
+	resizeInputs();
 }
 
 function setWrap(val) {
-	var s = document.getElementById('htmlSource');
+	var v, n, s = document.getElementById('htmlSource');
 
 	s.wrap = val;
 
-	if (tinyMCE.isGecko || tinyMCE.isOpera) {
-		var v = s.value;
-		var n = s.cloneNode(false);
+	if (!tinymce.isIE) {
+		v = s.value;
+		n = s.cloneNode(false);
 		n.setAttribute("wrap", val);
 		s.parentNode.replaceChild(n, s);
 		n.value = v;
@@ -46,11 +49,11 @@
 function resizeInputs() {
 	var el = document.getElementById('htmlSource');
 
-	if (!tinyMCE.isMSIE) {
-		 wHeight = self.innerHeight - 60;
+	if (!tinymce.isIE) {
+		 wHeight = self.innerHeight - 65;
 		 wWidth = self.innerWidth - 16;
 	} else {
-		 wHeight = document.body.clientHeight - 60;
+		 wHeight = document.body.clientHeight - 70;
 		 wWidth = document.body.clientWidth - 16;
 	}
 

Modified: plog/branches/lifetype-1.2/js/tinymce/themes/advanced/langs/en.js
===================================================================
--- plog/branches/lifetype-1.2/js/tinymce/themes/advanced/langs/en.js	2010-09-21 21:29:55 UTC (rev 7026)
+++ plog/branches/lifetype-1.2/js/tinymce/themes/advanced/langs/en.js	2010-09-21 23:00:22 UTC (rev 7027)
@@ -1,93 +1,62 @@
-// UK lang variables
-
-tinyMCE.addToLang('',{
-theme_style_select : '-- Styles --',
-theme_code_desc : 'Edit HTML Source',
-theme_code_title : 'HTML Source Editor',
-theme_code_wordwrap : 'Word wrap',
-theme_sub_desc : 'Subscript',
-theme_sup_desc : 'Superscript',
-theme_hr_desc : 'Insert horizontal ruler',
-theme_removeformat_desc : 'Remove formatting',
-theme_custom1_desc : 'Your custom description here',
-insert_image_border : 'Border',
-insert_image_dimensions : 'Dimensions',
-insert_image_vspace : 'Vertical space',
-insert_image_hspace : 'Horizontal space',
-insert_image_align : 'Alignment',
-insert_image_align_default : '-- Not set --',
-insert_image_align_baseline : 'Baseline',
-insert_image_align_top : 'Top',
-insert_image_align_middle : 'Middle',
-insert_image_align_bottom : 'Bottom',
-insert_image_align_texttop : 'TextTop',
-insert_image_align_absmiddle : 'Absolute Middle',
-insert_image_align_absbottom : 'Absolute Bottom',
-insert_image_align_left : 'Left',
-insert_image_align_right : 'Right',
-theme_font_size : '-- Font size --',
-theme_fontdefault : '-- Font family --',
-theme_block : '-- Format --',
-theme_paragraph : 'Paragraph',
-theme_div : 'Div',
-theme_address : 'Address',
-theme_pre : 'Preformatted',
-theme_h1 : 'Heading 1',
-theme_h2 : 'Heading 2',
-theme_h3 : 'Heading 3',
-theme_h4 : 'Heading 4',
-theme_h5 : 'Heading 5',
-theme_h6 : 'Heading 6',
-theme_blockquote : 'Blockquote',
-theme_code : 'Code',
-theme_samp : 'Code sample',
-theme_dt : 'Definition term ',
-theme_dd : 'Definition description',
-theme_colorpicker_title : 'Select a color',
-theme_colorpicker_apply : 'Apply',
-theme_forecolor_desc : 'Select text color',
-theme_backcolor_desc : 'Select background color',
-theme_charmap_title : 'Select custom character',
-theme_charmap_desc : 'Insert custom character',
-theme_visualaid_desc : 'Toggle guidelines/invisible elements',
-insert_anchor_title : 'Insert/edit anchor',
-insert_anchor_name : 'Anchor name',
-theme_anchor_desc : 'Insert/edit anchor',
-theme_insert_link_titlefield : 'Title',
-theme_clipboard_msg : 'Copy/Cut/Paste is not available in Mozilla and Firefox.\nDo you want more information about this issue?',
-theme_path : 'Path',
-cut_desc : 'Cut',
-copy_desc : 'Copy',
-paste_desc : 'Paste',
-link_list : 'Link list',
-image_list : 'Image list',
-browse : 'Browse',
-image_props_desc : 'Image properties',
-newdocument_desc : 'New document',
-class_name : 'Class',
-newdocument : 'Are you sure you want clear all contents?',
-about_title : 'About TinyMCE',
-about : 'About',
-license : 'License',
-plugins : 'Plugins',
-plugin : 'Plugin',
-author : 'Author',
-version : 'Version',
-loaded_plugins : 'Loaded plugins',
-help : 'Help',
-not_set : '-- Not set --',
-close : 'Close',
-toolbar_focus : 'Jump to tool buttons - Alt+Q, Jump to editor - Alt-Z, Jump to element path - Alt-X',
-invalid_data : 'Error: Invalid values entered, these are marked in red.',
-more_colors : 'More colors',
-color_picker_tab : 'Picker',
-color_picker : 'Color picker',
-web_colors_tab : 'Palette',
-web_colors : 'Palette colors',
-named_colors_tab : 'Named',
-named_colors : 'Named colors',
-color : 'Color:',
-color_name : 'Name:',
-is_email : 'The URL you entered seems to be an email address, do you want to add the required mailto: prefix?',
-is_external : 'The URL you entered seems to external link, do you want to add the required http:// prefix?'
-});
+tinyMCE.addI18n('en.advanced',{
+style_select:"Styles",
+font_size:"Font size",
+fontdefault:"Font family",
+block:"Format",
+paragraph:"Paragraph",
+div:"Div",
+address:"Address",
+pre:"Preformatted",
+h1:"Heading 1",
+h2:"Heading 2",
+h3:"Heading 3",
+h4:"Heading 4",
+h5:"Heading 5",
+h6:"Heading 6",
+blockquote:"Blockquote",
+code:"Code",
+samp:"Code sample",
+dt:"Definition term ",
+dd:"Definition description",
+bold_desc:"Bold (Ctrl+B)",
+italic_desc:"Italic (Ctrl+I)",
+underline_desc:"Underline (Ctrl+U)",
+striketrough_desc:"Strikethrough",
+justifyleft_desc:"Align left",
+justifycenter_desc:"Align center",
+justifyright_desc:"Align right",
+justifyfull_desc:"Align full",
+bullist_desc:"Unordered list",
+numlist_desc:"Ordered list",
+outdent_desc:"Outdent",
+indent_desc:"Indent",
+undo_desc:"Undo (Ctrl+Z)",
+redo_desc:"Redo (Ctrl+Y)",
+link_desc:"Insert/edit link",
+unlink_desc:"Unlink",
+image_desc:"Insert/edit image",
+cleanup_desc:"Cleanup messy code",
+code_desc:"Edit HTML Source",
+sub_desc:"Subscript",
+sup_desc:"Superscript",
+hr_desc:"Insert horizontal ruler",
+removeformat_desc:"Remove formatting",
+custom1_desc:"Your custom description here",
+forecolor_desc:"Select text color",
+backcolor_desc:"Select background color",
+charmap_desc:"Insert custom character",
+visualaid_desc:"Toggle guidelines/invisible elements",
+anchor_desc:"Insert/edit anchor",
+cut_desc:"Cut",
+copy_desc:"Copy",
+paste_desc:"Paste",
+image_props_desc:"Image properties",
+newdocument_desc:"New document",
+help_desc:"Help",
+blockquote_desc:"Blockquote",
+clipboard_msg:"Copy/Cut/Paste is not available in Mozilla and Firefox.\r\nDo you want more information about this issue?",
+path:"Path",
+newdocument:"Are you sure you want clear all contents?",
+toolbar_focus:"Jump to tool buttons - Alt+Q, Jump to editor - Alt-Z, Jump to element path - Alt-X",
+more_colors:"More colors"
+});
\ No newline at end of file

Added: plog/branches/lifetype-1.2/js/tinymce/themes/advanced/langs/en_dlg.js
===================================================================
--- plog/branches/lifetype-1.2/js/tinymce/themes/advanced/langs/en_dlg.js	                        (rev 0)
+++ plog/branches/lifetype-1.2/js/tinymce/themes/advanced/langs/en_dlg.js	2010-09-21 23:00:22 UTC (rev 7027)
@@ -0,0 +1,51 @@
+tinyMCE.addI18n('en.advanced_dlg',{
+about_title:"About TinyMCE",
+about_general:"About",
+about_help:"Help",
+about_license:"License",
+about_plugins:"Plugins",
+about_plugin:"Plugin",
+about_author:"Author",
+about_version:"Version",
+about_loaded:"Loaded plugins",
+anchor_title:"Insert/edit anchor",
+anchor_name:"Anchor name",
+code_title:"HTML Source Editor",
+code_wordwrap:"Word wrap",
+colorpicker_title:"Select a color",
+colorpicker_picker_tab:"Picker",
+colorpicker_picker_title:"Color picker",
+colorpicker_palette_tab:"Palette",
+colorpicker_palette_title:"Palette colors",
+colorpicker_named_tab:"Named",
+colorpicker_named_title:"Named colors",
+colorpicker_color:"Color:",
+colorpicker_name:"Name:",
+charmap_title:"Select custom character",
+image_title:"Insert/edit image",
+image_src:"Image URL",
+image_alt:"Image description",
+image_list:"Image list",
+image_border:"Border",
+image_dimensions:"Dimensions",
+image_vspace:"Vertical space",
+image_hspace:"Horizontal space",
+image_align:"Alignment",
+image_align_baseline:"Baseline",
+image_align_top:"Top",
+image_align_middle:"Middle",
+image_align_bottom:"Bottom",
+image_align_texttop:"Text top",
+image_align_textbottom:"Text bottom",
+image_align_left:"Left",
+image_align_right:"Right",
+link_title:"Insert/edit link",
+link_url:"Link URL",
+link_target:"Target",
+link_target_same:"Open link in the same window",
+link_target_blank:"Open link in a new window",
+link_titlefield:"Title",
+link_is_email:"The URL you entered seems to be an email address, do you want to add the required mailto: prefix?",
+link_is_external:"The URL you entered seems to external link, do you want to add the required http:// prefix?",
+link_list:"Link list"
+});
\ No newline at end of file

Modified: plog/branches/lifetype-1.2/js/tinymce/themes/advanced/link.htm
===================================================================
--- plog/branches/lifetype-1.2/js/tinymce/themes/advanced/link.htm	2010-09-21 21:29:55 UTC (rev 7026)
+++ plog/branches/lifetype-1.2/js/tinymce/themes/advanced/link.htm	2010-09-21 23:00:22 UTC (rev 7027)
@@ -1,18 +1,18 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml">
 <head>
-	<title>{$lang_insert_link_title}</title>
-	<script language="javascript" type="text/javascript" src="../../tiny_mce_popup.js"></script>
-	<script language="javascript" type="text/javascript" src="../../utils/mctabs.js"></script>
-	<script language="javascript" type="text/javascript" src="../../utils/form_utils.js"></script>
-	<script language="javascript" type="text/javascript" src="../../utils/validate.js"></script>
-	<script language="javascript" type="text/javascript" src="jscripts/link.js"></script>
-	<base target="_self" />
+	<title>{#advanced_dlg.link_title}</title>
+	<script type="text/javascript" src="../../tiny_mce_popup.js"></script>
+	<script type="text/javascript" src="../../utils/mctabs.js"></script>
+	<script type="text/javascript" src="../../utils/form_utils.js"></script>
+	<script type="text/javascript" src="../../utils/validate.js"></script>
+	<script type="text/javascript" src="js/link.js"></script>
 </head>
-<body id="link" onload="tinyMCEPopup.executeOnLoad('init();');" style="display: none">
-<form onsubmit="insertLink();return false;" action="#">
+<body id="link" style="display: none">
+<form onsubmit="LinkDialog.update();return false;" action="#">
 	<div class="tabs">
 		<ul>
-			<li id="general_tab" class="current"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{$lang_insert_link_title}</a></span></li>
+			<li id="general_tab" class="current"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{#advanced_dlg.link_title}</a></span></li>
 		</ul>
 	</div>
 
@@ -21,80 +21,37 @@
 
 		<table border="0" cellpadding="4" cellspacing="0">
           <tr>
-            <td nowrap="nowrap"><label for="href">{$lang_insert_link_url}</label></td>
+            <td class="nowrap"><label for="href">{#advanced_dlg.link_url}</label></td>
             <td><table border="0" cellspacing="0" cellpadding="0"> 
 				  <tr> 
-					<td><input id="href" name="href" type="text" value="" style="width: 200px" onchange="checkPrefix(this);" /></td> 
+					<td><input id="href" name="href" type="text" class="mceFocus" value="" style="width: 200px" onchange="LinkDialog.checkPrefix(this);" /></td> 
 					<td id="hrefbrowsercontainer">&nbsp;</td>
 				  </tr> 
 				</table></td>
           </tr>
-		  <!-- Link list -->
-		  <script language="javascript">
-			if (typeof(tinyMCELinkList) != "undefined" && tinyMCELinkList.length > 0) {
-				var html = "";
-
-				html += '<tr><td><label for="link_list">{$lang_link_list}</label></td>';
-				html += '<td><select id="link_list" name="link_list" style="width: 200px" onchange="this.form.href.value=this.options[this.selectedIndex].value;">';
-				html += '<option value="">---</option>';
-
-				for (var i=0; i<tinyMCELinkList.length; i++)
-					html += '<option value="' + tinyMCELinkList[i][1] + '">' + tinyMCELinkList[i][0] + '</option>';
-
-				html += '</select></td></tr>';
-
-				document.write(html);
-			}
-		  </script>
-		  <!-- /Link list -->
+		  <tr>
+			<td><label for="link_list">{#advanced_dlg.link_list}</label></td>
+			<td><select id="link_list" name="link_list" onchange="document.getElementById('href').value=this.options[this.selectedIndex].value;"></select></td>
+		  </tr>
+		<tr>
+			<td><label id="targetlistlabel" for="targetlist">{#advanced_dlg.link_target}</label></td>
+			<td><select id="target_list" name="target_list"></select></td>
+		</tr>
           <tr>
-            <td nowrap="nowrap"><label for="target">{$lang_insert_link_target}</label></td>
-            <td><select id="target" name="target" style="width: 200px">
-                <option value="_self">{$lang_insert_link_target_same}</option>
-                <option value="_blank">{$lang_insert_link_target_blank}</option>
-				<script language="javascript">
-					var html = "";
-					var targets = tinyMCE.getParam('theme_advanced_link_targets', '').split(';');
-
-					for (var i=0; i<targets.length; i++) {
-						var key, value;
-
-						if (targets[i] == "")
-							continue;
-
-						key = targets[i].split('=')[0];
-						value = targets[i].split('=')[1];
-
-						html += '<option value="' + value + '">' + key + '</option>';
-					}
-
-					document.write(html);
-				</script>
-            </select></td>
+            <td class="nowrap"><label for="linktitle">{#advanced_dlg.link_titlefield}</label></td>
+            <td><input id="linktitle" name="linktitle" type="text" value="" style="width: 200px" /></td>
           </tr>
-          <tr>
-            <td nowrap="nowrap"><label for="linktitle">{$lang_theme_insert_link_titlefield}</label></td>
-            <td><input id="linktitle" name="linktitle" type="text" value="" style="width: 200px"></td>
-          </tr>
-          <tr id="styleSelectRow">
-            <td><label for="styleSelect">{$lang_class_name}</label></td>
-            <td>
-			 <select id="styleSelect" name="styleSelect">
-                <option value="" selected>{$lang_theme_style_select}</option>
-             </select></td>
-          </tr>
+			<tr>
+				<td><label for="class_list">{#class_name}</label></td>
+				<td><select id="class_list" name="class_list"></select></td>
+			</tr>
         </table>
 		</div>
 	</div>
 
 	<div class="mceActionPanel">
-		<div style="float: left">
-			<input type="button" id="insert" name="insert" value="{$lang_insert}" onclick="insertLink();" />
-		</div>
-
-		<div style="float: right">
-			<input type="button" id="cancel" name="cancel" value="{$lang_cancel}" onclick="tinyMCEPopup.close();" />
-		</div>
+		<input type="submit" id="insert" name="insert" value="{#insert}" />
+		<input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
 	</div>
 </form>
 </body>

Added: plog/branches/lifetype-1.2/js/tinymce/themes/advanced/skins/default/content.css
===================================================================
--- plog/branches/lifetype-1.2/js/tinymce/themes/advanced/skins/default/content.css	                        (rev 0)
+++ plog/branches/lifetype-1.2/js/tinymce/themes/advanced/skins/default/content.css	2010-09-21 23:00:22 UTC (rev 7027)
@@ -0,0 +1,36 @@
+body, td, pre {color:#000; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px; margin:8px;}
+body {background:#FFF;}
+body.mceForceColors {background:#FFF; color:#000;}
+h1 {font-size: 2em}
+h2 {font-size: 1.5em}
+h3 {font-size: 1.17em}
+h4 {font-size: 1em}
+h5 {font-size: .83em}
+h6 {font-size: .75em}
+.mceItemTable, .mceItemTable td, .mceItemTable th, .mceItemTable caption, .mceItemVisualAid {border: 1px dashed #BBB;}
+a.mceItemAnchor {display:inline-block; width:11px !important; height:11px  !important; background:url(img/items.gif) no-repeat 0 0;}
+span.mceItemNbsp {background: #DDD}
+td.mceSelected, th.mceSelected {background-color:#3399ff !important}
+img {border:0;}
+table {cursor:default}
+table td, table th {cursor:text}
+ins {border-bottom:1px solid green; text-decoration: none; color:green}
+del {color:red; text-decoration:line-through}
+cite {border-bottom:1px dashed blue}
+acronym {border-bottom:1px dotted #CCC; cursor:help}
+abbr {border-bottom:1px dashed #CCC; cursor:help}
+
+/* IE */
+* html body {
+scrollbar-3dlight-color:#F0F0EE;
+scrollbar-arrow-color:#676662;
+scrollbar-base-color:#F0F0EE;
+scrollbar-darkshadow-color:#DDD;
+scrollbar-face-color:#E0E0DD;
+scrollbar-highlight-color:#F0F0EE;
+scrollbar-shadow-color:#F0F0EE;
+scrollbar-track-color:#F5F5F5;
+}
+
+img:-moz-broken {-moz-force-broken-image-icon:1; width:24px; height:24px}
+font[face=mceinline] {font-family:inherit !important}

Added: plog/branches/lifetype-1.2/js/tinymce/themes/advanced/skins/default/dialog.css
===================================================================
--- plog/branches/lifetype-1.2/js/tinymce/themes/advanced/skins/default/dialog.css	                        (rev 0)
+++ plog/branches/lifetype-1.2/js/tinymce/themes/advanced/skins/default/dialog.css	2010-09-21 23:00:22 UTC (rev 7027)
@@ -0,0 +1,117 @@
+/* Generic */
+body {
+font-family:Verdana, Arial, Helvetica, sans-serif; font-size:11px;
+scrollbar-3dlight-color:#F0F0EE;
+scrollbar-arrow-color:#676662;
+scrollbar-base-color:#F0F0EE;
+scrollbar-darkshadow-color:#DDDDDD;
+scrollbar-face-color:#E0E0DD;
+scrollbar-highlight-color:#F0F0EE;
+scrollbar-shadow-color:#F0F0EE;
+scrollbar-track-color:#F5F5F5;
+background:#F0F0EE;
+padding:0;
+margin:8px 8px 0 8px;
+}
+
+html {background:#F0F0EE;}
+td {font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px;}
+textarea {resize:none;outline:none;}
+a:link, a:visited {color:black;}
+a:hover {color:#2B6FB6;}
+.nowrap {white-space: nowrap}
+
+/* Forms */
+fieldset {margin:0; padding:4px; border:1px solid #919B9C; font-family:Verdana, Arial; font-size:10px;}
+legend {color:#2B6FB6; font-weight:bold;}
+label.msg {display:none;}
+label.invalid {color:#EE0000; display:inline;}
+input.invalid {border:1px solid #EE0000;}
+input {background:#FFF; border:1px solid #CCC;}
+input, select, textarea {font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px;}
+input, select, textarea {border:1px solid #808080;}
+input.radio {border:1px none #000000; background:transparent; vertical-align:middle;}
+input.checkbox {border:1px none #000000; background:transparent; vertical-align:middle;}
+.input_noborder {border:0;}
+
+/* Buttons */
+#insert, #cancel, input.button, .updateButton {
+border:0; margin:0; padding:0;
+font-weight:bold;
+width:94px; height:26px;
+background:url(img/buttons.png) 0 -26px;
+cursor:pointer;
+padding-bottom:2px;
+float:left;
+}
+
+#insert {background:url(img/buttons.png) 0 -52px}
+#cancel {background:url(img/buttons.png) 0 0; float:right}
+
+/* Browse */
+a.pickcolor, a.browse {text-decoration:none}
+a.browse span {display:block; width:20px; height:18px; background:url(../../img/icons.gif) -860px 0; border:1px solid #FFF; margin-left:1px;}
+.mceOldBoxModel a.browse span {width:22px; height:20px;}
+a.browse:hover span {border:1px solid #0A246A; background-color:#B2BBD0;}
+a.browse span.disabled {border:1px solid white; opacity:0.3; -ms-filter:'alpha(opacity=30)'; filter:alpha(opacity=30)}
+a.browse:hover span.disabled {border:1px solid white; background-color:transparent;}
+a.pickcolor span {display:block; width:20px; height:16px; background:url(../../img/icons.gif) -840px 0; margin-left:2px;}
+.mceOldBoxModel a.pickcolor span {width:21px; height:17px;}
+a.pickcolor:hover span {background-color:#B2BBD0;}
+a.pickcolor:hover span.disabled {}
+
+/* Charmap */
+table.charmap {border:1px solid #AAA; text-align:center}
+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;}
+#charmap a {display:block; color:#000; text-decoration:none; border:0}
+#charmap a:hover {background:#CCC;color:#2B6FB6}
+#charmap #codeN {font-size:10px; font-family:Arial,Helvetica,sans-serif; text-align:center}
+#charmap #codeV {font-size:40px; height:80px; border:1px solid #AAA; text-align:center}
+
+/* Source */
+.wordWrapCode {vertical-align:middle; border:1px none #000000; background:transparent;}
+.mceActionPanel {margin-top:5px;}
+
+/* Tabs classes */
+.tabs {width:100%; height:18px; line-height:normal; background:url(img/tabs.gif) repeat-x 0 -72px;}
+.tabs ul {margin:0; padding:0; list-style:none;}
+.tabs li {float:left; background:url(img/tabs.gif) no-repeat 0 0; margin:0 2px 0 0; padding:0 0 0 10px; line-height:17px; height:18px; display:block;}
+.tabs li.current {background:url(img/tabs.gif) no-repeat 0 -18px; margin-right:2px;}
+.tabs span {float:left; display:block; background:url(img/tabs.gif) no-repeat right -36px; padding:0px 10px 0 0;}
+.tabs .current span {background:url(img/tabs.gif) no-repeat right -54px;}
+.tabs a {text-decoration:none; font-family:Verdana, Arial; font-size:10px;}
+.tabs a:link, .tabs a:visited, .tabs a:hover {color:black;}
+
+/* Panels */
+.panel_wrapper div.panel {display:none;}
+.panel_wrapper div.current {display:block; width:100%; height:300px; overflow:visible;}
+.panel_wrapper {border:1px solid #919B9C; border-top:0px; padding:10px; padding-top:5px; clear:both; background:white;}
+
+/* Columns */
+.column {float:left;}
+.properties {width:100%;}
+.properties .column1 {}
+.properties .column2 {text-align:left;}
+
+/* Titles */
+h1, h2, h3, h4 {color:#2B6FB6; margin:0; padding:0; padding-top:5px;}
+h3 {font-size:14px;}
+.title {font-size:12px; font-weight:bold; color:#2B6FB6;}
+
+/* Dialog specific */
+#link .panel_wrapper, #link div.current {height:125px;}
+#image .panel_wrapper, #image div.current {height:200px;}
+#plugintable thead {font-weight:bold; background:#DDD;}
+#plugintable, #about #plugintable td {border:1px solid #919B9C;}
+#plugintable {width:96%; margin-top:10px;}
+#pluginscontainer {height:290px; overflow:auto;}
+#colorpicker #preview {float:right; width:50px; height:14px;line-height:1px; border:1px solid black; margin-left:5px;}
+#colorpicker #colors {float:left; border:1px solid gray; cursor:crosshair;}
+#colorpicker #light {border:1px solid gray; margin-left:5px; float:left;width:15px; height:150px; cursor:crosshair;}
+#colorpicker #light div {overflow:hidden;}
+#colorpicker #previewblock {float:right; padding-left:10px; height:20px;}
+#colorpicker .panel_wrapper div.current {height:175px;}
+#colorpicker #namedcolors {width:150px;}
+#colorpicker #namedcolors a {display:block; float:left; width:10px; height:10px; margin:1px 1px 0 0; overflow:hidden;}
+#colorpicker #colornamecontainer {margin-top:5px;}
+#colorpicker #picker_panel fieldset {margin:auto;width:325px;}

Added: plog/branches/lifetype-1.2/js/tinymce/themes/advanced/skins/default/img/buttons.png
===================================================================
(Binary files differ)


Property changes on: plog/branches/lifetype-1.2/js/tinymce/themes/advanced/skins/default/img/buttons.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: plog/branches/lifetype-1.2/js/tinymce/themes/advanced/skins/default/img/items.gif
===================================================================
(Binary files differ)


Property changes on: plog/branches/lifetype-1.2/js/tinymce/themes/advanced/skins/default/img/items.gif
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: plog/branches/lifetype-1.2/js/tinymce/themes/advanced/skins/default/img/menu_arrow.gif
===================================================================
(Binary files differ)


Property changes on: plog/branches/lifetype-1.2/js/tinymce/themes/advanced/skins/default/img/menu_arrow.gif
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: plog/branches/lifetype-1.2/js/tinymce/themes/advanced/skins/default/img/menu_check.gif
===================================================================
(Binary files differ)


Property changes on: plog/branches/lifetype-1.2/js/tinymce/themes/advanced/skins/default/img/menu_check.gif
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: plog/branches/lifetype-1.2/js/tinymce/themes/advanced/skins/default/img/progress.gif
===================================================================
(Binary files differ)


Property changes on: plog/branches/lifetype-1.2/js/tinymce/themes/advanced/skins/default/img/progress.gif
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: plog/branches/lifetype-1.2/js/tinymce/themes/advanced/skins/default/img/tabs.gif
===================================================================
(Binary files differ)


Property changes on: plog/branches/lifetype-1.2/js/tinymce/themes/advanced/skins/default/img/tabs.gif
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: plog/branches/lifetype-1.2/js/tinymce/themes/advanced/skins/default/ui.css
===================================================================
--- plog/branches/lifetype-1.2/js/tinymce/themes/advanced/skins/default/ui.css	                        (rev 0)
+++ plog/branches/lifetype-1.2/js/tinymce/themes/advanced/skins/default/ui.css	2010-09-21 23:00:22 UTC (rev 7027)
@@ -0,0 +1,213 @@
+/* Reset */
+.defaultSkin table, .defaultSkin tbody, .defaultSkin a, .defaultSkin img, .defaultSkin tr, .defaultSkin div, .defaultSkin td, .defaultSkin iframe, .defaultSkin span, .defaultSkin *, .defaultSkin .mceText {border:0; margin:0; padding:0; background:transparent; white-space:nowrap; text-decoration:none; font-weight:normal; cursor:default; color:#000; vertical-align:baseline; width:auto; border-collapse:separate; text-align:left}
+.defaultSkin a:hover, .defaultSkin a:link, .defaultSkin a:visited, .defaultSkin a:active {text-decoration:none; font-weight:normal; cursor:default; color:#000}
+.defaultSkin table td {vertical-align:middle}
+
+/* Containers */
+.defaultSkin table {direction:ltr; background:#F0F0EE}
+.defaultSkin iframe {display:block; background:#FFF}
+.defaultSkin .mceToolbar {height:26px}
+.defaultSkin .mceLeft {text-align:left}
+.defaultSkin .mceRight {text-align:right}
+
+/* External */
+.defaultSkin .mceExternalToolbar {position:absolute; border:1px solid #CCC; border-bottom:0; display:none;}
+.defaultSkin .mceExternalToolbar td.mceToolbar {padding-right:13px;}
+.defaultSkin .mceExternalClose {position:absolute; top:3px; right:3px; width:7px; height:7px; background:url(../../img/icons.gif) -820px 0}
+
+/* Layout */
+.defaultSkin table.mceLayout {border:0; border-left:1px solid #CCC; border-right:1px solid #CCC}
+.defaultSkin table.mceLayout tr.mceFirst td {border-top:1px solid #CCC}
+.defaultSkin table.mceLayout tr.mceLast td {border-bottom:1px solid #CCC}
+.defaultSkin table.mceToolbar, .defaultSkin tr.mceFirst .mceToolbar tr td, .defaultSkin tr.mceLast .mceToolbar tr td {border:0; margin:0; padding:0;}
+.defaultSkin td.mceToolbar {padding-top:1px; vertical-align:top}
+.defaultSkin .mceIframeContainer {border-top:1px solid #CCC; border-bottom:1px solid #CCC}
+.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}
+.defaultSkin .mceStatusbar div {float:left; margin:2px}
+.defaultSkin .mceStatusbar a.mceResize {display:block; float:right; background:url(../../img/icons.gif) -800px 0; width:20px; height:20px; cursor:se-resize; outline:0}
+.defaultSkin .mceStatusbar a:hover {text-decoration:underline}
+.defaultSkin table.mceToolbar {margin-left:3px}
+.defaultSkin span.mceIcon, .defaultSkin img.mceIcon {display:block; width:20px; height:20px}
+.defaultSkin .mceIcon {background:url(../../img/icons.gif) no-repeat 20px 20px}
+.defaultSkin td.mceCenter {text-align:center;}
+.defaultSkin td.mceCenter table {margin:0 auto; text-align:left;}
+.defaultSkin td.mceRight table {margin:0 0 0 auto;}
+
+/* Button */
+.defaultSkin .mceButton {display:block; border:1px solid #F0F0EE; width:20px; height:20px; margin-right:1px}
+.defaultSkin a.mceButtonEnabled:hover {border:1px solid #0A246A; background-color:#B2BBD0}
+.defaultSkin a.mceButtonActive, .defaultSkin a.mceButtonSelected {border:1px solid #0A246A; background-color:#C2CBE0}
+.defaultSkin .mceButtonDisabled .mceIcon {opacity:0.3; -ms-filter:'alpha(opacity=30)'; filter:alpha(opacity=30)}
+.defaultSkin .mceButtonLabeled {width:auto}
+.defaultSkin .mceButtonLabeled span.mceIcon {float:left}
+.defaultSkin span.mceButtonLabel {display:block; font-size:10px; padding:4px 6px 0 22px; font-family:Tahoma,Verdana,Arial,Helvetica}
+.defaultSkin .mceButtonDisabled .mceButtonLabel {color:#888}
+
+/* Separator */
+.defaultSkin .mceSeparator {display:block; background:url(../../img/icons.gif) -180px 0; width:2px; height:20px; margin:2px 2px 0 4px}
+
+/* ListBox */
+.defaultSkin .mceListBox, .defaultSkin .mceListBox a {display:block}
+.defaultSkin .mceListBox .mceText {padding-left:4px; width:70px; text-align:left; border:1px solid #CCC; border-right:0; background:#FFF; font-family:Tahoma,Verdana,Arial,Helvetica; font-size:11px; height:20px; line-height:20px; overflow:hidden}
+.defaultSkin .mceListBox .mceOpen {width:9px; height:20px; background:url(../../img/icons.gif) -741px 0; margin-right:2px; border:1px solid #CCC;}
+.defaultSkin table.mceListBoxEnabled:hover .mceText, .defaultSkin .mceListBoxHover .mceText, .defaultSkin .mceListBoxSelected .mceText {border:1px solid #A2ABC0; border-right:0; background:#FFF}
+.defaultSkin table.mceListBoxEnabled:hover .mceOpen, .defaultSkin .mceListBoxHover .mceOpen, .defaultSkin .mceListBoxSelected .mceOpen {background-color:#FFF; border:1px solid #A2ABC0}
+.defaultSkin .mceListBoxDisabled a.mceText {color:gray; background-color:transparent;}
+.defaultSkin .mceListBoxMenu {overflow:auto; overflow-x:hidden}
+.defaultSkin .mceOldBoxModel .mceListBox .mceText {height:22px}
+.defaultSkin .mceOldBoxModel .mceListBox .mceOpen {width:11px; height:22px;}
+.defaultSkin select.mceNativeListBox {font-family:'MS Sans Serif',sans-serif,Verdana,Arial; font-size:7pt; background:#F0F0EE; border:1px solid gray; margin-right:2px;}
+
+/* SplitButton */
+.defaultSkin .mceSplitButton {width:32px; height:20px; direction:ltr}
+.defaultSkin .mceSplitButton a, .defaultSkin .mceSplitButton span {height:20px; display:block}
+.defaultSkin .mceSplitButton a.mceAction {width:20px; border:1px solid #F0F0EE; border-right:0;}
+.defaultSkin .mceSplitButton span.mceAction {width:20px; background-image:url(../../img/icons.gif);}
+.defaultSkin .mceSplitButton a.mceOpen {width:9px; background:url(../../img/icons.gif) -741px 0; border:1px solid #F0F0EE;}
+.defaultSkin .mceSplitButton span.mceOpen {display:none}
+.defaultSkin table.mceSplitButtonEnabled:hover a.mceAction, .defaultSkin .mceSplitButtonHover a.mceAction, .defaultSkin .mceSplitButtonSelected a.mceAction {border:1px solid #0A246A; border-right:0; background-color:#B2BBD0}
+.defaultSkin table.mceSplitButtonEnabled:hover a.mceOpen, .defaultSkin .mceSplitButtonHover a.mceOpen, .defaultSkin .mceSplitButtonSelected a.mceOpen {background-color:#B2BBD0; border:1px solid #0A246A;}
+.defaultSkin .mceSplitButtonDisabled .mceAction, .defaultSkin .mceSplitButtonDisabled a.mceOpen {opacity:0.3; -ms-filter:'alpha(opacity=30)'; filter:alpha(opacity=30)}
+.defaultSkin .mceSplitButtonActive a.mceAction {border:1px solid #0A246A; background-color:#C2CBE0}
+.defaultSkin .mceSplitButtonActive a.mceOpen {border-left:0;}
+
+/* ColorSplitButton */
+.defaultSkin div.mceColorSplitMenu table {background:#FFF; border:1px solid gray}
+.defaultSkin .mceColorSplitMenu td {padding:2px}
+.defaultSkin .mceColorSplitMenu a {display:block; width:9px; height:9px; overflow:hidden; border:1px solid #808080}
+.defaultSkin .mceColorSplitMenu td.mceMoreColors {padding:1px 3px 1px 1px}
+.defaultSkin .mceColorSplitMenu a.mceMoreColors {width:100%; height:auto; text-align:center; font-family:Tahoma,Verdana,Arial,Helvetica; font-size:11px; line-height:20px; border:1px solid #FFF}
+.defaultSkin .mceColorSplitMenu a.mceMoreColors:hover {border:1px solid #0A246A; background-color:#B6BDD2}
+.defaultSkin a.mceMoreColors:hover {border:1px solid #0A246A}
+.defaultSkin .mceColorPreview {margin-left:2px; width:16px; height:4px; overflow:hidden; background:#9a9b9a}
+.defaultSkin .mce_forecolor span.mceAction, .defaultSkin .mce_backcolor span.mceAction {overflow:hidden; height:16px}
+
+/* Menu */
+.defaultSkin .mceMenu {position:absolute; left:0; top:0; z-index:1000; border:1px solid #D4D0C8}
+.defaultSkin .mceNoIcons span.mceIcon {width:0;}
+.defaultSkin .mceNoIcons a .mceText {padding-left:10px}
+.defaultSkin .mceMenu table {background:#FFF}
+.defaultSkin .mceMenu a, .defaultSkin .mceMenu span, .defaultSkin .mceMenu {display:block}
+.defaultSkin .mceMenu td {height:20px}
+.defaultSkin .mceMenu a {position:relative;padding:3px 0 4px 0}
+.defaultSkin .mceMenu .mceText {position:relative; display:block; font-family:Tahoma,Verdana,Arial,Helvetica; color:#000; cursor:default; margin:0; padding:0 25px 0 25px; display:block}
+.defaultSkin .mceMenu span.mceText, .defaultSkin .mceMenu .mcePreview {font-size:11px}
+.defaultSkin .mceMenu pre.mceText {font-family:Monospace}
+.defaultSkin .mceMenu .mceIcon {position:absolute; top:0; left:0; width:22px;}
+.defaultSkin .mceMenu .mceMenuItemEnabled a:hover, .defaultSkin .mceMenu .mceMenuItemActive {background-color:#dbecf3}
+.defaultSkin td.mceMenuItemSeparator {background:#DDD; height:1px}
+.defaultSkin .mceMenuItemTitle a {border:0; background:#EEE; border-bottom:1px solid #DDD}
+.defaultSkin .mceMenuItemTitle span.mceText {color:#000; font-weight:bold; padding-left:4px}
+.defaultSkin .mceMenuItemDisabled .mceText {color:#888}
+.defaultSkin .mceMenuItemSelected .mceIcon {background:url(img/menu_check.gif)}
+.defaultSkin .mceNoIcons .mceMenuItemSelected a {background:url(img/menu_arrow.gif) no-repeat -6px center}
+.defaultSkin .mceMenu span.mceMenuLine {display:none}
+.defaultSkin .mceMenuItemSub a {background:url(img/menu_arrow.gif) no-repeat top right;}
+
+/* Progress,Resize */
+.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}
+.defaultSkin .mceProgress {position:absolute; left:0; top:0; z-index:1001; background:url(img/progress.gif) no-repeat; width:32px; height:32px; margin:-16px 0 0 -16px}
+
+/* Formats */
+.defaultSkin .mce_formatPreview a {font-size:10px}
+.defaultSkin .mce_p span.mceText {}
+.defaultSkin .mce_address span.mceText {font-style:italic}
+.defaultSkin .mce_pre span.mceText {font-family:monospace}
+.defaultSkin .mce_h1 span.mceText {font-weight:bolder; font-size: 2em}
+.defaultSkin .mce_h2 span.mceText {font-weight:bolder; font-size: 1.5em}
+.defaultSkin .mce_h3 span.mceText {font-weight:bolder; font-size: 1.17em}
+.defaultSkin .mce_h4 span.mceText {font-weight:bolder; font-size: 1em}
+.defaultSkin .mce_h5 span.mceText {font-weight:bolder; font-size: .83em}
+.defaultSkin .mce_h6 span.mceText {font-weight:bolder; font-size: .75em}
+
+/* Theme */
+.defaultSkin span.mce_bold {background-position:0 0}
+.defaultSkin span.mce_italic {background-position:-60px 0}
+.defaultSkin span.mce_underline {background-position:-140px 0}
+.defaultSkin span.mce_strikethrough {background-position:-120px 0}
+.defaultSkin span.mce_undo {background-position:-160px 0}
+.defaultSkin span.mce_redo {background-position:-100px 0}
+.defaultSkin span.mce_cleanup {background-position:-40px 0}
+.defaultSkin span.mce_bullist {background-position:-20px 0}
+.defaultSkin span.mce_numlist {background-position:-80px 0}
+.defaultSkin span.mce_justifyleft {background-position:-460px 0}
+.defaultSkin span.mce_justifyright {background-position:-480px 0}
+.defaultSkin span.mce_justifycenter {background-position:-420px 0}
+.defaultSkin span.mce_justifyfull {background-position:-440px 0}
+.defaultSkin span.mce_anchor {background-position:-200px 0}
+.defaultSkin span.mce_indent {background-position:-400px 0}
+.defaultSkin span.mce_outdent {background-position:-540px 0}
+.defaultSkin span.mce_link {background-position:-500px 0}
+.defaultSkin span.mce_unlink {background-position:-640px 0}
+.defaultSkin span.mce_sub {background-position:-600px 0}
+.defaultSkin span.mce_sup {background-position:-620px 0}
+.defaultSkin span.mce_removeformat {background-position:-580px 0}
+.defaultSkin span.mce_newdocument {background-position:-520px 0}
+.defaultSkin span.mce_image {background-position:-380px 0}
+.defaultSkin span.mce_help {background-position:-340px 0}
+.defaultSkin span.mce_code {background-position:-260px 0}
+.defaultSkin span.mce_hr {background-position:-360px 0}
+.defaultSkin span.mce_visualaid {background-position:-660px 0}
+.defaultSkin span.mce_charmap {background-position:-240px 0}
+.defaultSkin span.mce_paste {background-position:-560px 0}
+.defaultSkin span.mce_copy {background-position:-700px 0}
+.defaultSkin span.mce_cut {background-position:-680px 0}
+.defaultSkin span.mce_blockquote {background-position:-220px 0}
+.defaultSkin .mce_forecolor span.mceAction {background-position:-720px 0}
+.defaultSkin .mce_backcolor span.mceAction {background-position:-760px 0}
+.defaultSkin span.mce_forecolorpicker {background-position:-720px 0}
+.defaultSkin span.mce_backcolorpicker {background-position:-760px 0}
+
+/* Plugins */
+.defaultSkin span.mce_advhr {background-position:-0px -20px}
+.defaultSkin span.mce_ltr {background-position:-20px -20px}
+.defaultSkin span.mce_rtl {background-position:-40px -20px}
+.defaultSkin span.mce_emotions {background-position:-60px -20px}
+.defaultSkin span.mce_fullpage {background-position:-80px -20px}
+.defaultSkin span.mce_fullscreen {background-position:-100px -20px}
+.defaultSkin span.mce_iespell {background-position:-120px -20px}
+.defaultSkin span.mce_insertdate {background-position:-140px -20px}
+.defaultSkin span.mce_inserttime {background-position:-160px -20px}
+.defaultSkin span.mce_absolute {background-position:-180px -20px}
+.defaultSkin span.mce_backward {background-position:-200px -20px}
+.defaultSkin span.mce_forward {background-position:-220px -20px}
+.defaultSkin span.mce_insert_layer {background-position:-240px -20px}
+.defaultSkin span.mce_insertlayer {background-position:-260px -20px}
+.defaultSkin span.mce_movebackward {background-position:-280px -20px}
+.defaultSkin span.mce_moveforward {background-position:-300px -20px}
+.defaultSkin span.mce_media {background-position:-320px -20px}
+.defaultSkin span.mce_nonbreaking {background-position:-340px -20px}
+.defaultSkin span.mce_pastetext {background-position:-360px -20px}
+.defaultSkin span.mce_pasteword {background-position:-380px -20px}
+.defaultSkin span.mce_selectall {background-position:-400px -20px}
+.defaultSkin span.mce_preview {background-position:-420px -20px}
+.defaultSkin span.mce_print {background-position:-440px -20px}
+.defaultSkin span.mce_cancel {background-position:-460px -20px}
+.defaultSkin span.mce_save {background-position:-480px -20px}
+.defaultSkin span.mce_replace {background-position:-500px -20px}
+.defaultSkin span.mce_search {background-position:-520px -20px}
+.defaultSkin span.mce_styleprops {background-position:-560px -20px}
+.defaultSkin span.mce_table {background-position:-580px -20px}
+.defaultSkin span.mce_cell_props {background-position:-600px -20px}
+.defaultSkin span.mce_delete_table {background-position:-620px -20px}
+.defaultSkin span.mce_delete_col {background-position:-640px -20px}
+.defaultSkin span.mce_delete_row {background-position:-660px -20px}
+.defaultSkin span.mce_col_after {background-position:-680px -20px}
+.defaultSkin span.mce_col_before {background-position:-700px -20px}
+.defaultSkin span.mce_row_after {background-position:-720px -20px}
+.defaultSkin span.mce_row_before {background-position:-740px -20px}
+.defaultSkin span.mce_merge_cells {background-position:-760px -20px}
+.defaultSkin span.mce_table_props {background-position:-980px -20px}
+.defaultSkin span.mce_row_props {background-position:-780px -20px}
+.defaultSkin span.mce_split_cells {background-position:-800px -20px}
+.defaultSkin span.mce_template {background-position:-820px -20px}
+.defaultSkin span.mce_visualchars {background-position:-840px -20px}
+.defaultSkin span.mce_abbr {background-position:-860px -20px}
+.defaultSkin span.mce_acronym {background-position:-880px -20px}
+.defaultSkin span.mce_attribs {background-position:-900px -20px}
+.defaultSkin span.mce_cite {background-position:-920px -20px}
+.defaultSkin span.mce_del {background-position:-940px -20px}
+.defaultSkin span.mce_ins {background-position:-960px -20px}
+.defaultSkin span.mce_pagebreak {background-position:0 -40px}
+.defaultSkin span.mce_restoredraft {background-position:-20px -40px}
+.defaultSkin span.mce_spellchecker {background-position:-540px -20px}

Added: plog/branches/lifetype-1.2/js/tinymce/themes/advanced/skins/o2k7/content.css
===================================================================
--- plog/branches/lifetype-1.2/js/tinymce/themes/advanced/skins/o2k7/content.css	                        (rev 0)
+++ plog/branches/lifetype-1.2/js/tinymce/themes/advanced/skins/o2k7/content.css	2010-09-21 23:00:22 UTC (rev 7027)
@@ -0,0 +1,36 @@
+body, td, pre {color:#000; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px; margin:8px;}
+body {background:#FFF;}
+body.mceForceColors {background:#FFF; color:#000;}
+h1 {font-size: 2em}
+h2 {font-size: 1.5em}
+h3 {font-size: 1.17em}
+h4 {font-size: 1em}
+h5 {font-size: .83em}
+h6 {font-size: .75em}
+.mceItemTable, .mceItemTable td, .mceItemTable th, .mceItemTable caption, .mceItemVisualAid {border: 1px dashed #BBB;}
+a.mceItemAnchor {display:inline-block; width:11px !important; height:11px  !important; background:url(../default/img/items.gif) no-repeat 0 0;}
+span.mceItemNbsp {background: #DDD}
+td.mceSelected, th.mceSelected {background-color:#3399ff !important}
+img {border:0;}
+table {cursor:default}
+table td, table th {cursor:text}
+ins {border-bottom:1px solid green; text-decoration: none; color:green}
+del {color:red; text-decoration:line-through}
+cite {border-bottom:1px dashed blue}
+acronym {border-bottom:1px dotted #CCC; cursor:help}
+abbr {border-bottom:1px dashed #CCC; cursor:help}
+
+/* IE */
+* html body {
+scrollbar-3dlight-color:#F0F0EE;
+scrollbar-arrow-color:#676662;
+scrollbar-base-color:#F0F0EE;
+scrollbar-darkshadow-color:#DDD;
+scrollbar-face-color:#E0E0DD;
+scrollbar-highlight-color:#F0F0EE;
+scrollbar-shadow-color:#F0F0EE;
+scrollbar-track-color:#F5F5F5;
+}
+
+img:-moz-broken {-moz-force-broken-image-icon:1; width:24px; height:24px}
+font[face=mceinline] {font-family:inherit !important}

Added: plog/branches/lifetype-1.2/js/tinymce/themes/advanced/skins/o2k7/dialog.css
===================================================================
--- plog/branches/lifetype-1.2/js/tinymce/themes/advanced/skins/o2k7/dialog.css	                        (rev 0)
+++ plog/branches/lifetype-1.2/js/tinymce/themes/advanced/skins/o2k7/dialog.css	2010-09-21 23:00:22 UTC (rev 7027)
@@ -0,0 +1,116 @@
+/* Generic */
+body {
+font-family:Verdana, Arial, Helvetica, sans-serif; font-size:11px;
+scrollbar-3dlight-color:#F0F0EE;
+scrollbar-arrow-color:#676662;
+scrollbar-base-color:#F0F0EE;
+scrollbar-darkshadow-color:#DDDDDD;
+scrollbar-face-color:#E0E0DD;
+scrollbar-highlight-color:#F0F0EE;
+scrollbar-shadow-color:#F0F0EE;
+scrollbar-track-color:#F5F5F5;
+background:#F0F0EE;
+padding:0;
+margin:8px 8px 0 8px;
+}
+
+html {background:#F0F0EE;}
+td {font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px;}
+textarea {resize:none;outline:none;}
+a:link, a:visited {color:black;}
+a:hover {color:#2B6FB6;}
+.nowrap {white-space: nowrap}
+
+/* Forms */
+fieldset {margin:0; padding:4px; border:1px solid #919B9C; font-family:Verdana, Arial; font-size:10px;}
+legend {color:#2B6FB6; font-weight:bold;}
+label.msg {display:none;}
+label.invalid {color:#EE0000; display:inline;}
+input.invalid {border:1px solid #EE0000;}
+input {background:#FFF; border:1px solid #CCC;}
+input, select, textarea {font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px;}
+input, select, textarea {border:1px solid #808080;}
+input.radio {border:1px none #000000; background:transparent; vertical-align:middle;}
+input.checkbox {border:1px none #000000; background:transparent; vertical-align:middle;}
+.input_noborder {border:0;}
+
+/* Buttons */
+#insert, #cancel, input.button, .updateButton {
+border:0; margin:0; padding:0;
+font-weight:bold;
+width:94px; height:26px;
+background:url(../default/img/buttons.png) 0 -26px;
+cursor:pointer;
+padding-bottom:2px;
+float:left;
+}
+
+#insert {background:url(../default/img/buttons.png) 0 -52px}
+#cancel {background:url(../default/img/buttons.png) 0 0; float:right}
+
+/* Browse */
+a.pickcolor, a.browse {text-decoration:none}
+a.browse span {display:block; width:20px; height:18px; background:url(../../img/icons.gif) -860px 0; border:1px solid #FFF; margin-left:1px;}
+.mceOldBoxModel a.browse span {width:22px; height:20px;}
+a.browse:hover span {border:1px solid #0A246A; background-color:#B2BBD0;}
+a.browse span.disabled {border:1px solid white; opacity:0.3; -ms-filter:'alpha(opacity=30)'; filter:alpha(opacity=30)}
+a.browse:hover span.disabled {border:1px solid white; background-color:transparent;}
+a.pickcolor span {display:block; width:20px; height:16px; background:url(../../img/icons.gif) -840px 0; margin-left:2px;}
+.mceOldBoxModel a.pickcolor span {width:21px; height:17px;}
+a.pickcolor:hover span {background-color:#B2BBD0;}
+a.pickcolor:hover span.disabled {}
+
+/* Charmap */
+table.charmap {border:1px solid #AAA; text-align:center}
+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;}
+#charmap a {display:block; color:#000; text-decoration:none; border:0}
+#charmap a:hover {background:#CCC;color:#2B6FB6}
+#charmap #codeN {font-size:10px; font-family:Arial,Helvetica,sans-serif; text-align:center}
+#charmap #codeV {font-size:40px; height:80px; border:1px solid #AAA; text-align:center}
+
+/* Source */
+.wordWrapCode {vertical-align:middle; border:1px none #000000; background:transparent;}
+.mceActionPanel {margin-top:5px;}
+
+/* Tabs classes */
+.tabs {width:100%; height:18px; line-height:normal; background:url(../default/img/tabs.gif) repeat-x 0 -72px;}
+.tabs ul {margin:0; padding:0; list-style:none;}
+.tabs li {float:left; background:url(../default/img/tabs.gif) no-repeat 0 0; margin:0 2px 0 0; padding:0 0 0 10px; line-height:17px; height:18px; display:block;}
+.tabs li.current {background:url(../default/img/tabs.gif) no-repeat 0 -18px; margin-right:2px;}
+.tabs span {float:left; display:block; background:url(../default/img/tabs.gif) no-repeat right -36px; padding:0px 10px 0 0;}
+.tabs .current span {background:url(../default/img/tabs.gif) no-repeat right -54px;}
+.tabs a {text-decoration:none; font-family:Verdana, Arial; font-size:10px;}
+.tabs a:link, .tabs a:visited, .tabs a:hover {color:black;}
+
+/* Panels */
+.panel_wrapper div.panel {display:none;}
+.panel_wrapper div.current {display:block; width:100%; height:300px; overflow:visible;}
+.panel_wrapper {border:1px solid #919B9C; border-top:0px; padding:10px; padding-top:5px; clear:both; background:white;}
+
+/* Columns */
+.column {float:left;}
+.properties {width:100%;}
+.properties .column1 {}
+.properties .column2 {text-align:left;}
+
+/* Titles */
+h1, h2, h3, h4 {color:#2B6FB6; margin:0; padding:0; padding-top:5px;}
+h3 {font-size:14px;}
+.title {font-size:12px; font-weight:bold; color:#2B6FB6;}
+
+/* Dialog specific */
+#link .panel_wrapper, #link div.current {height:125px;}
+#image .panel_wrapper, #image div.current {height:200px;}
+#plugintable thead {font-weight:bold; background:#DDD;}
+#plugintable, #about #plugintable td {border:1px solid #919B9C;}
+#plugintable {width:96%; margin-top:10px;}
+#pluginscontainer {height:290px; overflow:auto;}
+#colorpicker #preview {float:right; width:50px; height:14px;line-height:1px; border:1px solid black; margin-left:5px;}
+#colorpicker #colors {float:left; border:1px solid gray; cursor:crosshair;}
+#colorpicker #light {border:1px solid gray; margin-left:5px; float:left;width:15px; height:150px; cursor:crosshair;}
+#colorpicker #light div {overflow:hidden;}
+#colorpicker #previewblock {float:right; padding-left:10px; height:20px;}
+#colorpicker .panel_wrapper div.current {height:175px;}
+#colorpicker #namedcolors {width:150px;}
+#colorpicker #namedcolors a {display:block; float:left; width:10px; height:10px; margin:1px 1px 0 0; overflow:hidden;}
+#colorpicker #colornamecontainer {margin-top:5px;}

Added: plog/branches/lifetype-1.2/js/tinymce/themes/advanced/skins/o2k7/img/button_bg.png
===================================================================
(Binary files differ)


Property changes on: plog/branches/lifetype-1.2/js/tinymce/themes/advanced/skins/o2k7/img/button_bg.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: plog/branches/lifetype-1.2/js/tinymce/themes/advanced/skins/o2k7/img/button_bg_black.png
===================================================================
(Binary files differ)


Property changes on: plog/branches/lifetype-1.2/js/tinymce/themes/advanced/skins/o2k7/img/button_bg_black.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: plog/branches/lifetype-1.2/js/tinymce/themes/advanced/skins/o2k7/img/button_bg_silver.png
===================================================================
(Binary files differ)


Property changes on: plog/branches/lifetype-1.2/js/tinymce/themes/advanced/skins/o2k7/img/button_bg_silver.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: plog/branches/lifetype-1.2/js/tinymce/themes/advanced/skins/o2k7/ui.css
===================================================================
--- plog/branches/lifetype-1.2/js/tinymce/themes/advanced/skins/o2k7/ui.css	                        (rev 0)
+++ plog/branches/lifetype-1.2/js/tinymce/themes/advanced/skins/o2k7/ui.css	2010-09-21 23:00:22 UTC (rev 7027)
@@ -0,0 +1,215 @@
+/* Reset */
+.o2k7Skin table, .o2k7Skin tbody, .o2k7Skin a, .o2k7Skin img, .o2k7Skin tr, .o2k7Skin div, .o2k7Skin td, .o2k7Skin iframe, .o2k7Skin span, .o2k7Skin *, .o2k7Skin .mceText {border:0; margin:0; padding:0; background:transparent; white-space:nowrap; text-decoration:none; font-weight:normal; cursor:default; color:#000; vertical-align:baseline; width:auto; border-collapse:separate; text-align:left}
+.o2k7Skin a:hover, .o2k7Skin a:link, .o2k7Skin a:visited, .o2k7Skin a:active {text-decoration:none; font-weight:normal; cursor:default; color:#000}
+.o2k7Skin table td {vertical-align:middle}
+
+/* Containers */
+.o2k7Skin table {background:#E5EFFD}
+.o2k7Skin iframe {display:block; background:#FFF}
+.o2k7Skin .mceToolbar {height:26px}
+
+/* External */
+.o2k7Skin .mceExternalToolbar {position:absolute; border:1px solid #ABC6DD; border-bottom:0; display:none}
+.o2k7Skin .mceExternalToolbar td.mceToolbar {padding-right:13px;}
+.o2k7Skin .mceExternalClose {position:absolute; top:3px; right:3px; width:7px; height:7px; background:url(../../img/icons.gif) -820px 0}
+
+/* Layout */
+.o2k7Skin table.mceLayout {border:0; border-left:1px solid #ABC6DD; border-right:1px solid #ABC6DD}
+.o2k7Skin table.mceLayout tr.mceFirst td {border-top:1px solid #ABC6DD}
+.o2k7Skin table.mceLayout tr.mceLast td {border-bottom:1px solid #ABC6DD}
+.o2k7Skin table.mceToolbar, .o2k7Skin tr.mceFirst .mceToolbar tr td, .o2k7Skin tr.mceLast .mceToolbar tr td {border:0; margin:0; padding:0}
+.o2k7Skin .mceIframeContainer {border-top:1px solid #ABC6DD; border-bottom:1px solid #ABC6DD}
+.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}
+.o2k7Skin .mceStatusbar div {float:left; padding:2px}
+.o2k7Skin .mceStatusbar a.mceResize {display:block; float:right; background:url(../../img/icons.gif) -800px 0; width:20px; height:20px; cursor:se-resize; outline:0}
+.o2k7Skin .mceStatusbar a:hover {text-decoration:underline}
+.o2k7Skin table.mceToolbar {margin-left:3px}
+.o2k7Skin .mceToolbar .mceToolbarStart span {display:block; background:url(img/button_bg.png) -22px 0; width:1px; height:22px; margin-left:3px;}
+.o2k7Skin .mceToolbar td.mceFirst span {margin:0}
+.o2k7Skin .mceToolbar .mceToolbarEnd span {display:block; background:url(img/button_bg.png) -22px 0; width:1px; height:22px}
+.o2k7Skin .mceToolbar .mceToolbarEndListBox span, .o2k7Skin .mceToolbar .mceToolbarStartListBox span {display:none}
+.o2k7Skin span.mceIcon, .o2k7Skin img.mceIcon {display:block; width:20px; height:20px}
+.o2k7Skin .mceIcon {background:url(../../img/icons.gif) no-repeat 20px 20px}
+.o2k7Skin td.mceCenter {text-align:center;}
+.o2k7Skin td.mceCenter table {margin:0 auto; text-align:left;}
+.o2k7Skin td.mceRight table {margin:0 0 0 auto;}
+
+/* Button */
+.o2k7Skin .mceButton {display:block; background:url(img/button_bg.png); width:22px; height:22px}
+.o2k7Skin a.mceButton span, .o2k7Skin a.mceButton img {margin-left:1px}
+.o2k7Skin .mceOldBoxModel a.mceButton span, .o2k7Skin .mceOldBoxModel a.mceButton img {margin:0 0 0 1px}
+.o2k7Skin a.mceButtonEnabled:hover {background-color:#B2BBD0; background-position:0 -22px}
+.o2k7Skin a.mceButtonActive, .o2k7Skin a.mceButtonSelected {background-position:0 -44px}
+.o2k7Skin .mceButtonDisabled .mceIcon {opacity:0.3; -ms-filter:'alpha(opacity=30)'; filter:alpha(opacity=30)}
+.o2k7Skin .mceButtonLabeled {width:auto}
+.o2k7Skin .mceButtonLabeled span.mceIcon {float:left}
+.o2k7Skin span.mceButtonLabel {display:block; font-size:10px; padding:4px 6px 0 22px; font-family:Tahoma,Verdana,Arial,Helvetica}
+.o2k7Skin .mceButtonDisabled .mceButtonLabel {color:#888}
+
+/* Separator */
+.o2k7Skin .mceSeparator {display:block; background:url(img/button_bg.png) -22px 0; width:5px; height:22px}
+
+/* ListBox */
+.o2k7Skin .mceListBox {margin-left:3px}
+.o2k7Skin .mceListBox, .o2k7Skin .mceListBox a {display:block}
+.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}
+.o2k7Skin .mceListBox .mceOpen {width:14px; height:22px; background:url(img/button_bg.png) -66px 0}
+.o2k7Skin table.mceListBoxEnabled:hover .mceText, .o2k7Skin .mceListBoxHover .mceText, .o2k7Skin .mceListBoxSelected .mceText {background:#FFF}
+.o2k7Skin table.mceListBoxEnabled:hover .mceOpen, .o2k7Skin .mceListBoxHover .mceOpen, .o2k7Skin .mceListBoxSelected .mceOpen {background-position:-66px -22px}
+.o2k7Skin .mceListBoxDisabled .mceText {color:gray}
+.o2k7Skin .mceListBoxMenu {overflow:auto; overflow-x:hidden}
+.o2k7Skin .mceOldBoxModel .mceListBox .mceText {height:22px}
+.o2k7Skin select.mceListBox {font-family:Tahoma,Verdana,Arial,Helvetica; font-size:12px; border:1px solid #b3c7e1; background:#FFF;}
+
+/* SplitButton */
+.o2k7Skin .mceSplitButton, .o2k7Skin .mceSplitButton a, .o2k7Skin .mceSplitButton span {display:block; height:22px}
+.o2k7Skin .mceSplitButton {background:url(img/button_bg.png)}
+.o2k7Skin .mceSplitButton a.mceAction {width:22px}
+.o2k7Skin .mceSplitButton span.mceAction {width:22px; background-image:url(../../img/icons.gif)}
+.o2k7Skin .mceSplitButton a.mceOpen {width:10px; background:url(img/button_bg.png) -44px 0}
+.o2k7Skin .mceSplitButton span.mceOpen {display:none}
+.o2k7Skin table.mceSplitButtonEnabled:hover a.mceAction, .o2k7Skin .mceSplitButtonHover a.mceAction, .o2k7Skin .mceSplitButtonSelected {background:url(img/button_bg.png) 0 -22px}
+.o2k7Skin table.mceSplitButtonEnabled:hover a.mceOpen, .o2k7Skin .mceSplitButtonHover a.mceOpen, .o2k7Skin .mceSplitButtonSelected a.mceOpen {background-position:-44px -44px}
+.o2k7Skin .mceSplitButtonDisabled .mceAction {opacity:0.3; -ms-filter:'alpha(opacity=30)'; filter:alpha(opacity=30)}
+.o2k7Skin .mceSplitButtonActive {background-position:0 -44px}
+
+/* ColorSplitButton */
+.o2k7Skin div.mceColorSplitMenu table {background:#FFF; border:1px solid gray}
+.o2k7Skin .mceColorSplitMenu td {padding:2px}
+.o2k7Skin .mceColorSplitMenu a {display:block; width:9px; height:9px; overflow:hidden; border:1px solid #808080}
+.o2k7Skin .mceColorSplitMenu td.mceMoreColors {padding:1px 3px 1px 1px}
+.o2k7Skin .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}
+.o2k7Skin .mceColorSplitMenu a.mceMoreColors:hover {border:1px solid #0A246A; background-color:#B6BDD2}
+.o2k7Skin a.mceMoreColors:hover {border:1px solid #0A246A}
+.o2k7Skin .mceColorPreview {margin-left:2px; width:16px; height:4px; overflow:hidden; background:#9a9b9a;overflow:hidden}
+.o2k7Skin .mce_forecolor span.mceAction, .o2k7Skin .mce_backcolor span.mceAction {height:15px;overflow:hidden}
+
+/* Menu */
+.o2k7Skin .mceMenu {position:absolute; left:0; top:0; z-index:1000; border:1px solid #ABC6DD}
+.o2k7Skin .mceNoIcons span.mceIcon {width:0;}
+.o2k7Skin .mceNoIcons a .mceText {padding-left:10px}
+.o2k7Skin .mceMenu table {background:#FFF}
+.o2k7Skin .mceMenu a, .o2k7Skin .mceMenu span, .o2k7Skin .mceMenu {display:block}
+.o2k7Skin .mceMenu td {height:20px}
+.o2k7Skin .mceMenu a {position:relative;padding:3px 0 4px 0}
+.o2k7Skin .mceMenu .mceText {position:relative; display:block; font-family:Tahoma,Verdana,Arial,Helvetica; color:#000; cursor:default; margin:0; padding:0 25px 0 25px; display:block}
+.o2k7Skin .mceMenu span.mceText, .o2k7Skin .mceMenu .mcePreview {font-size:11px}
+.o2k7Skin .mceMenu pre.mceText {font-family:Monospace}
+.o2k7Skin .mceMenu .mceIcon {position:absolute; top:0; left:0; width:22px;}
+.o2k7Skin .mceMenu .mceMenuItemEnabled a:hover, .o2k7Skin .mceMenu .mceMenuItemActive {background-color:#dbecf3}
+.o2k7Skin td.mceMenuItemSeparator {background:#DDD; height:1px}
+.o2k7Skin .mceMenuItemTitle a {border:0; background:#E5EFFD; border-bottom:1px solid #ABC6DD}
+.o2k7Skin .mceMenuItemTitle span.mceText {color:#000; font-weight:bold; padding-left:4px}
+.o2k7Skin .mceMenuItemDisabled .mceText {color:#888}
+.o2k7Skin .mceMenuItemSelected .mceIcon {background:url(../default/img/menu_check.gif)}
+.o2k7Skin .mceNoIcons .mceMenuItemSelected a {background:url(../default/img/menu_arrow.gif) no-repeat -6px center}
+.o2k7Skin .mceMenu span.mceMenuLine {display:none}
+.o2k7Skin .mceMenuItemSub a {background:url(../default/img/menu_arrow.gif) no-repeat top right;}
+
+/* Progress,Resize */
+.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}
+.o2k7Skin .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}
+
+/* Formats */
+.o2k7Skin .mce_formatPreview a {font-size:10px}
+.o2k7Skin .mce_p span.mceText {}
+.o2k7Skin .mce_address span.mceText {font-style:italic}
+.o2k7Skin .mce_pre span.mceText {font-family:monospace}
+.o2k7Skin .mce_h1 span.mceText {font-weight:bolder; font-size: 2em}
+.o2k7Skin .mce_h2 span.mceText {font-weight:bolder; font-size: 1.5em}
+.o2k7Skin .mce_h3 span.mceText {font-weight:bolder; font-size: 1.17em}
+.o2k7Skin .mce_h4 span.mceText {font-weight:bolder; font-size: 1em}
+.o2k7Skin .mce_h5 span.mceText {font-weight:bolder; font-size: .83em}
+.o2k7Skin .mce_h6 span.mceText {font-weight:bolder; font-size: .75em}
+
+/* Theme */
+.o2k7Skin span.mce_bold {background-position:0 0}
+.o2k7Skin span.mce_italic {background-position:-60px 0}
+.o2k7Skin span.mce_underline {background-position:-140px 0}
+.o2k7Skin span.mce_strikethrough {background-position:-120px 0}
+.o2k7Skin span.mce_undo {background-position:-160px 0}
+.o2k7Skin span.mce_redo {background-position:-100px 0}
+.o2k7Skin span.mce_cleanup {background-position:-40px 0}
+.o2k7Skin span.mce_bullist {background-position:-20px 0}
+.o2k7Skin span.mce_numlist {background-position:-80px 0}
+.o2k7Skin span.mce_justifyleft {background-position:-460px 0}
+.o2k7Skin span.mce_justifyright {background-position:-480px 0}
+.o2k7Skin span.mce_justifycenter {background-position:-420px 0}
+.o2k7Skin span.mce_justifyfull {background-position:-440px 0}
+.o2k7Skin span.mce_anchor {background-position:-200px 0}
+.o2k7Skin span.mce_indent {background-position:-400px 0}
+.o2k7Skin span.mce_outdent {background-position:-540px 0}
+.o2k7Skin span.mce_link {background-position:-500px 0}
+.o2k7Skin span.mce_unlink {background-position:-640px 0}
+.o2k7Skin span.mce_sub {background-position:-600px 0}
+.o2k7Skin span.mce_sup {background-position:-620px 0}
+.o2k7Skin span.mce_removeformat {background-position:-580px 0}
+.o2k7Skin span.mce_newdocument {background-position:-520px 0}
+.o2k7Skin span.mce_image {background-position:-380px 0}
+.o2k7Skin span.mce_help {background-position:-340px 0}
+.o2k7Skin span.mce_code {background-position:-260px 0}
+.o2k7Skin span.mce_hr {background-position:-360px 0}
+.o2k7Skin span.mce_visualaid {background-position:-660px 0}
+.o2k7Skin span.mce_charmap {background-position:-240px 0}
+.o2k7Skin span.mce_paste {background-position:-560px 0}
+.o2k7Skin span.mce_copy {background-position:-700px 0}
+.o2k7Skin span.mce_cut {background-position:-680px 0}
+.o2k7Skin span.mce_blockquote {background-position:-220px 0}
+.o2k7Skin .mce_forecolor span.mceAction {background-position:-720px 0}
+.o2k7Skin .mce_backcolor span.mceAction {background-position:-760px 0}
+.o2k7Skin span.mce_forecolorpicker {background-position:-720px 0}
+.o2k7Skin span.mce_backcolorpicker {background-position:-760px 0}
+
+/* Plugins */
+.o2k7Skin span.mce_advhr {background-position:-0px -20px}
+.o2k7Skin span.mce_ltr {background-position:-20px -20px}
+.o2k7Skin span.mce_rtl {background-position:-40px -20px}
+.o2k7Skin span.mce_emotions {background-position:-60px -20px}
+.o2k7Skin span.mce_fullpage {background-position:-80px -20px}
+.o2k7Skin span.mce_fullscreen {background-position:-100px -20px}
+.o2k7Skin span.mce_iespell {background-position:-120px -20px}
+.o2k7Skin span.mce_insertdate {background-position:-140px -20px}
+.o2k7Skin span.mce_inserttime {background-position:-160px -20px}
+.o2k7Skin span.mce_absolute {background-position:-180px -20px}
+.o2k7Skin span.mce_backward {background-position:-200px -20px}
+.o2k7Skin span.mce_forward {background-position:-220px -20px}
+.o2k7Skin span.mce_insert_layer {background-position:-240px -20px}
+.o2k7Skin span.mce_insertlayer {background-position:-260px -20px}
+.o2k7Skin span.mce_movebackward {background-position:-280px -20px}
+.o2k7Skin span.mce_moveforward {background-position:-300px -20px}
+.o2k7Skin span.mce_media {background-position:-320px -20px}
+.o2k7Skin span.mce_nonbreaking {background-position:-340px -20px}
+.o2k7Skin span.mce_pastetext {background-position:-360px -20px}
+.o2k7Skin span.mce_pasteword {background-position:-380px -20px}
+.o2k7Skin span.mce_selectall {background-position:-400px -20px}
+.o2k7Skin span.mce_preview {background-position:-420px -20px}
+.o2k7Skin span.mce_print {background-position:-440px -20px}
+.o2k7Skin span.mce_cancel {background-position:-460px -20px}
+.o2k7Skin span.mce_save {background-position:-480px -20px}
+.o2k7Skin span.mce_replace {background-position:-500px -20px}
+.o2k7Skin span.mce_search {background-position:-520px -20px}
+.o2k7Skin span.mce_styleprops {background-position:-560px -20px}
+.o2k7Skin span.mce_table {background-position:-580px -20px}
+.o2k7Skin span.mce_cell_props {background-position:-600px -20px}
+.o2k7Skin span.mce_delete_table {background-position:-620px -20px}
+.o2k7Skin span.mce_delete_col {background-position:-640px -20px}
+.o2k7Skin span.mce_delete_row {background-position:-660px -20px}
+.o2k7Skin span.mce_col_after {background-position:-680px -20px}
+.o2k7Skin span.mce_col_before {background-position:-700px -20px}
+.o2k7Skin span.mce_row_after {background-position:-720px -20px}
+.o2k7Skin span.mce_row_before {background-position:-740px -20px}
+.o2k7Skin span.mce_merge_cells {background-position:-760px -20px}
+.o2k7Skin span.mce_table_props {background-position:-980px -20px}
+.o2k7Skin span.mce_row_props {background-position:-780px -20px}
+.o2k7Skin span.mce_split_cells {background-position:-800px -20px}
+.o2k7Skin span.mce_template {background-position:-820px -20px}
+.o2k7Skin span.mce_visualchars {background-position:-840px -20px}
+.o2k7Skin span.mce_abbr {background-position:-860px -20px}
+.o2k7Skin span.mce_acronym {background-position:-880px -20px}
+.o2k7Skin span.mce_attribs {background-position:-900px -20px}
+.o2k7Skin span.mce_cite {background-position:-920px -20px}
+.o2k7Skin span.mce_del {background-position:-940px -20px}
+.o2k7Skin span.mce_ins {background-position:-960px -20px}
+.o2k7Skin span.mce_pagebreak {background-position:0 -40px}
+.o2k7Skin span.mce_restoredraft {background-position:-20px -40px}
+.o2k7Skin span.mce_spellchecker {background-position:-540px -20px}

Added: plog/branches/lifetype-1.2/js/tinymce/themes/advanced/skins/o2k7/ui_black.css
===================================================================
--- plog/branches/lifetype-1.2/js/tinymce/themes/advanced/skins/o2k7/ui_black.css	                        (rev 0)
+++ plog/branches/lifetype-1.2/js/tinymce/themes/advanced/skins/o2k7/ui_black.css	2010-09-21 23:00:22 UTC (rev 7027)
@@ -0,0 +1,8 @@
+/* Black */
+.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)}
+.o2k7SkinBlack table, .o2k7SkinBlack .mceMenuItemTitle a, .o2k7SkinBlack .mceMenuItemTitle span.mceText, .o2k7SkinBlack .mceStatusbar div, .o2k7SkinBlack .mceStatusbar span, .o2k7SkinBlack .mceStatusbar a {background:#535353; color:#FFF}
+.o2k7SkinBlack table.mceListBoxEnabled .mceText, o2k7SkinBlack .mceListBox .mceText {background:#FFF; border:1px solid #CBCFD4; border-bottom-color:#989FA9; border-right:0}
+.o2k7SkinBlack table.mceListBoxEnabled:hover .mceText, .o2k7SkinBlack .mceListBoxHover .mceText, .o2k7SkinBlack .mceListBoxSelected .mceText {background:#FFF; border:1px solid #FFBD69; border-right:0}
+.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;}
+.o2k7SkinBlack table.mceSplitButtonEnabled:hover a.mceAction, .o2k7SkinBlack .mceSplitButtonHover a.mceAction, .o2k7SkinBlack .mceSplitButtonSelected {background-image:url(img/button_bg_black.png)}
+.o2k7SkinBlack .mceMenu .mceMenuItemEnabled a:hover, .o2k7SkinBlack .mceMenu .mceMenuItemActive {background-color:#FFE7A1}
\ No newline at end of file

Added: plog/branches/lifetype-1.2/js/tinymce/themes/advanced/skins/o2k7/ui_silver.css
===================================================================
--- plog/branches/lifetype-1.2/js/tinymce/themes/advanced/skins/o2k7/ui_silver.css	                        (rev 0)
+++ plog/branches/lifetype-1.2/js/tinymce/themes/advanced/skins/o2k7/ui_silver.css	2010-09-21 23:00:22 UTC (rev 7027)
@@ -0,0 +1,5 @@
+/* Silver */
+.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)}
+.o2k7SkinSilver table, .o2k7SkinSilver .mceMenuItemTitle a {background:#eee}
+.o2k7SkinSilver .mceListBox .mceText {background:#FFF}
+.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}

Modified: plog/branches/lifetype-1.2/js/tinymce/themes/advanced/source_editor.htm
===================================================================
--- plog/branches/lifetype-1.2/js/tinymce/themes/advanced/source_editor.htm	2010-09-21 21:29:55 UTC (rev 7026)
+++ plog/branches/lifetype-1.2/js/tinymce/themes/advanced/source_editor.htm	2010-09-21 23:00:22 UTC (rev 7027)
@@ -1,31 +1,24 @@
 <html xmlns="http://www.w3.org/1999/xhtml">
 <head>
-	<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
-	<title>{$lang_theme_code_title}</title>
-	<script language="javascript" type="text/javascript" src="../../tiny_mce_popup.js"></script>
-	<script language="javascript" type="text/javascript" src="jscripts/source_editor.js"></script>
-	<base target="_self" />
+	<title>{#advanced_dlg.code_title}</title>
+	<script type="text/javascript" src="../../tiny_mce_popup.js"></script>
+	<script type="text/javascript" src="js/source_editor.js"></script>
 </head>
-<body onload="tinyMCEPopup.executeOnLoad('onLoadInit();');" onresize="resizeInputs();" style="display: none">
-	<form name="source" onsubmit="saveContent();" action="#">
-		<div style="float: left" class="title">{$lang_theme_code_title}</div>
+<body onresize="resizeInputs();" style="display:none; overflow:hidden;">
+	<form name="source" onsubmit="saveContent();return false;" action="#">
+		<div style="float: left" class="title">{#advanced_dlg.code_title}</div>
 
 		<div id="wrapline" style="float: right">
-			<input type="checkbox" name="wraped" id="wraped" onclick="toggleWordWrap(this);" class="wordWrapCode" /><label for="wraped">{$lang_theme_code_wordwrap}</label>
+			<input type="checkbox" name="wraped" id="wraped" onclick="toggleWordWrap(this);" class="wordWrapCode" /><label for="wraped">{#advanced_dlg.code_wordwrap}</label>
 		</div>
 
 		<br style="clear: both" />
 
-		<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"></textarea>
+		<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>
 
 		<div class="mceActionPanel">
-			<div style="float: left">
-				<input type="button" name="insert" value="{$lang_update}" onclick="saveContent();" id="insert" />
-			</div>
-
-			<div style="float: right">
-				<input type="button" name="cancel" value="{$lang_cancel}" onclick="tinyMCEPopup.close();" id="cancel" />
-			</div>
+			<input type="submit" name="insert" value="{#update}" id="insert" />
+			<input type="button" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" id="cancel" />
 		</div>
 	</form>
 </body>

Modified: plog/branches/lifetype-1.2/js/tinymce/tiny_mce-plog.js
===================================================================
--- plog/branches/lifetype-1.2/js/tinymce/tiny_mce-plog.js	2010-09-21 21:29:55 UTC (rev 7026)
+++ plog/branches/lifetype-1.2/js/tinymce/tiny_mce-plog.js	2010-09-21 23:00:22 UTC (rev 7027)
@@ -1,282 +1,27 @@
+tinyMCE_GZ.init({
+            // user-defined plugins and themes should be identical to those in "tinyMCE.init" below.-->
+      plugins : "pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,wordcount,advlist,autosave",
+      themes : 'advanced',
+      languages : 'en',
+      disk_cache : false,
+      debug : false
+});
+
+
 tinyMCE.init({
-	mode : "exact",
-	elements : "postText,postExtendedText",
-	theme : "advanced",
-	plugins : "fullscreen,table,inlinepopups,insertdatetime,emotions,insertresource,insertvideo,insertaudio,more",
-	relative_urls : false,
-    fix_list_elements : true,
-	remove_script_host : false,
-	force_p_newlines : true,
-    hide_selects_on_submit: false,
-	cleanup_on_startup : true,	
-    theme_advanced_buttons1: "fontsizeselect,fontselect,forecolor,backcolor,bold,italic,underline,strikethrough,separator,justifyleft,justifycenter,justifyright,justifyfull,separator,cleanup,removeformat",
-    theme_advanced_buttons2: "bullist,numlist,indent,outdent,separator,undo,redo,separator,link,unlink,image,insertresource,insertvideo,insertaudio,emotions,separator,hr,charmap,insertdate,inserttime,separator,fullscreen,separator,code,more",
-    theme_advanced_buttons3: "",
-	theme_advanced_toolbar_location : "top",
-	theme_advanced_toolbar_align : "left",
-	theme_advanced_path_location : "bottom",
-	theme_advanced_resizing : true,
-	theme_advanced_resize_horizontal : false,
-	convert_fonts_to_spans: true,
-    remove_linebreaks: false,
-	extended_valid_elements : "a[class|name|id|href|target|title|onclick|rel],img[class|src|border|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name],hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style]",
-	verify_html : true,
-	apply_source_formatting : true,
-	valid_elements : ""
-	+"a[accesskey|charset|class|coords|dir<ltr?rtl|href|hreflang|id|lang|name"
-	  +"|onblur|onclick|ondblclick|onfocus|onkeydown|onkeypress|onkeyup"
-	  +"|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|rel|rev"
-	  +"|shape<circle?default?poly?rect|style|tabindex|title|target|type],"
-	+"abbr[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress"
-	  +"|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style"
-	  +"|title],"
-	+"acronym[class|dir<ltr?rtl|id|id|lang|onclick|ondblclick|onkeydown|onkeypress"
-	  +"|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style"
-	  +"|title],"
-	+"address[class|align|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown"
-	  +"|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover"
-	  +"|onmouseup|style|title],"
-	+"applet[align<bottom?left?middle?right?top|alt|archive|class|code|codebase"
-	  +"|height|hspace|id|name|object|style|title|vspace|width],"
-	+"area[accesskey|alt|class|coords|dir<ltr?rtl|href|id|lang|nohref<nohref"
-	  +"|onblur|onclick|ondblclick|onfocus|onkeydown|onkeypress|onkeyup"
-	  +"|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup"
-	  +"|shape<circle?default?poly?rect|style|tabindex|title|target],"
-	+"base[href|target],"
-	+"basefont[color|face|id|size],"
-	+"bdo[class|dir<ltr?rtl|id|lang|style|title],"
-	+"big[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress"
-	  +"|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style"
-	  +"|title],"
-	+"blockquote[dir|style|cite|class|dir<ltr?rtl|id|lang|onclick|ondblclick"
-	  +"|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout"
-	  +"|onmouseover|onmouseup|style|title],"
-	+"body[alink|background|bgcolor|class|dir<ltr?rtl|id|lang|link|onclick"
-	  +"|ondblclick|onkeydown|onkeypress|onkeyup|onload|onmousedown|onmousemove"
-	  +"|onmouseout|onmouseover|onmouseup|onunload|style|title|text|vlink],"
-	+"br[class|clear<all?left?none?right|id|style|title],"
-	+"button[accesskey|class|dir<ltr?rtl|disabled<disabled|id|lang|name|onblur"
-	  +"|onclick|ondblclick|onfocus|onkeydown|onkeypress|onkeyup|onmousedown"
-	  +"|onmousemove|onmouseout|onmouseover|onmouseup|style|tabindex|title|type"
-	  +"|value],"
-	+"caption[align<bottom?left?right?top|class|dir<ltr?rtl|id|lang|onclick"
-	  +"|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove"
-	  +"|onmouseout|onmouseover|onmouseup|style|title],"
-	+"center[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress"
-	  +"|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style"
-	  +"|title],"
-	+"cite[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress"
-	  +"|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style"
-	  +"|title],"
-	+"code[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress"
-	  +"|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style"
-	  +"|title],"
-	+"col[align<center?char?justify?left?right|char|charoff|class|dir<ltr?rtl|id"
-	  +"|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown"
-	  +"|onmousemove|onmouseout|onmouseover|onmouseup|span|style|title"
-	  +"|valign<baseline?bottom?middle?top|width],"
-	+"colgroup[align<center?char?justify?left?right|char|charoff|class|dir<ltr?rtl"
-	  +"|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown"
-	  +"|onmousemove|onmouseout|onmouseover|onmouseup|span|style|title"
-	  +"|valign<baseline?bottom?middle?top|width],"
-	+"dd[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup"
-	  +"|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],"
-	+"del[cite|class|datetime|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown"
-	  +"|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover"
-	  +"|onmouseup|style|title],"
-	+"dfn[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress"
-	  +"|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style"
-	  +"|title],"
-	+"dir[class|compact<compact|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown"
-	  +"|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover"
-	  +"|onmouseup|style|title],"
-	+"div[align<center?justify?left?right|class|dir<ltr?rtl|id|lang|onclick"
-	  +"|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove"
-	  +"|onmouseout|onmouseover|onmouseup|style|title],"
-	+"dl[class|compact<compact|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown"
-	  +"|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover"
-	  +"|onmouseup|style|title],"
-	+"dt[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup"
-	  +"|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],"
-	+"em/i[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress"
-	  +"|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style"
-	  +"|title],"
-	+"fieldset[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress"
-	  +"|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style"
-	  +"|title],"
-	+"font[class|color|dir<ltr?rtl|face|id|lang|size|style|title],"
-	+"form[accept|accept-charset|action|class|dir<ltr?rtl|enctype|id|lang"
-	  +"|method<get?post|name|onclick|ondblclick|onkeydown|onkeypress|onkeyup"
-	  +"|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|onreset|onsubmit"
-	  +"|style|title|target],"
-	+"frame[class|frameborder|id|longdesc|marginheight|marginwidth|name"
-	  +"|noresize<noresize|scrolling<auto?no?yes|src|style|title],"
-	+"frameset[class|cols|id|onload|onunload|rows|style|title],"
-	+"h1[align<center?justify?left?right|class|dir<ltr?rtl|id|lang|onclick"
-	  +"|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove"
-	  +"|onmouseout|onmouseover|onmouseup|style|title],"
-	+"h2[align<center?justify?left?right|class|dir<ltr?rtl|id|lang|onclick"
-	  +"|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove"
-	  +"|onmouseout|onmouseover|onmouseup|style|title],"
-	+"h3[align<center?justify?left?right|class|dir<ltr?rtl|id|lang|onclick"
-	  +"|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove"
-	  +"|onmouseout|onmouseover|onmouseup|style|title],"
-	+"h4[align<center?justify?left?right|class|dir<ltr?rtl|id|lang|onclick"
-	  +"|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove"
-	  +"|onmouseout|onmouseover|onmouseup|style|title],"
-	+"h5[align<center?justify?left?right|class|dir<ltr?rtl|id|lang|onclick"
-	  +"|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove"
-	  +"|onmouseout|onmouseover|onmouseup|style|title],"
-	+"h6[align<center?justify?left?right|class|dir<ltr?rtl|id|lang|onclick"
-	  +"|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove"
-	  +"|onmouseout|onmouseover|onmouseup|style|title],"
-	+"head[dir<ltr?rtl|lang|profile],"
-	+"hr[align<center?left?right|class|dir<ltr?rtl|id|lang|noshade<noshade|onclick"
-	  +"|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove"
-	  +"|onmouseout|onmouseover|onmouseup|size|style|title|width],"
-	+"html[dir<ltr?rtl|lang|version],"
-	+"iframe[align<bottom?left?middle?right?top|class|frameborder|height|id"
-	  +"|longdesc|marginheight|marginwidth|name|scrolling<auto?no?yes|src|style"
-	  +"|title|width],"
-	+"img[align<bottom?left?middle?right?top|alt|border|class|dir<ltr?rtl|height"
-	  +"|hspace|id|ismap<ismap|lang|longdesc|name|onclick|ondblclick|onkeydown"
-	  +"|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover"
-	  +"|onmouseup|src|style|title|usemap|vspace|width],"
-	+"input[accept|accesskey|align<bottom?left?middle?right?top|alt"
-	  +"|checked<checked|class|dir<ltr?rtl|disabled<disabled|id|ismap<ismap|lang"
-	  +"|maxlength|name|onblur|onclick|ondblclick|onfocus|onkeydown|onkeypress"
-	  +"|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|onselect"
-	  +"|readonly<readonly|size|src|style|tabindex|title"
-	  +"|type<button?checkbox?file?hidden?image?password?radio?reset?submit?text"
-	  +"|usemap|value],"
-	+"ins[cite|class|datetime|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown"
-	  +"|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover"
-	  +"|onmouseup|style|title],"
-	+"isindex[class|dir<ltr?rtl|id|lang|prompt|style|title],"
-	+"kbd[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress"
-	  +"|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style"
-	  +"|title],"
-	+"label[accesskey|class|dir<ltr?rtl|for|id|lang|onblur|onclick|ondblclick"
-	  +"|onfocus|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout"
-	  +"|onmouseover|onmouseup|style|title],"
-	+"legend[align<bottom?left?right?top|accesskey|class|dir<ltr?rtl|id|lang"
-	  +"|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove"
-	  +"|onmouseout|onmouseover|onmouseup|style|title],"
-	+"li[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup"
-	  +"|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title|type"
-	  +"|value],"
-	+"link[charset|class|dir<ltr?rtl|href|hreflang|id|lang|media|onclick"
-	  +"|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove"
-	  +"|onmouseout|onmouseover|onmouseup|rel|rev|style|title|target|type],"
-	+"map[class|dir<ltr?rtl|id|lang|name|onclick|ondblclick|onkeydown|onkeypress"
-	  +"|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style"
-	  +"|title],"
-	+"menu[class|compact<compact|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown"
-	  +"|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover"
-	  +"|onmouseup|style|title],"
-	+"meta[content|dir<ltr?rtl|http-equiv|lang|name|scheme],"
-	+"noframes[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress"
-	  +"|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style"
-	  +"|title],"
-	+"noscript[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress"
-	  +"|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style"
-	  +"|title],"
-	+"object[align<bottom?left?middle?right?top|archive|border|class|classid"
-	  +"|codebase|codetype|data|declare|dir<ltr?rtl|height|hspace|id|lang|name"
-	  +"|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove"
-	  +"|onmouseout|onmouseover|onmouseup|standby|style|tabindex|title|type|usemap"
-	  +"|vspace|width|flashvars|data],"
-	+"ol[class|compact<compact|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown"
-	  +"|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover"
-	  +"|onmouseup|start|style|title|type],"
-	+"optgroup[class|dir<ltr?rtl|disabled<disabled|id|label|lang|onclick"
-	  +"|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove"
-	  +"|onmouseout|onmouseover|onmouseup|style|title],"
-	+"option[class|dir<ltr?rtl|disabled<disabled|id|label|lang|onclick|ondblclick"
-	  +"|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout"
-	  +"|onmouseover|onmouseup|selected<selected|style|title|value],"
-	+"p[align<center?justify?left?right|class|dir<ltr?rtl|id|lang|onclick"
-	  +"|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove"
-	  +"|onmouseout|onmouseover|onmouseup|style|title],"
-	+"param[id|name|type|value|valuetype<DATA?OBJECT?REF],"
-	+"pre/listing/plaintext/xmp[align|class|dir<ltr?rtl|id|lang|onclick|ondblclick"
-	  +"|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout"
-	  +"|onmouseover|onmouseup|style|title|width],"
-	+"q[cite|class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress"
-	  +"|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style"
-	  +"|title],"
-	+"s[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup"
-	  +"|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],"
-	+"samp[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress"
-	  +"|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style"
-	  +"|title],"
-	+"script[charset|defer|language|src|type],"
-	+"select[class|dir<ltr?rtl|disabled<disabled|id|lang|multiple<multiple|name"
-	  +"|onblur|onclick|ondblclick|onfocus|onkeydown|onkeypress|onkeyup"
-	  +"|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|size|style"
-	  +"|tabindex|title],"
-	+"small[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress"
-	  +"|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style"
-	  +"|title],"
-	+"span[align|class|class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown"
-	  +"|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover"
-	  +"|onmouseup|style|title],"
-	+"strike[class|class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown"
-	  +"|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover"
-	  +"|onmouseup|style|title],"
-	+"strong/b[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress"
-	  +"|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style"
-	  +"|title],"
-	+"style[dir<ltr?rtl|lang|media|title|type],"
-	+"sub[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress"
-	  +"|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style"
-	  +"|title],"
-	+"sup[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress"
-	  +"|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style"
-	  +"|title],"
-	+"table[align<center?left?right|bgcolor|border|cellpadding|cellspacing|class"
-	  +"|dir<ltr?rtl|frame|height|id|lang|onclick|ondblclick|onkeydown|onkeypress"
-	  +"|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|rules"
-	  +"|style|summary|title|width],"
-	+"tbody[align<center?char?justify?left?right|char|class|charoff|dir<ltr?rtl|id"
-	  +"|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown"
-	  +"|onmousemove|onmouseout|onmouseover|onmouseup|style|title"
-	  +"|valign<baseline?bottom?middle?top],"
-	+"td[abbr|align<center?char?justify?left?right|axis|bgcolor|char|charoff|class"
-	  +"|colspan|dir<ltr?rtl|headers|height|id|lang|nowrap<nowrap|onclick"
-	  +"|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove"
-	  +"|onmouseout|onmouseover|onmouseup|rowspan|scope<col?colgroup?row?rowgroup"
-	  +"|style|title|valign<baseline?bottom?middle?top|width],"
-	+"textarea[accesskey|class|cols|dir<ltr?rtl|disabled<disabled|id|lang|name"
-	  +"|onblur|onclick|ondblclick|onfocus|onkeydown|onkeypress|onkeyup"
-	  +"|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|onselect"
-	  +"|readonly<readonly|rows|style|tabindex|title],"
-	+"tfoot[align<center?char?justify?left?right|char|charoff|class|dir<ltr?rtl|id"
-	  +"|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown"
-	  +"|onmousemove|onmouseout|onmouseover|onmouseup|style|title"
-	  +"|valign<baseline?bottom?middle?top],"
-	+"th[abbr|align<center?char?justify?left?right|axis|bgcolor|char|charoff|class"
-	  +"|colspan|dir<ltr?rtl|headers|height|id|lang|nowrap<nowrap|onclick"
-	  +"|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown|onmousemove"
-	  +"|onmouseout|onmouseover|onmouseup|rowspan|scope<col?colgroup?row?rowgroup"
-	  +"|style|title|valign<baseline?bottom?middle?top|width],"
-	+"thead[align<center?char?justify?left?right|char|charoff|class|dir<ltr?rtl|id"
-	  +"|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup|onmousedown"
-	  +"|onmousemove|onmouseout|onmouseover|onmouseup|style|title"
-	  +"|valign<baseline?bottom?middle?top],"
-	+"title[dir<ltr?rtl|lang],"
-	+"tr[abbr|align<center?char?justify?left?right|bgcolor|char|charoff|class"
-	  +"|rowspan|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress"
-	  +"|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style"
-	  +"|title|valign<baseline?bottom?middle?top],"
-	+"tt[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup"
-	  +"|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],"
-	+"u[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress|onkeyup"
-	  +"|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style|title],"
-	+"ul[class|compact<compact|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown"
-	  +"|onkeypress|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover"
-	  +"|onmouseup|style|title|type],"
-	+"var[class|dir<ltr?rtl|id|lang|onclick|ondblclick|onkeydown|onkeypress"
-	  +"|onkeyup|onmousedown|onmousemove|onmouseout|onmouseover|onmouseup|style"
-	  +"|title]"	
+            // General options
+            mode : "exact",
+            elements : "postText,postExtendedText",
+            theme : "advanced",
+            plugins : "pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,wordcount,advlist,autosave",
+            
+                // Theme options
+            theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect,fontselect,fontsizeselect",
+            theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",
+            theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen",
+            theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,pagebreak,restoredraft",
+            theme_advanced_toolbar_location : "top",
+            theme_advanced_toolbar_align : "left",
+            theme_advanced_statusbar_location : "bottom",
+            theme_advanced_resizing : true,
 });

Modified: plog/branches/lifetype-1.2/js/tinymce/tiny_mce.js
===================================================================
--- plog/branches/lifetype-1.2/js/tinymce/tiny_mce.js	2010-09-21 21:29:55 UTC (rev 7026)
+++ plog/branches/lifetype-1.2/js/tinymce/tiny_mce.js	2010-09-21 23:00:22 UTC (rev 7027)
@@ -1 +1 @@
-function TinyMCE_Engine(){var ua;this.majorVersion="2";this.minorVersion="1.3";this.releaseDate="2007-11-27";this.instances=[];this.switchClassCache=[];this.windowArgs=[];this.loadedFiles=[];this.pendingFiles=[];this.loadingIndex=0;this.configs=[];this.currentConfig=0;this.eventHandlers=[];this.log=[];this.undoLevels=[];this.undoIndex=0;this.typingUndoIndex=-1;this.settings=[];ua=navigator.userAgent;this.isMSIE=(navigator.appName=="Microsoft Internet Explorer");this.isMSIE5=this.isMSIE&&(ua.indexOf('MSIE 5')!=-1);this.isMSIE5_0=this.isMSIE&&(ua.indexOf('MSIE 5.0')!=-1);this.isMSIE7=this.isMSIE&&(ua.indexOf('MSIE 7')!=-1);this.isGecko=ua.indexOf('Gecko')!=-1;this.isSafari=ua.indexOf('Safari')!=-1;this.isOpera=window['opera']&&opera.buildNumber?true:false;this.isMac=ua.indexOf('Mac')!=-1;this.isNS7=ua.indexOf('Netscape/7')!=-1;this.isNS71=ua.indexOf('Netscape/7.1')!=-1;this.dialogCounter=0;this.plugins=[];this.themes=[];this.menus=[];this.loadedPlugins=[];this.buttonMap=[];thi
 s.isLoaded=false;if(this.isOpera){this.isMSIE=true;this.isGecko=false;this.isSafari=false}this.isIE=this.isMSIE;this.isRealIE=this.isMSIE&&!this.isOpera;this.idCounter=0};TinyMCE_Engine.prototype={init:function(settings){var theme,nl,baseHREF="",i,cssPath,entities,h,p,src,elements=[],head;if(this.isMSIE5_0)return;this.settings=settings;if(typeof(document.execCommand)=='undefined')return;if(!tinyMCE.baseURL){head=document.getElementsByTagName('head')[0];if(head){for(i=0,nl=head.getElementsByTagName('script');i<nl.length;i++)elements.push(nl[i])}for(i=0,nl=document.getElementsByTagName('script');i<nl.length;i++)elements.push(nl[i]);nl=document.getElementsByTagName('base');for(i=0;i<nl.length;i++){if(nl[i].href)baseHREF=nl[i].href}for(i=0;i<elements.length;i++){if(elements[i].src&&(elements[i].src.indexOf("tiny_mce.js")!=-1||elements[i].src.indexOf("tiny_mce_dev.js")!=-1||elements[i].src.indexOf("tiny_mce_src.js")!=-1||elements[i].src.indexOf("tiny_mce_gzip")!=-1)){src=elements
 [i].src;tinyMCE.srcMode=(src.indexOf('_src')!=-1||src.indexOf('_dev')!=-1)?'_src':'';tinyMCE.gzipMode=src.indexOf('_gzip')!=-1;src=src.substring(0,src.lastIndexOf('/'));if(settings.exec_mode=="src"||settings.exec_mode=="normal")tinyMCE.srcMode=settings.exec_mode=="src"?'_src':'';if(baseHREF!==''&&src.indexOf('://')==-1)tinyMCE.baseURL=baseHREF+src;else tinyMCE.baseURL=src;break}}}this.documentBasePath=document.location.href;if(this.documentBasePath.indexOf('?')!=-1)this.documentBasePath=this.documentBasePath.substring(0,this.documentBasePath.indexOf('?'));this.documentURL=this.documentBasePath;this.documentBasePath=this.documentBasePath.substring(0,this.documentBasePath.lastIndexOf('/'));if(tinyMCE.baseURL.indexOf('://')==-1&&tinyMCE.baseURL.charAt(0)!='/'){tinyMCE.baseURL=this.documentBasePath+"/"+tinyMCE.baseURL}this._def("mode","none");this._def("theme","advanced");this._def("plugins","",true);this._def("language","en");this._def("docs_language",this.settings.language);th
 is._def("elements","");this._def("textarea_trigger","mce_editable");this._def("editor_selector","");this._def("editor_deselector","mceNoEditor");this._def("valid_elements","+a[id|style|rel|rev|charset|hreflang|dir|lang|tabindex|accesskey|type|name|href|target|title|class|onfocus|onblur|onclick|ondblclick|onmousedown|onmouseup|onmouseover|onmousemove|onmouseout|onkeypress|onkeydown|onkeyup],-strong/-b[class|style],-em/-i[class|style],-strike[class|style],-u[class|style],#p[id|style|dir|class|align],-ol[class|style],-ul[class|style],-li[class|style],br,img[id|dir|lang|longdesc|usemap|style|class|src|onmouseover|onmouseout|border|alt=|title|hspace|vspace|width|height|align],-sub[style|class],-sup[style|class],-blockquote[dir|style],-table[border=0|cellspacing|cellpadding|width|height|class|align|summary|style|dir|id|lang|bgcolor|background|bordercolor],-tr[id|lang|dir|class|rowspan|width|height|align|valign|style|bgcolor|background|bordercolor],tbody[id|class],thead[id|class],t
 foot[id|class],#td[id|lang|dir|class|colspan|rowspan|width|height|align|valign|style|bgcolor|background|bordercolor|scope],-th[id|lang|dir|class|colspan|rowspan|width|height|align|valign|style|scope],caption[id|lang|dir|class|style],-div[id|dir|class|align|style],-span[style|class|align],-pre[class|align|style],address[class|align|style],-h1[id|style|dir|class|align],-h2[id|style|dir|class|align],-h3[id|style|dir|class|align],-h4[id|style|dir|class|align],-h5[id|style|dir|class|align],-h6[id|style|dir|class|align],hr[class|style],-font[face|size|style|id|class|dir|color],dd[id|class|title|style|dir|lang],dl[id|class|title|style|dir|lang],dt[id|class|title|style|dir|lang],cite[title|id|class|style|dir|lang],abbr[title|id|class|style|dir|lang],acronym[title|id|class|style|dir|lang],del[title|id|class|style|dir|lang|datetime|cite],ins[title|id|class|style|dir|lang|datetime|cite]");this._def("extended_valid_elements","");this._def("invalid_elements","");this._def("encoding","");
 this._def("urlconverter_callback",tinyMCE.getParam("urlconvertor_callback","TinyMCE_Engine.prototype.convertURL"));this._def("save_callback","");this._def("force_br_newlines",false);this._def("force_p_newlines",true);this._def("add_form_submit_trigger",true);this._def("relative_urls",true);this._def("remove_script_host",true);this._def("focus_alert",true);this._def("document_base_url",this.documentURL);this._def("visual",true);this._def("visual_table_class","mceVisualAid");this._def("setupcontent_callback","");this._def("fix_content_duplication",true);this._def("custom_undo_redo",true);this._def("custom_undo_redo_levels",-1);this._def("custom_undo_redo_keyboard_shortcuts",true);this._def("custom_undo_redo_restore_selection",true);this._def("custom_undo_redo_global",false);this._def("verify_html",true);this._def("apply_source_formatting",false);this._def("directionality","ltr");this._def("cleanup_on_startup",false);this._def("inline_styles",false);this._def("convert_newlines_
 to_brs",false);this._def("auto_reset_designmode",true);this._def("entities","39,#39,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,25
 0,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,34,quot,38,amp,60,lt,62,gt,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",true);this._def("entity_encoding","named");this._def("cleanup_callback","");this._def("add_unload_trigger",true);this._def("ask",false);this._def("nowrap",false);this._def("auto_resize",false);this._def("auto_focus",false);this._def("cleanup",true);this._def("remove_linebreaks",true);this._def("button_tile_map",false);this._def("submit_patch",true);this._def("browsers
 ","msie,safari,gecko,opera",true);this._def("dialog_type","window");this._def("accessibility_warnings",true);this._def("accessibility_focus",true);this._def("merge_styles_invalid_parents","");this._def("force_hex_style_colors",true);this._def("trim_span_elements",true);this._def("convert_fonts_to_spans",false);this._def("doctype",'<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">');this._def("font_size_classes",'');this._def("font_size_style_values",'xx-small,x-small,small,medium,large,x-large,xx-large',true);this._def("event_elements",'a,img',true);this._def("convert_urls",true);this._def("table_inline_editing",false);this._def("object_resizing",true);this._def("custom_shortcuts",true);this._def("convert_on_click",false);this._def("content_css",'');this._def("fix_list_elements",true);this._def("fix_table_elements",false);this._def("strict_loading_mode",document.contentType=='application/xhtml+xml');this._def("hidden_tab_class",'');this._def("display_tab_class",
 '');this._def("gecko_spellcheck",false);this._def("hide_selects_on_submit",true);this._def("forced_root_block",false);this._def("remove_trailing_nbsp",false);this._def("save_on_tinymce_forms",false);if(this.isMSIE&&!this.isOpera)this.settings.strict_loading_mode=false;if(this.isMSIE&&this.settings.browsers.indexOf('msie')==-1)return;if(this.isGecko&&this.settings.browsers.indexOf('gecko')==-1)return;if(this.isSafari&&this.settings.browsers.indexOf('safari')==-1)return;if(this.isOpera&&this.settings.browsers.indexOf('opera')==-1)return;baseHREF=tinyMCE.settings.document_base_url;h=document.location.href;p=h.indexOf('://');if(p>0&&document.location.protocol!="file:"){p=h.indexOf('/',p+3);h=h.substring(0,p);if(baseHREF.indexOf('://')==-1)baseHREF=h+baseHREF;tinyMCE.settings.document_base_url=baseHREF;tinyMCE.settings.document_base_prefix=h}if(baseHREF.indexOf('?')!=-1)baseHREF=baseHREF.substring(0,baseHREF.indexOf('?'));this.settings.base_href=baseHREF.substring(0,baseHREF.last
 IndexOf('/'))+"/";theme=this.settings.theme;this.inlineStrict='A|BR|SPAN|BDO|MAP|OBJECT|IMG|TT|I|B|BIG|SMALL|EM|STRONG|DFN|CODE|Q|SAMP|KBD|VAR|CITE|ABBR|ACRONYM|SUB|SUP|#text|#comment';this.inlineTransitional='A|BR|SPAN|BDO|OBJECT|APPLET|IMG|MAP|IFRAME|TT|I|B|U|S|STRIKE|BIG|SMALL|FONT|BASEFONT|EM|STRONG|DFN|CODE|Q|SAMP|KBD|VAR|CITE|ABBR|ACRONYM|SUB|SUP|INPUT|SELECT|TEXTAREA|LABEL|BUTTON|#text|#comment';this.blockElms='H[1-6]|P|DIV|ADDRESS|PRE|FORM|TABLE|LI|OL|UL|TD|CAPTION|BLOCKQUOTE|CENTER|DL|DT|DD|DIR|FIELDSET|FORM|NOSCRIPT|NOFRAMES|MENU|ISINDEX|SAMP';this.blockRegExp=new RegExp("^("+this.blockElms+")$","i");this.posKeyCodes=[13,45,36,35,33,34,37,38,39,40];this.uniqueURL='javascript:void(091039730);';this.uniqueTag='<div id="mceTMPElement" style="display: none">TMP</div>';this.callbacks=['onInit','getInfo','getEditorTemplate','setupContent','onChange','onPageLoad','handleNodeChange','initInstance','execCommand','getControlHTML','handleEvent','cleanup','removeInstance'];thi
 s.settings.theme_href=tinyMCE.baseURL+"/themes/"+theme;if(!tinyMCE.isIE||tinyMCE.isOpera)this.settings.force_br_newlines=false;if(tinyMCE.getParam("popups_css",false)){cssPath=tinyMCE.getParam("popups_css","");if(cssPath.indexOf('://')==-1&&cssPath.charAt(0)!='/')this.settings.popups_css=this.documentBasePath+"/"+cssPath;else this.settings.popups_css=cssPath}else this.settings.popups_css=tinyMCE.baseURL+"/themes/"+theme+"/css/editor_popup.css";if(tinyMCE.getParam("editor_css",false)){cssPath=tinyMCE.getParam("editor_css","");if(cssPath.indexOf('://')==-1&&cssPath.charAt(0)!='/')this.settings.editor_css=this.documentBasePath+"/"+cssPath;else this.settings.editor_css=cssPath}else{if(this.settings.editor_css!=='')this.settings.editor_css=tinyMCE.baseURL+"/themes/"+theme+"/css/editor_ui.css"}if(this.configs.length==0){if(typeof(TinyMCECompressed)=="undefined"){tinyMCE.addEvent(window,"DOMContentLoaded",TinyMCE_Engine.prototype.onLoad);if(tinyMCE.isRealIE){if(document.body)tinyMC
 E.addEvent(document.body,"readystatechange",TinyMCE_Engine.prototype.onLoad);else tinyMCE.addEvent(document,"readystatechange",TinyMCE_Engine.prototype.onLoad)}tinyMCE.addEvent(window,"load",TinyMCE_Engine.prototype.onLoad);tinyMCE._addUnloadEvents()}}this.loadScript(tinyMCE.baseURL+'/themes/'+this.settings.theme+'/editor_template'+tinyMCE.srcMode+'.js');this.loadScript(tinyMCE.baseURL+'/langs/'+this.settings.language+'.js');this.loadCSS(this.settings.editor_css);p=tinyMCE.getParam('plugins','',true,',');if(p.length>0){for(i=0;i<p.length;i++){if(p[i].charAt(0)!='-')this.loadScript(tinyMCE.baseURL+'/plugins/'+p[i]+'/editor_plugin'+tinyMCE.srcMode+'.js')}}if(tinyMCE.getParam('entity_encoding')=='named'){settings.cleanup_entities=[];entities=tinyMCE.getParam('entities','',true,',');for(i=0;i<entities.length;i+=2)settings.cleanup_entities['c'+entities[i]]=entities[i+1]}settings.index=this.configs.length;this.configs[this.configs.length]=settings;this.loadNextScript();if(this.isI
 E&&!this.isOpera){try{document.execCommand('BackgroundImageCache',false,true)}catch(e){}}this.xmlEncodeRe=new RegExp('[<>&"]','g')},_addUnloadEvents:function(){var st=tinyMCE.settings.add_unload_trigger;if(tinyMCE.isIE){if(st){tinyMCE.addEvent(window,"unload",TinyMCE_Engine.prototype.unloadHandler);tinyMCE.addEvent(window.document,"beforeunload",TinyMCE_Engine.prototype.unloadHandler)}}else{if(st)tinyMCE.addEvent(window,"unload",function(){tinyMCE.triggerSave(true,true)})}},_def:function(key,def_val,t){var v=tinyMCE.getParam(key,def_val);v=t?v.replace(/\s+/g,""):v;this.settings[key]=v},hasPlugin:function(n){return typeof(this.plugins[n])!="undefined"&&this.plugins[n]!=null},addPlugin:function(n,p){var op=this.plugins[n];p.baseURL=op?op.baseURL:tinyMCE.baseURL+"/plugins/"+n;this.plugins[n]=p;this.loadNextScript()},setPluginBaseURL:function(n,u){var op=this.plugins[n];if(op)op.baseURL=u;else this.plugins[n]={baseURL:u}},loadPlugin:function(n,u){u=u.indexOf('.js')!=-1?u.substri
 ng(0,u.lastIndexOf('/')):u;u=u.charAt(u.length-1)=='/'?u.substring(0,u.length-1):u;this.plugins[n]={baseURL:u};this.loadScript(u+"/editor_plugin"+(tinyMCE.srcMode?'_src':'')+".js")},hasTheme:function(n){return typeof(this.themes[n])!="undefined"&&this.themes[n]!=null},addTheme:function(n,t){this.themes[n]=t;this.loadNextScript()},addMenu:function(n,m){this.menus[n]=m},hasMenu:function(n){return typeof(this.plugins[n])!="undefined"&&this.plugins[n]!=null},loadScript:function(url){var i;for(i=0;i<this.loadedFiles.length;i++){if(this.loadedFiles[i]==url)return}if(tinyMCE.settings.strict_loading_mode)this.pendingFiles[this.pendingFiles.length]=url;else document.write('<sc'+'ript language="javascript" type="text/javascript" src="'+url+'"></script>');this.loadedFiles[this.loadedFiles.length]=url},loadNextScript:function(){var d=document,se;if(!tinyMCE.settings.strict_loading_mode)return;if(this.loadingIndex<this.pendingFiles.length){se=d.createElementNS('http://www.w3.org/1999/xht
 ml','script');se.setAttribute('language','javascript');se.setAttribute('type','text/javascript');se.setAttribute('src',this.pendingFiles[this.loadingIndex++]);d.getElementsByTagName("head")[0].appendChild(se)}else this.loadingIndex=-1;},loadCSS:function(url){var ar=url.replace(/\s+/,'').split(',');var lflen=0,csslen=0,skip=false;var x=0,i=0,nl,le;for(x=0,csslen=ar.length;x<csslen;x++){if(ar[x]!=null&&ar[x]!='null'&&ar[x].length>0){for(i=0,lflen=this.loadedFiles.length;i<lflen;i++){if(this.loadedFiles[i]==ar[x]){skip=true;break}}if(!skip){if(tinyMCE.settings.strict_loading_mode){nl=document.getElementsByTagName("head");le=document.createElement('link');le.setAttribute('href',ar[x]);le.setAttribute('rel','stylesheet');le.setAttribute('type','text/css');nl[0].appendChild(le)}else document.write('<link href="'+ar[x]+'" rel="stylesheet" type="text/css" />');this.loadedFiles[this.loadedFiles.length]=ar[x]}}}},importCSS:function(doc,css){var css_ary=css.replace(/\s+/,'').split(',')
 ;var csslen,elm,headArr,x,css_file;for(x=0,csslen=css_ary.length;x<csslen;x++){css_file=css_ary[x];if(css_file!=null&&css_file!='null'&&css_file.length>0){if(css_file.indexOf('://')==-1&&css_file.charAt(0)!='/')css_file=this.documentBasePath+"/"+css_file;if(typeof(doc.createStyleSheet)=="undefined"){elm=doc.createElement("link");elm.rel="stylesheet";elm.href=css_file;if((headArr=doc.getElementsByTagName("head"))!=null&&headArr.length>0)headArr[0].appendChild(elm)}else doc.createStyleSheet(css_file)}}},confirmAdd:function(e,settings){var elm=tinyMCE.isIE?event.srcElement:e.target;var elementId=elm.name?elm.name:elm.id;tinyMCE.settings=settings;if(tinyMCE.settings.convert_on_click||(!elm.getAttribute('mce_noask')&&confirm(tinyMCELang.lang_edit_confirm)))tinyMCE.addMCEControl(elm,elementId);elm.setAttribute('mce_noask','true')},updateContent:function(form_element_name){var formElement,n,inst,doc;formElement=document.getElementById(form_element_name);for(n in tinyMCE.instances){
 inst=tinyMCE.instances[n];if(!tinyMCE.isInstance(inst))continue;inst.switchSettings();if(inst.formElement==formElement){doc=inst.getDoc();tinyMCE._setHTML(doc,inst.formElement.value);if(!tinyMCE.isIE)doc.body.innerHTML=tinyMCE._cleanupHTML(inst,doc,this.settings,doc.body,inst.visualAid)}}},addMCEControl:function(replace_element,form_element_name,target_document){var id="mce_editor_"+tinyMCE.idCounter++;var inst=new TinyMCE_Control(tinyMCE.settings);inst.editorId=id;this.instances[id]=inst;inst._onAdd(replace_element,form_element_name,target_document)},removeInstance:function(ti){var t=[],n,i;for(n in tinyMCE.instances){i=tinyMCE.instances[n];if(tinyMCE.isInstance(i)&&ti!=i)t[n]=i}tinyMCE.instances=t;n=[];t=tinyMCE.undoLevels;for(i=0;i<t.length;i++){if(t[i]!=ti)n.push(t[i])}tinyMCE.undoLevels=n;tinyMCE.undoIndex=n.length;tinyMCE.dispatchCallback(ti,'remove_instance_callback','removeInstance',ti);return ti},removeMCEControl:function(editor_id){var inst=tinyMCE.getInstanceById(
 editor_id),h,re,ot,tn,n;if(inst){inst.switchSettings();editor_id=inst.editorId;h=tinyMCE.getContent(editor_id);this.removeInstance(inst);tinyMCE.selectedElement=null;tinyMCE.selectedInstance=null;tinyMCE.selectedElement=null;tinyMCE.selectedInstance=null;for(n in tinyMCE.instances){if(!tinyMCE.isInstance(tinyMCE.instances[n]))continue;tinyMCE.selectedInstance=tinyMCE.instances[n];break}re=document.getElementById(editor_id+"_parent");ot=inst.oldTargetElement;tn=ot.nodeName.toLowerCase();if(tn=="textarea"||tn=="input"){re.parentNode.removeChild(re);ot.style.display="inline";ot.value=h}else{ot.innerHTML=h;ot.style.display='block';re.parentNode.insertBefore(ot,re);re.parentNode.removeChild(re)}}},triggerSave:function(skip_cleanup,skip_callback){var inst,n;if(typeof(skip_cleanup)=="undefined")skip_cleanup=false;if(typeof(skip_callback)=="undefined")skip_callback=false;for(n in tinyMCE.instances){inst=tinyMCE.instances[n];if(!tinyMCE.isInstance(inst))continue;inst.triggerSave(skip
 _cleanup,skip_callback)}},resetForm:function(form_index){var i,inst,n,formObj=document.forms[form_index];for(n in tinyMCE.instances){inst=tinyMCE.instances[n];if(!tinyMCE.isInstance(inst))continue;inst.switchSettings();for(i=0;i<formObj.elements.length;i++){if(inst.formTargetElementId==formObj.elements[i].name)inst.getBody().innerHTML=inst.startContent}}},execInstanceCommand:function(editor_id,command,user_interface,value,focus){var inst=tinyMCE.getInstanceById(editor_id),r;if(inst){r=inst.selection.getRng();if(typeof(focus)=="undefined")focus=true;if(focus&&(!r||!r.item))inst.contentWindow.focus();inst.autoResetDesignMode();this.selectedElement=inst.getFocusElement();inst.select();tinyMCE.execCommand(command,user_interface,value);if(tinyMCE.isIE&&window.event!=null)tinyMCE.cancelEvent(window.event)}},execCommand:function(command,user_interface,value){var inst=tinyMCE.selectedInstance,n,pe,te;user_interface=user_interface?user_interface:false;value=value?value:null;if(inst)i
 nst.switchSettings();switch(command){case"Undo":if(this.getParam('custom_undo_redo_global')){if(this.undoIndex>0){tinyMCE.nextUndoRedoAction='Undo';inst=this.undoLevels[--this.undoIndex];inst.select();if(!tinyMCE.nextUndoRedoInstanceId)inst.execCommand('Undo')}}else inst.execCommand('Undo');return true;case"Redo":if(this.getParam('custom_undo_redo_global')){if(this.undoIndex<=this.undoLevels.length-1){tinyMCE.nextUndoRedoAction='Redo';inst=this.undoLevels[this.undoIndex++];inst.select();if(!tinyMCE.nextUndoRedoInstanceId)inst.execCommand('Redo')}}else inst.execCommand('Redo');return true;case'mceFocus':inst=tinyMCE.getInstanceById(value);if(inst)inst.getWin().focus();return;case"mceAddControl":case"mceAddEditor":tinyMCE.addMCEControl(tinyMCE._getElementById(value),value);return;case"mceAddFrameControl":tinyMCE.addMCEControl(tinyMCE._getElementById(value.element,value.document),value.element,value.document);return;case"mceRemoveControl":case"mceRemoveEditor":tinyMCE.removeMCE
 Control(value);return;case"mceToggleEditor":inst=tinyMCE.getInstanceById(value);if(inst){pe=document.getElementById(inst.editorId+'_parent');te=inst.oldTargetElement;if(typeof(inst.enabled)=='undefined')inst.enabled=true;inst.enabled=!inst.enabled;if(!inst.enabled){pe.style.display='none';if(te.nodeName=='TEXTAREA'||te.nodeName=='INPUT')te.value=inst.getHTML();else te.innerHTML=inst.getHTML();te.style.display=inst.oldTargetDisplay;tinyMCE.dispatchCallback(inst,'hide_instance_callback','hideInstance',inst)}else{pe.style.display='block';te.style.display='none';if(te.nodeName=='TEXTAREA'||te.nodeName=='INPUT')inst.setHTML(te.value);else inst.setHTML(te.innerHTML);inst.useCSS=false;tinyMCE.dispatchCallback(inst,'show_instance_callback','showInstance',inst)}}else tinyMCE.addMCEControl(tinyMCE._getElementById(value),value);return;case"mceResetDesignMode":if(tinyMCE.isGecko){for(n in tinyMCE.instances){if(!tinyMCE.isInstance(tinyMCE.instances[n]))continue;try{tinyMCE.instances[n].g
 etDoc().designMode="off";tinyMCE.instances[n].getDoc().designMode="on";tinyMCE.instances[n].useCSS=false}catch(e){}}}return}if(inst){inst.execCommand(command,user_interface,value)}else if(tinyMCE.settings.focus_alert)alert(tinyMCELang.lang_focus_alert)},_createIFrame:function(replace_element,doc,win){var iframe,id=replace_element.getAttribute("id");var aw,ah;if(typeof(doc)=="undefined")doc=document;if(typeof(win)=="undefined")win=window;iframe=doc.createElement("iframe");aw=""+tinyMCE.settings.area_width;ah=""+tinyMCE.settings.area_height;if(aw.indexOf('%')==-1){aw=parseInt(aw);aw=(isNaN(aw)||aw<0)?300:aw;aw=aw+"px"}if(ah.indexOf('%')==-1){ah=parseInt(ah);ah=(isNaN(ah)||ah<0)?240:ah;ah=ah+"px"}iframe.setAttribute("id",id);iframe.setAttribute("name",id);iframe.setAttribute("class","mceEditorIframe");iframe.setAttribute("border","0");iframe.setAttribute("frameBorder","0");iframe.setAttribute("marginWidth","0");iframe.setAttribute("marginHeight","0");iframe.setAttribute("leftMa
 rgin","0");iframe.setAttribute("topMargin","0");iframe.setAttribute("width",aw);iframe.setAttribute("height",ah);iframe.setAttribute("allowtransparency","true");iframe.className='mceEditorIframe';if(tinyMCE.settings.auto_resize)iframe.setAttribute("scrolling","no");if(tinyMCE.isRealIE)iframe.setAttribute("src",this.settings.default_document);iframe.style.width=aw;iframe.style.height=ah;if(tinyMCE.settings.strict_loading_mode)iframe.style.marginBottom='-5px';if(tinyMCE.isRealIE)replace_element.outerHTML=iframe.outerHTML;else replace_element.parentNode.replaceChild(iframe,replace_element);if(tinyMCE.isRealIE)return win.frames[id];else return iframe},setupContent:function(editor_id){var inst=tinyMCE.instances[editor_id],i,doc=inst.getDoc(),head=doc.getElementsByTagName('head').item(0);var content=inst.startContent,contentElement,body;if(tinyMCE.settings.strict_loading_mode){content=content.replace(/&lt;/g,'<');content=content.replace(/&gt;/g,'>');content=content.replace(/&quot;
 /g,'"');content=content.replace(/&amp;/g,'&')}tinyMCE.selectedInstance=inst;inst.switchSettings();if(!tinyMCE.isIE&&tinyMCE.getParam("setupcontent_reload",false)&&doc.title!="blank_page"){try{doc.location.href=tinyMCE.baseURL+"/blank.htm"}catch(ex){}window.setTimeout("tinyMCE.setupContent('"+editor_id+"');",1000);return}if(!head||!doc.body){window.setTimeout("tinyMCE.setupContent('"+editor_id+"');",10);return}tinyMCE.importCSS(inst.getDoc(),tinyMCE.baseURL+"/themes/"+inst.settings.theme+"/css/editor_content.css");tinyMCE.importCSS(inst.getDoc(),inst.settings.content_css);tinyMCE.dispatchCallback(inst,'init_instance_callback','initInstance',inst);if(tinyMCE.getParam('custom_undo_redo_keyboard_shortcuts')){inst.addShortcut('ctrl','z','lang_undo_desc','Undo');inst.addShortcut('ctrl','y','lang_redo_desc','Redo')}for(i=1;i<=6;i++)inst.addShortcut('ctrl',''+i,'','FormatBlock',false,'<h'+i+'>');inst.addShortcut('ctrl','7','','FormatBlock',false,'<p>');inst.addShortcut('ctrl','8',''
 ,'FormatBlock',false,'<div>');inst.addShortcut('ctrl','9','','FormatBlock',false,'<address>');if(tinyMCE.isGecko){inst.addShortcut('ctrl','b','lang_bold_desc','Bold');inst.addShortcut('ctrl','i','lang_italic_desc','Italic');inst.addShortcut('ctrl','u','lang_underline_desc','Underline')}if(tinyMCE.getParam("convert_fonts_to_spans"))inst.getBody().setAttribute('id','mceSpanFonts');if(tinyMCE.settings.nowrap)doc.body.style.whiteSpace="nowrap";doc.body.dir=this.settings.directionality;doc.editorId=editor_id;if(!tinyMCE.isIE)doc.documentElement.editorId=editor_id;inst.setBaseHREF(tinyMCE.settings.base_href);if(tinyMCE.settings.convert_newlines_to_brs){content=tinyMCE.regexpReplace(content,"\r\n","<br />","gi");content=tinyMCE.regexpReplace(content,"\r","<br />","gi");content=tinyMCE.regexpReplace(content,"\n","<br />","gi")}content=tinyMCE.storeAwayURLs(content);content=tinyMCE._customCleanup(inst,"insert_to_editor",content);if(tinyMCE.isIE){window.setInterval('try{tinyMCE.getCSS
 Classes(tinyMCE.instances["'+editor_id+'"].getDoc(), "'+editor_id+'");}catch(e){}',500);if(tinyMCE.settings.force_br_newlines)doc.styleSheets[0].addRule("p","margin: 0;");body=inst.getBody();body.editorId=editor_id}content=tinyMCE.cleanupHTMLCode(content);if(!tinyMCE.isIE){contentElement=inst.getDoc().createElement("body");doc=inst.getDoc();contentElement.innerHTML=content;if(tinyMCE.settings.cleanup_on_startup)tinyMCE.setInnerHTML(inst.getBody(),tinyMCE._cleanupHTML(inst,doc,this.settings,contentElement));else tinyMCE.setInnerHTML(inst.getBody(),content);tinyMCE.convertAllRelativeURLs(inst.getBody())}else{if(tinyMCE.settings.cleanup_on_startup){tinyMCE._setHTML(inst.getDoc(),content);try{tinyMCE.setInnerHTML(inst.getBody(),tinyMCE._cleanupHTML(inst,inst.contentDocument,this.settings,inst.getBody()))}catch(e){}}else tinyMCE._setHTML(inst.getDoc(),content)}tinyMCE.handleVisualAid(inst.getBody(),true,tinyMCE.settings.visual,inst);tinyMCE.dispatchCallback(inst,'setupcontent_cal
 lback','setupContent',editor_id,inst.getBody(),inst.getDoc());if(!tinyMCE.isIE)tinyMCE.addEventHandlers(inst);if(tinyMCE.isIE){tinyMCE.addEvent(inst.getBody(),"blur",TinyMCE_Engine.prototype._eventPatch);tinyMCE.addEvent(inst.getBody(),"beforedeactivate",TinyMCE_Engine.prototype._eventPatch);if(!tinyMCE.isOpera){tinyMCE.addEvent(doc.body,"mousemove",TinyMCE_Engine.prototype.onMouseMove);tinyMCE.addEvent(doc.body,"beforepaste",TinyMCE_Engine.prototype._eventPatch);tinyMCE.addEvent(doc.body,"drop",TinyMCE_Engine.prototype._eventPatch)}}inst.select();tinyMCE.selectedElement=inst.contentWindow.document.body;tinyMCE._customCleanup(inst,"insert_to_editor_dom",inst.getBody());tinyMCE._customCleanup(inst,"setup_content_dom",inst.getBody());tinyMCE._setEventsEnabled(inst.getBody(),false);tinyMCE.cleanupAnchors(inst.getDoc());if(tinyMCE.getParam("convert_fonts_to_spans"))tinyMCE.convertSpansToFonts(inst.getDoc());inst.startContent=tinyMCE.trim(inst.getBody().innerHTML);inst.undoRedo.a
 dd({content:inst.startContent});if(tinyMCE.isGecko){tinyMCE.selectNodes(inst.getBody(),function(n){if(n.nodeType==3||n.nodeType==8)n.nodeValue=n.nodeValue.replace(new RegExp('\\s(mce_src|mce_href)=\"[^\"]*\"','gi'),"");return false})}if(tinyMCE.isGecko)inst.getBody().spellcheck=tinyMCE.getParam("gecko_spellcheck");tinyMCE._removeInternal(inst.getBody());inst.select();tinyMCE.triggerNodeChange(false,true)},storeAwayURLs:function(s){if(!s.match(/(mce_src|mce_href)/gi,s)){s=s.replace(new RegExp('src\\s*=\\s*[\"\']([^ >\"]*)[\"\']','gi'),'src="$1" mce_src="$1"');s=s.replace(new RegExp('href\\s*=\\s*[\"\']([^ >\"]*)[\"\']','gi'),'href="$1" mce_href="$1"')}return s},_removeInternal:function(n){if(tinyMCE.isGecko){tinyMCE.selectNodes(n,function(n){if(n.nodeType==3||n.nodeType==8)n.nodeValue=n.nodeValue.replace(new RegExp('\\s(mce_src|mce_href)=\"[^\"]*\"','gi'),"");return false})}},removeTinyMCEFormElements:function(form_obj){var i,elementId;if(!tinyMCE.getParam('hide_selects_on_su
 bmit'))return;if(typeof(form_obj)=="undefined"||form_obj==null)return;if(form_obj.nodeName!="FORM"){if(form_obj.form)form_obj=form_obj.form;else form_obj=tinyMCE.getParentElement(form_obj,"form")}if(form_obj==null)return;for(i=0;i<form_obj.elements.length;i++){elementId=form_obj.elements[i].name?form_obj.elements[i].name:form_obj.elements[i].id;if(elementId.indexOf('mce_editor_')==0)form_obj.elements[i].disabled=true}},handleEvent:function(e){var inst=tinyMCE.selectedInstance,i,elm,keys;if(typeof(tinyMCE)=="undefined")return true;if(tinyMCE.executeCallback(tinyMCE.selectedInstance,'handle_event_callback','handleEvent',e))return false;switch(e.type){case"beforedeactivate":case"blur":if(tinyMCE.selectedInstance)tinyMCE.selectedInstance.execCommand('mceEndTyping');tinyMCE.hideMenus();return;case"drop":case"beforepaste":return;case"submit":tinyMCE.formSubmit(tinyMCE.isMSIE?window.event.srcElement:e.target);return;case"reset":var formObj=tinyMCE.isIE?window.event.srcElement:e.tar
 get;for(i=0;i<document.forms.length;i++){if(document.forms[i]==formObj)window.setTimeout('tinyMCE.resetForm('+i+');',10)}return;case"keypress":if(inst&&inst.handleShortcut(e))return false;if(e.target.editorId){tinyMCE.instances[e.target.editorId].select()}else{if(e.target.ownerDocument.editorId)tinyMCE.instances[e.target.ownerDocument.editorId].select()}if(tinyMCE.selectedInstance)tinyMCE.selectedInstance.switchSettings();if((tinyMCE.isGecko||tinyMCE.isOpera||tinyMCE.isSafari)&&tinyMCE.settings.force_p_newlines&&e.keyCode==13&&!e.shiftKey){if(TinyMCE_ForceParagraphs._insertPara(tinyMCE.selectedInstance,e)){tinyMCE.execCommand("mceAddUndoLevel");return tinyMCE.cancelEvent(e)}}if((tinyMCE.isGecko&&!tinyMCE.isSafari)&&tinyMCE.settings.force_p_newlines&&(e.keyCode==8||e.keyCode==46)&&!e.shiftKey){if(TinyMCE_ForceParagraphs._handleBackSpace(tinyMCE.selectedInstance,e.type)){tinyMCE.execCommand("mceAddUndoLevel");return tinyMCE.cancelEvent(e)}}if(tinyMCE.isIE&&tinyMCE.settings.for
 ce_br_newlines&&e.keyCode==13){if(e.target.editorId)tinyMCE.instances[e.target.editorId].select();if(tinyMCE.selectedInstance){var sel=tinyMCE.selectedInstance.getDoc().selection;var rng=sel.createRange();if(tinyMCE.getParentElement(rng.parentElement(),"li")!=null)return false;e.returnValue=false;e.cancelBubble=true;rng.pasteHTML("<br />");rng.collapse(false);rng.select();tinyMCE.execCommand("mceAddUndoLevel");tinyMCE.triggerNodeChange(false);return false}}if(e.keyCode==8||e.keyCode==46){tinyMCE.selectedElement=e.target;tinyMCE.linkElement=tinyMCE.getParentElement(e.target,"a");tinyMCE.imgElement=tinyMCE.getParentElement(e.target,"img");tinyMCE.triggerNodeChange(false)}return false;case"keyup":case"keydown":tinyMCE.hideMenus();tinyMCE.hasMouseMoved=false;if(inst&&inst.handleShortcut(e))return false;inst._fixRootBlocks();if(inst.settings.remove_trailing_nbsp)inst._fixTrailingNbsp();if(e.target.editorId)tinyMCE.instances[e.target.editorId].select();if(tinyMCE.selectedInstance)
 tinyMCE.selectedInstance.switchSettings();inst=tinyMCE.selectedInstance;if(tinyMCE.isGecko&&tinyMCE.settings.force_p_newlines&&(e.keyCode==8||e.keyCode==46)&&!e.shiftKey){if(TinyMCE_ForceParagraphs._handleBackSpace(tinyMCE.selectedInstance,e.type)){tinyMCE.execCommand("mceAddUndoLevel");e.preventDefault();return false}}tinyMCE.selectedElement=null;tinyMCE.selectedNode=null;elm=tinyMCE.selectedInstance.getFocusElement();tinyMCE.linkElement=tinyMCE.getParentElement(elm,"a");tinyMCE.imgElement=tinyMCE.getParentElement(elm,"img");tinyMCE.selectedElement=elm;if(tinyMCE.isGecko&&e.type=="keyup"&&e.keyCode==9)tinyMCE.handleVisualAid(tinyMCE.selectedInstance.getBody(),true,tinyMCE.settings.visual,tinyMCE.selectedInstance);if(tinyMCE.isIE&&e.type=="keydown"&&e.keyCode==13)tinyMCE.enterKeyElement=tinyMCE.selectedInstance.getFocusElement();if(tinyMCE.isIE&&e.type=="keyup"&&e.keyCode==13){elm=tinyMCE.enterKeyElement;if(elm){var re=new RegExp('^HR|IMG|BR$','g');var dre=new RegExp('^H[1-6
 ]$','g');if(!elm.hasChildNodes()&&!re.test(elm.nodeName)){if(dre.test(elm.nodeName))elm.innerHTML="&nbsp;&nbsp;";else elm.innerHTML="&nbsp;"}}}keys=tinyMCE.posKeyCodes;var posKey=false;for(i=0;i<keys.length;i++){if(keys[i]==e.keyCode){posKey=true;break}}if(tinyMCE.isIE&&tinyMCE.settings.custom_undo_redo){keys=[8,46];for(i=0;i<keys.length;i++){if(keys[i]==e.keyCode){if(e.type=="keyup")tinyMCE.triggerNodeChange(false)}}}if(e.keyCode==17)return true;if(tinyMCE.isGecko){if(!posKey&&e.type=="keyup"&&!e.ctrlKey||(e.ctrlKey&&(e.keyCode==86||e.keyCode==88)))tinyMCE.execCommand("mceStartTyping")}else{if(!posKey&&e.type=="keyup")tinyMCE.execCommand("mceStartTyping")}if(e.type=="keydown"&&(posKey||e.ctrlKey)&&inst)inst.undoBookmark=inst.selection.getBookmark();if(e.type=="keyup"&&(posKey||e.ctrlKey))tinyMCE.execCommand("mceEndTyping");if(posKey&&e.type=="keyup")tinyMCE.triggerNodeChange(false);if(tinyMCE.isIE&&e.ctrlKey)window.setTimeout('tinyMCE.triggerNodeChange(false);',1);break;cas
 e"mousedown":case"mouseup":case"click":case"dblclick":case"focus":tinyMCE.hideMenus();if(tinyMCE.selectedInstance){tinyMCE.selectedInstance.switchSettings();tinyMCE.selectedInstance.isFocused=true}var targetBody=tinyMCE.getParentElement(e.target,"html");for(var instanceName in tinyMCE.instances){if(!tinyMCE.isInstance(tinyMCE.instances[instanceName]))continue;inst=tinyMCE.instances[instanceName];inst.autoResetDesignMode();if(inst.getBody().parentNode==targetBody){inst.select();tinyMCE.selectedElement=e.target;tinyMCE.linkElement=tinyMCE.getParentElement(tinyMCE.selectedElement,"a");tinyMCE.imgElement=tinyMCE.getParentElement(tinyMCE.selectedElement,"img");break}}if(!tinyMCE.selectedInstance.undoRedo.undoLevels[0].bookmark&&(e.type=="mouseup"||e.type=="dblclick"))tinyMCE.selectedInstance.undoRedo.undoLevels[0].bookmark=tinyMCE.selectedInstance.selection.getBookmark();if(e.type!="focus")tinyMCE.selectedNode=null;tinyMCE.triggerNodeChange(false);tinyMCE.execCommand("mceEndTypin
 g");if(e.type=="mouseup")tinyMCE.execCommand("mceAddUndoLevel");if(!tinyMCE.selectedInstance&&e.target.editorId)tinyMCE.instances[e.target.editorId].select();return false}},getButtonHTML:function(id,lang,img,cmd,ui,val){var h='',m,x,io='';cmd='tinyMCE.execInstanceCommand(\'{$editor_id}\',\''+cmd+'\'';if(typeof(ui)!="undefined"&&ui!=null)cmd+=','+ui;if(typeof(val)!="undefined"&&val!=null)cmd+=",'"+val+"'";cmd+=');';if(tinyMCE.isRealIE)io='onmouseover="tinyMCE.lastHover = this;"';if(tinyMCE.getParam('button_tile_map')&&(!tinyMCE.isIE||tinyMCE.isOpera)&&(m=this.buttonMap[id])!=null&&(tinyMCE.getParam("language")=="en"||img.indexOf('$lang')==-1)){x=0-(m*20)==0?'0':0-(m*20);h+='<a id="{$editor_id}_'+id+'" href="javascript:'+cmd+'" onclick="'+cmd+'return false;" onmousedown="return false;" '+io+' class="mceTiledButton mceButtonNormal" target="_self">';h+='<img src="{$themeurl}/images/spacer.gif" style="background-position: '+x+'px 0" alt="{$'+lang+'}" title="{$'+lang+'}" />';h+='<
 /a>'}else{h+='<a id="{$editor_id}_'+id+'" href="javascript:'+cmd+'" onclick="'+cmd+'return false;" onmousedown="return false;" '+io+' class="mceButtonNormal" target="_self">';h+='<img src="'+img+'" alt="{$'+lang+'}" title="{$'+lang+'}" />';h+='</a>'}return h},getMenuButtonHTML:function(id,lang,img,mcmd,cmd,ui,val){var h='',m,x;mcmd='tinyMCE.execInstanceCommand(\'{$editor_id}\',\''+mcmd+'\');';cmd='tinyMCE.execInstanceCommand(\'{$editor_id}\',\''+cmd+'\'';if(typeof(ui)!="undefined"&&ui!=null)cmd+=','+ui;if(typeof(val)!="undefined"&&val!=null)cmd+=",'"+val+"'";cmd+=');';if(tinyMCE.getParam('button_tile_map')&&(!tinyMCE.isIE||tinyMCE.isOpera)&&(m=tinyMCE.buttonMap[id])!=null&&(tinyMCE.getParam("language")=="en"||img.indexOf('$lang')==-1)){x=0-(m*20)==0?'0':0-(m*20);if(tinyMCE.isRealIE)h+='<span id="{$editor_id}_'+id+'" class="mceMenuButton" onmouseover="tinyMCE._menuButtonEvent(\'over\',this);tinyMCE.lastHover = this;" onmouseout="tinyMCE._menuButtonEvent(\'out\',this);">';else
  h+='<span id="{$editor_id}_'+id+'" class="mceMenuButton">';h+='<a href="javascript:'+cmd+'" onclick="'+cmd+'return false;" onmousedown="return false;" class="mceTiledButton mceMenuButtonNormal" target="_self">';h+='<img src="{$themeurl}/images/spacer.gif" style="width: 20px; height: 20px; background-position: '+x+'px 0" title="{$'+lang+'}" /></a>';h+='<a href="javascript:'+mcmd+'" onclick="'+mcmd+'return false;" onmousedown="return false;"><img src="{$themeurl}/images/button_menu.gif" title="{$'+lang+'}" class="mceMenuButton" />';h+='</a></span>'}else{if(tinyMCE.isRealIE)h+='<span id="{$editor_id}_'+id+'" dir="ltr" class="mceMenuButton" onmouseover="tinyMCE._menuButtonEvent(\'over\',this);tinyMCE.lastHover = this;" onmouseout="tinyMCE._menuButtonEvent(\'out\',this);">';else h+='<span id="{$editor_id}_'+id+'" dir="ltr" class="mceMenuButton">';h+='<a href="javascript:'+cmd+'" onclick="'+cmd+'return false;" onmousedown="return false;" class="mceMenuButtonNormal" target="_self"
 >';h+='<img src="'+img+'" title="{$'+lang+'}" /></a>';h+='<a href="javascript:'+mcmd+'" onclick="'+mcmd+'return false;" onmousedown="return false;"><img src="{$themeurl}/images/button_menu.gif" title="{$'+lang+'}" class="mceMenuButton" />';h+='</a></span>'}return h},_menuButtonEvent:function(e,o){if(o.className=='mceMenuButtonFocus')return;if(e=='over')o.className=o.className+' mceMenuHover';else o.className=o.className.replace(/\s.*$/,'')},addButtonMap:function(m){var i,a=m.replace(/\s+/,'').split(',');for(i=0;i<a.length;i++)this.buttonMap[a[i]]=i},formSubmit:function(f,p){var n,inst,found=false;if(f.form)f=f.form;if(tinyMCE.getParam('save_on_tinymce_forms')){for(n in tinyMCE.instances){inst=tinyMCE.instances[n];if(!tinyMCE.isInstance(inst))continue;if(inst.formElement){if(f==inst.formElement.form){found=true;inst.isNotDirty=true}}}}else found=true;if(found){tinyMCE.removeTinyMCEFormElements(f);tinyMCE.triggerSave()}if(f.mceOldSubmit&&p)f.mceOldSubmit()},submitPatch:functio
 n(){tinyMCE.formSubmit(this,true)},onLoad:function(){var r,i,c,mode,trigger,elements,element,settings,elementId,elm;var selector,deselector,elementRefAr,form;if(tinyMCE.settings.strict_loading_mode&&this.loadingIndex!=-1){window.setTimeout('tinyMCE.onLoad();',1);return}if(tinyMCE.isRealIE&&window.event.type=="readystatechange"&&document.readyState!="complete")return true;if(tinyMCE.isLoaded)return true;tinyMCE.isLoaded=true;if(tinyMCE.isRealIE&&document.body&&window.location.href!=window.top.location.href){r=document.body.createTextRange();r.collapse(true);r.select()}tinyMCE.dispatchCallback(null,'onpageload','onPageLoad');for(c=0;c<tinyMCE.configs.length;c++){tinyMCE.settings=tinyMCE.configs[c];selector=tinyMCE.getParam("editor_selector");deselector=tinyMCE.getParam("editor_deselector");elementRefAr=[];if(document.forms&&tinyMCE.settings.add_form_submit_trigger&&!tinyMCE.submitTriggers){for(i=0;i<document.forms.length;i++){form=document.forms[i];tinyMCE.addEvent(form,"submi
 t",TinyMCE_Engine.prototype.handleEvent);tinyMCE.addEvent(form,"reset",TinyMCE_Engine.prototype.handleEvent);tinyMCE.submitTriggers=true;if(tinyMCE.settings.submit_patch){try{form.mceOldSubmit=form.submit;form.submit=TinyMCE_Engine.prototype.submitPatch}catch(e){}}}}mode=tinyMCE.settings.mode;switch(mode){case"exact":elements=tinyMCE.getParam('elements','',true,',');for(i=0;i<elements.length;i++){element=tinyMCE._getElementById(elements[i]);trigger=element?element.getAttribute(tinyMCE.settings.textarea_trigger):"";if(new RegExp('\\b'+deselector+'\\b').test(tinyMCE.getAttrib(element,"class")))continue;if(trigger=="false")continue;if((tinyMCE.settings.ask||tinyMCE.settings.convert_on_click)&&element){elementRefAr[elementRefAr.length]=element;continue}if(element)tinyMCE.addMCEControl(element,elements[i])}break;case"specific_textareas":case"textareas":elements=document.getElementsByTagName("textarea");for(i=0;i<elements.length;i++){elm=elements.item(i);trigger=elm.getAttribute(t
 inyMCE.settings.textarea_trigger);if(selector!==''&&!new RegExp('\\b'+selector+'\\b').test(tinyMCE.getAttrib(elm,"class")))continue;if(selector!=='')trigger=selector!==''?"true":"";if(new RegExp('\\b'+deselector+'\\b').test(tinyMCE.getAttrib(elm,"class")))continue;if((mode=="specific_textareas"&&trigger=="true")||(mode=="textareas"&&trigger!="false"))elementRefAr[elementRefAr.length]=elm}break}for(i=0;i<elementRefAr.length;i++){element=elementRefAr[i];elementId=element.name?element.name:element.id;if(tinyMCE.settings.ask||tinyMCE.settings.convert_on_click){if(tinyMCE.isGecko){settings=tinyMCE.settings;tinyMCE.addEvent(element,"focus",function(e){window.setTimeout(function(){TinyMCE_Engine.prototype.confirmAdd(e,settings)},10)});if(element.nodeName!="TEXTAREA"&&element.nodeName!="INPUT")tinyMCE.addEvent(element,"click",function(e){window.setTimeout(function(){TinyMCE_Engine.prototype.confirmAdd(e,settings)},10)});}else{settings=tinyMCE.settings;tinyMCE.addEvent(element,"focus
 ",function(){TinyMCE_Engine.prototype.confirmAdd(null,settings)});tinyMCE.addEvent(element,"click",function(){TinyMCE_Engine.prototype.confirmAdd(null,settings)});}}else tinyMCE.addMCEControl(element,elementId)}if(tinyMCE.settings.auto_focus){window.setTimeout(function(){var inst=tinyMCE.getInstanceById(tinyMCE.settings.auto_focus);inst.selection.selectNode(inst.getBody(),true,true);inst.contentWindow.focus()},100)}tinyMCE.dispatchCallback(null,'oninit','onInit')}},isInstance:function(o){return o!=null&&typeof(o)=="object"&&o.isTinyMCE_Control},getParam:function(name,default_value,strip_whitespace,split_chr){var i,outArray,value=(typeof(this.settings[name])=="undefined")?default_value:this.settings[name];if(value=="true"||value=="false")return(value=="true");if(strip_whitespace)value=tinyMCE.regexpReplace(value,"[ \t\r\n]","");if(typeof(split_chr)!="undefined"&&split_chr!=null){value=value.split(split_chr);outArray=[];for(i=0;i<value.length;i++){if(value[i]&&value[i]!=='')ou
 tArray[outArray.length]=value[i]}value=outArray}return value},getLang:function(name,default_value,parse_entities,va){var v=(typeof(tinyMCELang[name])=="undefined")?default_value:tinyMCELang[name],n;if(parse_entities)v=tinyMCE.entityDecode(v);if(va){for(n in va)v=this.replaceVar(v,n,va[n])}return v},entityDecode:function(s){var e=document.createElement("div");e.innerHTML=s;return!e.firstChild?s:e.firstChild.nodeValue},addToLang:function(prefix,ar){var k;for(k in ar){if(typeof(ar[k])=='function')continue;tinyMCELang[(k.indexOf('lang_')==-1?'lang_':'')+(prefix!==''?(prefix+"_"):'')+k]=ar[k]}this.loadNextScript()},triggerNodeChange:function(focus,setup_content){var elm,inst,editorId,undoIndex=-1,undoLevels=-1,doc,anySelection,st;if(tinyMCE.selectedInstance){inst=tinyMCE.selectedInstance;elm=(typeof(setup_content)!="undefined"&&setup_content)?tinyMCE.selectedElement:inst.getFocusElement();editorId=inst.editorId;st=inst.selection.getSelectedText();if(tinyMCE.settings.auto_resize)i
 nst.resizeToContent();if(setup_content&&tinyMCE.isGecko&&inst.isHidden())elm=inst.getBody();inst.switchSettings();anySelection=!inst.selection.isCollapsed();if(tinyMCE.settings.custom_undo_redo){undoIndex=inst.undoRedo.undoIndex;undoLevels=inst.undoRedo.undoLevels.length}tinyMCE.dispatchCallback(inst,'handle_node_change_callback','handleNodeChange',editorId,elm,undoIndex,undoLevels,inst.visualAid,anySelection,setup_content)}if(this.selectedInstance&&(typeof(focus)=="undefined"||focus))this.selectedInstance.contentWindow.focus()},_customCleanup:function(inst,type,content){var pl,po,i,customCleanup;customCleanup=tinyMCE.settings.cleanup_callback;if(customCleanup!='')content=tinyMCE.resolveDots(tinyMCE.settings.cleanup_callback,window)(type,content,inst);po=tinyMCE.themes[tinyMCE.settings.theme];if(po&&po.cleanup)content=po.cleanup(type,content,inst);pl=inst.plugins;for(i=0;i<pl.length;i++){po=tinyMCE.plugins[pl[i]];if(po&&po.cleanup)content=po.cleanup(type,content,inst)}return
  content},setContent:function(h){if(tinyMCE.selectedInstance){tinyMCE.selectedInstance.execCommand('mceSetContent',false,h);tinyMCE.selectedInstance.repaint()}},importThemeLanguagePack:function(name){if(typeof(name)=="undefined")name=tinyMCE.settings.theme;tinyMCE.loadScript(tinyMCE.baseURL+'/themes/'+name+'/langs/'+tinyMCE.settings.language+'.js')},importPluginLanguagePack:function(name){var b=tinyMCE.baseURL+'/plugins/'+name;if(this.plugins[name])b=this.plugins[name].baseURL;tinyMCE.loadScript(b+'/langs/'+tinyMCE.settings.language+'.js')},applyTemplate:function(h,ag){return h.replace(new RegExp('\\{\\$([a-z0-9_]+)\\}','gi'),function(m,s){if(s.indexOf('lang_')==0&&tinyMCELang[s])return tinyMCELang[s];if(ag&&ag[s])return ag[s];if(tinyMCE.settings[s])return tinyMCE.settings[s];if(m=='themeurl')return tinyMCE.themeURL;return m})},replaceVar:function(h,r,v){return h.replace(new RegExp('{\\\$'+r+'}','g'),v)},openWindow:function(template,args){var html,width,height,x,y,resizable,
 scrollbars,url,name,win,modal,features;args=!args?{}:args;args.mce_template_file=template.file;args.mce_width=template.width;args.mce_height=template.height;tinyMCE.windowArgs=args;html=template.html;if(!(width=parseInt(template.width)))width=320;if(!(height=parseInt(template.height)))height=200;if(tinyMCE.isIE)height+=40;else height+=20;x=parseInt(screen.width/ 2.0) - (width /2.0);y=parseInt(screen.height/ 2.0) - (height /2.0);resizable=(args&&args.resizable)?args.resizable:"no";scrollbars=(args&&args.scrollbars)?args.scrollbars:"no";if(template.file.charAt(0)!='/'&&template.file.indexOf('://')==-1)url=tinyMCE.baseURL+"/themes/"+tinyMCE.getParam("theme")+"/"+template.file;else url=template.file;for(name in args){if(typeof(args[name])=='function')continue;url=tinyMCE.replaceVar(url,name,escape(args[name]))}if(html){html=tinyMCE.replaceVar(html,"css",this.settings.popups_css);html=tinyMCE.applyTemplate(html,args);win=window.open("","mcePopup"+new Date().getTime(),"top="+y+",l
 eft="+x+",scrollbars="+scrollbars+",dialog=yes,minimizable="+resizable+",modal=yes,width="+width+",height="+height+",resizable="+resizable);if(win==null){alert(tinyMCELang.lang_popup_blocked);return}win.document.write(html);win.document.close();win.resizeTo(width,height);win.focus()}else{if((tinyMCE.isRealIE)&&resizable!='yes'&&tinyMCE.settings.dialog_type=="modal"){height+=10;features="resizable:"+resizable+";scroll:"+scrollbars+";status:yes;center:yes;help:no;dialogWidth:"+width+"px;dialogHeight:"+height+"px;";window.showModalDialog(url,window,features)}else{modal=(resizable=="yes")?"no":"yes";if(tinyMCE.isGecko&&tinyMCE.isMac)modal="no";if(template.close_previous!="no")try{tinyMCE.lastWindow.close()}catch(ex){}win=window.open(url,"mcePopup"+new Date().getTime(),"top="+y+",left="+x+",scrollbars="+scrollbars+",dialog="+modal+",minimizable="+resizable+",modal="+modal+",width="+width+",height="+height+",resizable="+resizable);if(win==null){alert(tinyMCELang.lang_popup_blocked
 );return}if(template.close_previous!="no")tinyMCE.lastWindow=win;try{win.resizeTo(width,height)}catch(e){}if(tinyMCE.isGecko&&win.document){if(win.document.defaultView.statusbar.visible)win.resizeBy(0,tinyMCE.isMac?10:24)}win.focus()}}},closeWindow:function(win){win.close()},getVisualAidClass:function(class_name,state){var i,classNames,ar,className,aidClass=tinyMCE.settings.visual_table_class;if(typeof(state)=="undefined")state=tinyMCE.settings.visual;classNames=[];ar=class_name.split(' ');for(i=0;i<ar.length;i++){if(ar[i]==aidClass)ar[i]="";if(ar[i]!=='')classNames[classNames.length]=ar[i]}if(state)classNames[classNames.length]=aidClass;className="";for(i=0;i<classNames.length;i++){if(i>0)className+=" ";className+=classNames[i]}return className},handleVisualAid:function(el,deep,state,inst,skip_dispatch){var i,x,y,tableElement,anchorName,oldW,oldH,bo,cn;if(!el)return;if(!skip_dispatch)tinyMCE.dispatchCallback(inst,'handle_visual_aid_callback','handleVisualAid',el,deep,state,
 inst);tableElement=null;switch(el.nodeName){case"TABLE":oldW=el.style.width;oldH=el.style.height;bo=tinyMCE.getAttrib(el,"border");bo=bo==''||bo=="0"?true:false;tinyMCE.setAttrib(el,"class",tinyMCE.getVisualAidClass(tinyMCE.getAttrib(el,"class"),state&&bo));el.style.width=oldW;el.style.height=oldH;for(y=0;y<el.rows.length;y++){for(x=0;x<el.rows[y].cells.length;x++){cn=tinyMCE.getVisualAidClass(tinyMCE.getAttrib(el.rows[y].cells[x],"class"),state&&bo);tinyMCE.setAttrib(el.rows[y].cells[x],"class",cn)}}break;case"A":anchorName=tinyMCE.getAttrib(el,"name");if(anchorName!==''&&state){el.title=anchorName;tinyMCE.addCSSClass(el,'mceItemAnchor')}else if(anchorName!==''&&!state)el.className='';break}if(deep&&el.hasChildNodes()){for(i=0;i<el.childNodes.length;i++)tinyMCE.handleVisualAid(el.childNodes[i],deep,state,inst,true)}},fixGeckoBaseHREFBug:function(m,e,h){var xsrc,xhref;if(tinyMCE.isGecko){if(m==1){h=h.replace(/\ssrc=/gi," mce_tsrc=");h=h.replace(/\shref=/gi," mce_thref=");ret
 urn h}else{if(!new RegExp('(src|href)=','g').test(h))return h;tinyMCE.selectElements(e,'A,IMG,SELECT,AREA,IFRAME,BASE,INPUT,SCRIPT,EMBED,OBJECT,LINK',function(n){xsrc=tinyMCE.getAttrib(n,"mce_tsrc");xhref=tinyMCE.getAttrib(n,"mce_thref");if(xsrc!==''){try{n.src=tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings.base_href,xsrc)}catch(e){}n.removeAttribute("mce_tsrc")}if(xhref!==''){try{n.href=tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings.base_href,xhref)}catch(e){}n.removeAttribute("mce_thref")}return false});tinyMCE.selectNodes(e,function(n){if(n.nodeType==3||n.nodeType==8){n.nodeValue=n.nodeValue.replace(/\smce_tsrc=/gi," src=");n.nodeValue=n.nodeValue.replace(/\smce_thref=/gi," href=")}return false})}}return h},_setHTML:function(doc,html_content){var i,html,paras,node;html_content=tinyMCE.cleanupHTMLCode(html_content);try{tinyMCE.setInnerHTML(doc.body,html_content)}catch(e){if(this.isMSIE)doc.body.createTextRange().pasteHTML(html_content)}if(tinyMCE.isIE&&tinyMC
 E.settings.fix_content_duplication){paras=doc.getElementsByTagName("P");for(i=0;i<paras.length;i++){node=paras[i];while((node=node.parentNode)!=null){if(node.nodeName=="P")node.outerHTML=node.innerHTML}}html=doc.body.innerHTML;tinyMCE.setInnerHTML(doc.body,html)}tinyMCE.cleanupAnchors(doc);if(tinyMCE.getParam("convert_fonts_to_spans"))tinyMCE.convertSpansToFonts(doc)},getEditorId:function(form_element){var inst=this.getInstanceById(form_element);if(!inst)return null;return inst.editorId},getInstanceById:function(editor_id){var inst=this.instances[editor_id],n;if(!inst){for(n in tinyMCE.instances){inst=tinyMCE.instances[n];if(!tinyMCE.isInstance(inst))continue;if(inst.formTargetElementId==editor_id)return inst}}else return inst;return null},queryInstanceCommandValue:function(editor_id,command){var inst=tinyMCE.getInstanceById(editor_id);if(inst)return inst.queryCommandValue(command);return false},queryInstanceCommandState:function(editor_id,command){var inst=tinyMCE.getInstan
 ceById(editor_id);if(inst)return inst.queryCommandState(command);return null},setWindowArg:function(n,v){this.windowArgs[n]=v},getWindowArg:function(n,d){return(typeof(this.windowArgs[n])=="undefined")?d:this.windowArgs[n]},getCSSClasses:function(editor_id,doc){var i,c,x,rule,styles,rules,csses,selectorText,inst=tinyMCE.getInstanceById(editor_id);var cssClass,addClass,p;if(!inst)inst=tinyMCE.selectedInstance;if(!inst)return[];if(!doc)doc=inst.getDoc();if(inst&&inst.cssClasses.length>0)return inst.cssClasses;if(!doc)return;styles=doc.styleSheets;if(styles&&styles.length>0){for(x=0;x<styles.length;x++){csses=null;try{csses=tinyMCE.isIE?doc.styleSheets(x).rules:styles[x].cssRules}catch(e){}if(!csses)return[];for(i=0;i<csses.length;i++){selectorText=csses[i].selectorText;if(selectorText){rules=selectorText.split(',');for(c=0;c<rules.length;c++){rule=rules[c];while(rule.indexOf(' ')==0)rule=rule.substring(1);if(rule.indexOf(' ')!=-1||rule.indexOf(':')!=-1||rule.indexOf('mceItem')
 !=-1)continue;if(rule.indexOf(tinyMCE.settings.visual_table_class)!=-1||rule.indexOf('mceEditable')!=-1||rule.indexOf('mceNonEditable')!=-1)continue;if(rule.indexOf('.')!=-1){cssClass=rule.substring(rule.indexOf('.')+1);addClass=true;for(p=0;p<inst.cssClasses.length&&addClass;p++){if(inst.cssClasses[p]==cssClass)addClass=false}if(addClass)inst.cssClasses[inst.cssClasses.length]=cssClass}}}}}}return inst.cssClasses},regexpReplace:function(in_str,reg_exp,replace_str,opts){var re;if(in_str==null)return in_str;if(typeof(opts)=="undefined")opts='g';re=new RegExp(reg_exp,opts);return in_str.replace(re,replace_str)},trim:function(s){return s.replace(/^\s*|\s*$/g,"")},cleanupEventStr:function(s){s=""+s;s=s.replace('function anonymous()\n{\n','');s=s.replace('\n}','');s=s.replace(/^return true;/gi,'');return s},getControlHTML:function(c){var i,l,n,o,v,rtl=tinyMCE.getLang('lang_dir')=='rtl';l=tinyMCE.plugins;for(n in l){o=l[n];if(o.getControlHTML&&(v=o.getControlHTML(c))!==''){if(rtl)
 return'<span dir="rtl">'+tinyMCE.replaceVar(v,"pluginurl",o.baseURL)+'</span>';return tinyMCE.replaceVar(v,"pluginurl",o.baseURL)}}o=tinyMCE.themes[tinyMCE.settings.theme];if(o.getControlHTML&&(v=o.getControlHTML(c))!==''){if(rtl)return'<span dir="rtl">'+v+'</span>';return v}return''},evalFunc:function(f,idx,a,o){o=!o?window:o;f=typeof(f)=='function'?f:o[f];return f.apply(o,Array.prototype.slice.call(a,idx))},dispatchCallback:function(i,p,n){return this.callFunc(i,p,n,0,this.dispatchCallback.arguments)},executeCallback:function(i,p,n){return this.callFunc(i,p,n,1,this.executeCallback.arguments)},execCommandCallback:function(i,p,n){return this.callFunc(i,p,n,2,this.execCommandCallback.arguments)},callFunc:function(ins,p,n,m,a){var l,i,on,o,s,v;s=m==2;l=tinyMCE.getParam(p,'');if(l!==''&&(v=tinyMCE.evalFunc(l,3,a))==s&&m>0)return true;if(ins!=null){for(i=0,l=ins.plugins;i<l.length;i++){o=tinyMCE.plugins[l[i]];if(o[n]&&(v=tinyMCE.evalFunc(n,3,a,o))==s&&m>0)return true}}l=tinyMCE
 .themes;for(on in l){o=l[on];if(o[n]&&(v=tinyMCE.evalFunc(n,3,a,o))==s&&m>0)return true}return false},resolveDots:function(s,o){var i;if(typeof(s)=='string'){for(i=0,s=s.split('.');i<s.length;i++)o=o[s[i]]}else o=s;return o},xmlEncode:function(s){return s?(''+s).replace(this.xmlEncodeRe,function(c,b){switch(c){case'&':return'&amp;';case'"':return'&quot;';case'<':return'&lt;';case'>':return'&gt;'}return c}):s},add:function(c,m){var n;for(n in m){if(m.hasOwnProperty(n))c.prototype[n]=m[n]}},extend:function(p,np){var o={},n;o.parent=p;for(n in p){if(p.hasOwnProperty(n))o[n]=p[n]}for(n in np){if(np.hasOwnProperty(n))o[n]=np[n]}return o},hideMenus:function(){var e=tinyMCE.lastSelectedMenuBtn;if(tinyMCE.lastMenu){tinyMCE.lastMenu.hide();tinyMCE.lastMenu=null}if(e){tinyMCE.switchClass(e,tinyMCE.lastMenuBtnClass);tinyMCE.lastSelectedMenuBtn=null}}};var TinyMCE=TinyMCE_Engine;var tinyMCE=new TinyMCE_Engine();var tinyMCELang={};function TinyMCE_Control(settings){var t,i,tos,fu,p,x,fn,
 fu,pn,s=settings;this.undoRedoLevel=true;this.isTinyMCE_Control=true;this.enabled=true;this.settings=s;this.settings.theme=tinyMCE.getParam("theme","default");this.settings.width=tinyMCE.getParam("width",-1);this.settings.height=tinyMCE.getParam("height",-1);this.selection=new TinyMCE_Selection(this);this.undoRedo=new TinyMCE_UndoRedo(this);this.cleanup=new TinyMCE_Cleanup();this.shortcuts=[];this.hasMouseMoved=false;this.foreColor=this.backColor="#999999";this.data={};this.cssClasses=[];this.cleanup.init({valid_elements:s.valid_elements,extended_valid_elements:s.extended_valid_elements,valid_child_elements:s.valid_child_elements,entities:s.entities,entity_encoding:s.entity_encoding,debug:s.cleanup_debug,indent:s.apply_source_formatting,invalid_elements:s.invalid_elements,verify_html:s.verify_html,fix_content_duplication:s.fix_content_duplication,convert_fonts_to_spans:s.convert_fonts_to_spans});t=this.settings.theme;if(!tinyMCE.hasTheme(t)){fn=tinyMCE.callbacks;tos={};for(i
 =0;i<fn.length;i++){if((fu=window['TinyMCE_'+t+"_"+fn[i]]))tos[fn[i]]=fu}tinyMCE.addTheme(t,tos)}this.plugins=[];p=tinyMCE.getParam('plugins','',true,',');if(p.length>0){for(i=0;i<p.length;i++){pn=p[i];if(pn.charAt(0)=='-')pn=pn.substring(1);if(!tinyMCE.hasPlugin(pn)){fn=tinyMCE.callbacks;tos={};for(x=0;x<fn.length;x++){if((fu=window['TinyMCE_'+pn+"_"+fn[x]]))tos[fn[x]]=fu}tinyMCE.addPlugin(pn,tos)}this.plugins[this.plugins.length]=pn}}};TinyMCE_Control.prototype={selection:null,settings:null,cleanup:null,getData:function(na){var o=this.data[na];if(!o)o=this.data[na]={};return o},hasPlugin:function(n){var i;for(i=0;i<this.plugins.length;i++){if(this.plugins[i]==n)return true}return false},addPlugin:function(n,p){if(!this.hasPlugin(n)){tinyMCE.addPlugin(n,p);this.plugins[this.plugins.length]=n}},repaint:function(){var s,b,ex;if(tinyMCE.isRealIE)return;try{s=this.selection;b=s.getBookmark(true);this.getBody().style.display='none';this.getDoc().execCommand('selectall',false,nul
 l);this.getSel().collapseToStart();this.getBody().style.display='block';s.moveToBookmark(b)}catch(ex){}},switchSettings:function(){if(tinyMCE.configs.length>1&&tinyMCE.currentConfig!=this.settings.index){tinyMCE.settings=this.settings;tinyMCE.currentConfig=this.settings.index}},select:function(){var oldInst=tinyMCE.selectedInstance;if(oldInst!=this){if(oldInst)oldInst.execCommand('mceEndTyping');tinyMCE.dispatchCallback(this,'select_instance_callback','selectInstance',this,oldInst);tinyMCE.selectedInstance=this}},getBody:function(){return this.contentBody?this.contentBody:this.getDoc().body},getDoc:function(){return this.contentWindow.document},getWin:function(){return this.contentWindow},getContainerWin:function(){return this.containerWindow?this.containerWindow:window},getViewPort:function(){return tinyMCE.getViewPort(this.getWin())},getParentNode:function(n,f){return tinyMCE.getParentNode(n,f,this.getBody())},getParentElement:function(n,na,f){return tinyMCE.getParentEleme
 nt(n,na,f,this.getBody())},getParentBlockElement:function(n){return tinyMCE.getParentBlockElement(n,this.getBody())},resizeToContent:function(){var d=this.getDoc(),b=d.body,de=d.documentElement;this.iframeElement.style.height=(tinyMCE.isRealIE)?b.scrollHeight:de.offsetHeight+'px'},addShortcut:function(m,k,d,cmd,ui,va){var n=typeof(k)=="number",ie=tinyMCE.isIE,c,sc,i,scl=this.shortcuts;if(!tinyMCE.getParam('custom_shortcuts'))return false;m=m.toLowerCase();k=ie&&!n?k.toUpperCase():k;c=n?null:k.charCodeAt(0);d=d&&d.indexOf('lang_')==0?tinyMCE.getLang(d):d;sc={alt:m.indexOf('alt')!=-1,ctrl:m.indexOf('ctrl')!=-1,shift:m.indexOf('shift')!=-1,charCode:c,keyCode:n?k:(ie?c:null),desc:d,cmd:cmd,ui:ui,val:va};for(i=0;i<scl.length;i++){if(sc.alt==scl[i].alt&&sc.ctrl==scl[i].ctrl&&sc.shift==scl[i].shift&&sc.charCode==scl[i].charCode&&sc.keyCode==scl[i].keyCode){return false}}scl[scl.length]=sc;return true},handleShortcut:function(e){var i,s,o;if(!e.altKey&&!e.ctrlKey)return false;s=this
 .shortcuts;for(i=0;i<s.length;i++){o=s[i];if(o.alt==e.altKey&&o.ctrl==e.ctrlKey&&(o.keyCode==e.keyCode||o.charCode==e.charCode)){if(o.cmd&&(e.type=="keydown"||(e.type=="keypress"&&!tinyMCE.isOpera)))tinyMCE.execCommand(o.cmd,o.ui,o.val);tinyMCE.cancelEvent(e);return true}}return false},autoResetDesignMode:function(){if(!tinyMCE.isIE&&this.isHidden()&&tinyMCE.getParam('auto_reset_designmode'))eval('try { this.getDoc().designMode = "On"; this.useCSS = false; } catch(e) {}')},isHidden:function(){var s;if(tinyMCE.isIE)return false;s=this.getSel();return(!s||!s.rangeCount||s.rangeCount==0)},isDirty:function(){return tinyMCE.trim(this.startContent)!=tinyMCE.trim(this.getBody().innerHTML)&&!this.isNotDirty},_mergeElements:function(scmd,pa,ch,override){var st,stc,className,n;if(scmd=="removeformat"){pa.className="";pa.style.cssText="";ch.className="";ch.style.cssText="";return}st=tinyMCE.parseStyle(tinyMCE.getAttrib(pa,"style"));stc=tinyMCE.parseStyle(tinyMCE.getAttrib(ch,"style"));
 className=tinyMCE.getAttrib(pa,"class");className=tinyMCE.getAttrib(ch,"class");if(override){for(n in st){if(typeof(st[n])=='function')continue;stc[n]=st[n]}}else{for(n in stc){if(typeof(stc[n])=='function')continue;st[n]=stc[n]}}tinyMCE.setAttrib(pa,"style",tinyMCE.serializeStyle(st));tinyMCE.setAttrib(pa,"class",tinyMCE.trim(className));ch.className="";ch.style.cssText="";ch.removeAttribute("class");ch.removeAttribute("style")},_fixRootBlocks:function(){var rb,b,ne,be,nx,bm;rb=tinyMCE.getParam('forced_root_block');if(!rb)return;b=this.getBody();ne=b.firstChild;while(ne){nx=ne.nextSibling;if((ne.nodeType==3&&ne.nodeValue.replace(/\s+/g,'')!='')||(ne.nodeType==1&&!tinyMCE.blockRegExp.test(ne.nodeName))){if(!bm)bm=this.selection.getBookmark();if(!be){be=this.getDoc().createElement(rb);be.appendChild(ne.cloneNode(true));b.replaceChild(be,ne)}else{be.appendChild(ne.cloneNode(true));b.removeChild(ne)}}else be=null;ne=nx}if(bm)this.selection.moveToBookmark(bm)},_fixTrailingNbsp:f
 unction(){var s=this.selection,e=s.getFocusElement(),bm,v;if(e&&tinyMCE.blockRegExp.test(e.nodeName)&&e.firstChild){v=e.firstChild.nodeValue;if(v&&v.length>1&&/(^\u00a0|\u00a0$)/.test(v)){e.firstChild.nodeValue=v.replace(/(^\u00a0|\u00a0$)/,'');s.selectNode(e.firstChild,true,false,false);}}},_setUseCSS:function(b){var d=this.getDoc();try{d.execCommand("useCSS",false,!b)}catch(ex){}try{d.execCommand("styleWithCSS",false,b)}catch(ex){}if(!tinyMCE.getParam("table_inline_editing"))try{d.execCommand('enableInlineTableEditing',false,"false")}catch(ex){}if(!tinyMCE.getParam("object_resizing"))try{d.execCommand('enableObjectResizing',false,"false")}catch(ex){}},execCommand:function(command,user_interface,value){var i,x,z,align,img,div,doc=this.getDoc(),win=this.getWin(),focusElm=this.getFocusElement();if(!new RegExp('mceStartTyping|mceEndTyping|mceBeginUndoLevel|mceEndUndoLevel|mceAddUndoLevel','gi').test(command))this.undoBookmark=null;if(!tinyMCE.isIE&&!this.useCSS){this._setUseCS
 S(false);this.useCSS=true}this.contentDocument=doc;if(!/mceStartTyping|mceEndTyping/.test(command)){if(tinyMCE.execCommandCallback(this,'execcommand_callback','execCommand',this.editorId,this.getBody(),command,user_interface,value))return}if(focusElm&&focusElm.nodeName=="IMG"){align=focusElm.getAttribute('align');img=command=="JustifyCenter"?focusElm.cloneNode(false):focusElm;switch(command){case"JustifyLeft":if(align=='left'){img.setAttribute('align','');img.removeAttribute('align')}else img.setAttribute('align','left');div=focusElm.parentNode;if(div&&div.nodeName=="DIV"&&div.childNodes.length==1&&div.parentNode)div.parentNode.replaceChild(img,div);this.selection.selectNode(img);this.repaint();tinyMCE.triggerNodeChange();return;case"JustifyCenter":img.setAttribute('align','');img.removeAttribute('align');div=tinyMCE.getParentElement(focusElm,"div");if(div&&div.style.textAlign=="center"){if(div.nodeName=="DIV"&&div.childNodes.length==1&&div.parentNode)div.parentNode.replaceC
 hild(img,div)}else{div=this.getDoc().createElement("div");div.style.textAlign='center';div.appendChild(img);focusElm.parentNode.replaceChild(div,focusElm)}this.selection.selectNode(img);this.repaint();tinyMCE.triggerNodeChange();return;case"JustifyRight":if(align=='right'){img.setAttribute('align','');img.removeAttribute('align')}else img.setAttribute('align','right');div=focusElm.parentNode;if(div&&div.nodeName=="DIV"&&div.childNodes.length==1&&div.parentNode)div.parentNode.replaceChild(img,div);this.selection.selectNode(img);this.repaint();tinyMCE.triggerNodeChange();return}}if(tinyMCE.settings.force_br_newlines){var alignValue="";if(doc.selection.type!="Control"){switch(command){case"JustifyLeft":alignValue="left";break;case"JustifyCenter":alignValue="center";break;case"JustifyFull":alignValue="justify";break;case"JustifyRight":alignValue="right";break}if(alignValue!==''){var rng=doc.selection.createRange();if((divElm=tinyMCE.getParentElement(rng.parentElement(),"div"))!=
 null)divElm.setAttribute("align",alignValue);else if(rng.pasteHTML&&rng.htmlText.length>0)rng.pasteHTML('<div align="'+alignValue+'">'+rng.htmlText+"</div>");tinyMCE.triggerNodeChange();return}}}switch(command){case"mceRepaint":this.repaint();return true;case"JustifyLeft":case"JustifyCenter":case"JustifyFull":case"JustifyRight":var el=tinyMCE.getParentNode(focusElm,function(n){return tinyMCE.getAttrib(n,'align')});if(el){el.setAttribute('align','');el.removeAttribute('align')}else this.getDoc().execCommand(command,user_interface,value);tinyMCE.triggerNodeChange();return true;case"unlink":if(tinyMCE.isGecko&&this.getSel().isCollapsed){focusElm=tinyMCE.getParentElement(focusElm,'A');if(focusElm)this.selection.selectNode(focusElm,false)}this.getDoc().execCommand(command,user_interface,value);tinyMCE.isGecko&&this.getSel().collapseToEnd();tinyMCE.triggerNodeChange();return true;case"InsertUnorderedList":case"InsertOrderedList":this.getDoc().execCommand(command,user_interface,val
 ue);tinyMCE.triggerNodeChange();break;case"Strikethrough":this.getDoc().execCommand(command,user_interface,value);tinyMCE.triggerNodeChange();break;case"mceSelectNode":this.selection.selectNode(value);tinyMCE.triggerNodeChange();tinyMCE.selectedNode=value;break;case"FormatBlock":if(value==null||value==''){var elm=tinyMCE.getParentElement(this.getFocusElement(),"p,div,h1,h2,h3,h4,h5,h6,pre,address,blockquote,dt,dl,dd,samp");if(elm)this.execCommand("mceRemoveNode",false,elm)}else{if(!this.cleanup.isValid(value))return true;if(tinyMCE.isGecko&&new RegExp('<(div|blockquote|code|dt|dd|dl|samp)>','gi').test(value))value=value.replace(/[^a-z]/gi,'');if(tinyMCE.isIE&&new RegExp('blockquote|code|samp','gi').test(value)){var b=this.selection.getBookmark();this.getDoc().execCommand("FormatBlock",false,'<p>');tinyMCE.renameElement(tinyMCE.getParentBlockElement(this.getFocusElement()),value);this.selection.moveToBookmark(b)}else this.getDoc().execCommand("FormatBlock",false,value)}tinyMC
 E.triggerNodeChange();break;case"mceRemoveNode":if(!value)value=tinyMCE.getParentElement(this.getFocusElement());if(tinyMCE.isIE){value.outerHTML=value.innerHTML}else{var rng=value.ownerDocument.createRange();rng.setStartBefore(value);rng.setEndAfter(value);rng.deleteContents();rng.insertNode(rng.createContextualFragment(value.innerHTML))}tinyMCE.triggerNodeChange();break;case"mceSelectNodeDepth":var parentNode=this.getFocusElement();for(i=0;parentNode;i++){if(parentNode.nodeName.toLowerCase()=="body")break;if(parentNode.nodeName.toLowerCase()=="#text"){i--;parentNode=parentNode.parentNode;continue}if(i==value){this.selection.selectNode(parentNode,false);tinyMCE.triggerNodeChange();tinyMCE.selectedNode=parentNode;return}parentNode=parentNode.parentNode}break;case"mceSetStyleInfo":case"SetStyleInfo":var rng=this.getRng();var sel=this.getSel();var scmd=value.command;var sname=value.name;var svalue=value.value==null?'':value.value;var wrapper=value.wrapper?value.wrapper:"span";
 var parentElm=null;var invalidRe=new RegExp("^BODY|HTML$","g");var invalidParentsRe=tinyMCE.settings.merge_styles_invalid_parents!==''?new RegExp(tinyMCE.settings.merge_styles_invalid_parents,"gi"):null;if(tinyMCE.isIE){if(rng.item)parentElm=rng.item(0);else{var pelm=rng.parentElement();var prng=doc.selection.createRange();prng.moveToElementText(pelm);if(rng.htmlText==prng.htmlText||rng.boundingWidth==0){if(invalidParentsRe==null||!invalidParentsRe.test(pelm.nodeName))parentElm=pelm}}}else{var felm=this.getFocusElement();if(sel.isCollapsed||(new RegExp('td|tr|tbody|table|img','gi').test(felm.nodeName)&&sel.anchorNode==felm.parentNode))parentElm=felm}if(parentElm&&!invalidRe.test(parentElm.nodeName)){if(scmd=="setstyle")tinyMCE.setStyleAttrib(parentElm,sname,svalue);if(scmd=="setattrib")tinyMCE.setAttrib(parentElm,sname,svalue);if(scmd=="removeformat"){parentElm.style.cssText='';tinyMCE.setAttrib(parentElm,'class','')}var ch=tinyMCE.getNodeTree(parentElm,[],1);for(z=0;z<ch.le
 ngth;z++){if(ch[z]==parentElm)continue;if(scmd=="setstyle")tinyMCE.setStyleAttrib(ch[z],sname,'');if(scmd=="setattrib")tinyMCE.setAttrib(ch[z],sname,'');if(scmd=="removeformat"){ch[z].style.cssText='';tinyMCE.setAttrib(ch[z],'class','')}}}else{this._setUseCSS(false);doc.execCommand("FontName",false,"#mce_temp_font#");var elementArray=tinyMCE.getElementsByAttributeValue(this.getBody(),"font","face","#mce_temp_font#");for(x=0;x<elementArray.length;x++){elm=elementArray[x];if(elm){var spanElm=doc.createElement(wrapper);if(scmd=="setstyle")tinyMCE.setStyleAttrib(spanElm,sname,svalue);if(scmd=="setattrib")tinyMCE.setAttrib(spanElm,sname,svalue);if(scmd=="removeformat"){spanElm.style.cssText='';tinyMCE.setAttrib(spanElm,'class','')}if(elm.hasChildNodes()){for(i=0;i<elm.childNodes.length;i++)spanElm.appendChild(elm.childNodes[i].cloneNode(true))}spanElm.setAttribute("mce_new","true");elm.parentNode.replaceChild(spanElm,elm);var ch=tinyMCE.getNodeTree(spanElm,[],1);for(z=0;z<ch.leng
 th;z++){if(ch[z]==spanElm)continue;if(scmd=="setstyle")tinyMCE.setStyleAttrib(ch[z],sname,'');if(scmd=="setattrib")tinyMCE.setAttrib(ch[z],sname,'');if(scmd=="removeformat"){ch[z].style.cssText='';tinyMCE.setAttrib(ch[z],'class','')}}}}}var nodes=doc.getElementsByTagName(wrapper);for(i=nodes.length-1;i>=0;i--){var elm=nodes[i];var isNew=tinyMCE.getAttrib(elm,"mce_new")=="true";elm.removeAttribute("mce_new");if(elm.childNodes&&elm.childNodes.length==1&&elm.childNodes[0].nodeType==1){this._mergeElements(scmd,elm,elm.childNodes[0],isNew);continue}if(elm.parentNode.childNodes.length==1&&!invalidRe.test(elm.nodeName)&&!invalidRe.test(elm.parentNode.nodeName)){if(invalidParentsRe==null||!invalidParentsRe.test(elm.parentNode.nodeName))this._mergeElements(scmd,elm.parentNode,elm,false)}}var nodes=doc.getElementsByTagName(wrapper);for(i=nodes.length-1;i>=0;i--){var elm=nodes[i],isEmpty=true;var tmp=doc.createElement("body");tmp.appendChild(elm.cloneNode(false));tmp.innerHTML=tmp.inne
 rHTML.replace(new RegExp('style=""|class=""','gi'),'');if(new RegExp('<span>','gi').test(tmp.innerHTML)){for(x=0;x<elm.childNodes.length;x++){if(elm.parentNode!=null)elm.parentNode.insertBefore(elm.childNodes[x].cloneNode(true),elm)}elm.parentNode.removeChild(elm)}}if(scmd=="removeformat")tinyMCE.handleVisualAid(this.getBody(),true,this.visualAid,this);tinyMCE.triggerNodeChange();break;case"FontName":if(value==null){var s=this.getSel();if(tinyMCE.isGecko&&s.isCollapsed){var f=tinyMCE.getParentElement(this.getFocusElement(),"font");if(f!=null)this.selection.selectNode(f,false)}this.getDoc().execCommand("RemoveFormat",false,null);if(f!=null&&tinyMCE.isGecko){var r=this.getRng().cloneRange();r.collapse(true);s.removeAllRanges();s.addRange(r)}}else this.getDoc().execCommand('FontName',false,value);if(tinyMCE.isGecko)window.setTimeout('tinyMCE.triggerNodeChange(false);',1);return;case"FontSize":this.getDoc().execCommand('FontSize',false,value);if(tinyMCE.isGecko)window.setTimeout
 ('tinyMCE.triggerNodeChange(false);',1);return;case"forecolor":value=value==null?this.foreColor:value;value=tinyMCE.trim(value);value=value.charAt(0)!='#'?(isNaN('0x'+value)?value:'#'+value):value;this.foreColor=value;this.getDoc().execCommand('forecolor',false,value);break;case"HiliteColor":value=value==null?this.backColor:value;value=tinyMCE.trim(value);value=value.charAt(0)!='#'?(isNaN('0x'+value)?value:'#'+value):value;this.backColor=value;if(tinyMCE.isGecko||tinyMCE.isOpera){this._setUseCSS(true);this.getDoc().execCommand('hilitecolor',false,value);this._setUseCSS(false)}else this.getDoc().execCommand('BackColor',false,value);break;case"Cut":case"Copy":case"Paste":var cmdFailed=false;eval('try {this.getDoc().execCommand(command, user_interface, value);} catch (e) {cmdFailed = true;}');if(tinyMCE.isOpera&&cmdFailed)alert('Currently not supported by your browser, use keyboard shortcuts instead.');if(tinyMCE.isGecko&&cmdFailed){if(confirm(tinyMCE.entityDecode(tinyMCE.getLa
 ng('lang_clipboard_msg'))))window.open('http://www.mozilla.org/editor/midasdemo/securityprefs.html','mceExternal');return}else tinyMCE.triggerNodeChange();break;case"mceSetContent":if(!value)value="";value=tinyMCE.storeAwayURLs(value);value=tinyMCE._customCleanup(this,"insert_to_editor",value);if(this.getBody().nodeName=='BODY')tinyMCE._setHTML(doc,value);else this.getBody().innerHTML=value;tinyMCE.setInnerHTML(this.getBody(),tinyMCE._cleanupHTML(this,doc,this.settings,this.getBody(),false,false,false,true));tinyMCE.convertAllRelativeURLs(this.getBody());tinyMCE._removeInternal(this.getBody());if(tinyMCE.getParam("convert_fonts_to_spans"))tinyMCE.convertSpansToFonts(doc);tinyMCE.handleVisualAid(this.getBody(),true,this.visualAid,this);tinyMCE._setEventsEnabled(this.getBody(),false);this._addBogusBR();return true;case"mceCleanup":var b=this.selection.getBookmark();tinyMCE._setHTML(this.contentDocument,this.getBody().innerHTML);tinyMCE.setInnerHTML(this.getBody(),tinyMCE._clea
 nupHTML(this,this.contentDocument,this.settings,this.getBody(),this.visualAid));tinyMCE.convertAllRelativeURLs(doc.body);if(tinyMCE.getParam("convert_fonts_to_spans"))tinyMCE.convertSpansToFonts(doc);tinyMCE.handleVisualAid(this.getBody(),true,this.visualAid,this);tinyMCE._setEventsEnabled(this.getBody(),false);this._addBogusBR();this.repaint();this.selection.moveToBookmark(b);tinyMCE.triggerNodeChange();break;case"mceReplaceContent":if(!value)value='';this.getWin().focus();var selectedText="";if(tinyMCE.isIE){var rng=doc.selection.createRange();selectedText=rng.text}else selectedText=this.getSel().toString();if(selectedText.length>0){value=tinyMCE.replaceVar(value,"selection",selectedText);tinyMCE.execCommand('mceInsertContent',false,value)}this._addBogusBR();tinyMCE.triggerNodeChange();break;case"mceSetAttribute":if(typeof(value)=='object'){var targetElms=(typeof(value.targets)=="undefined")?"p,img,span,div,td,h1,h2,h3,h4,h5,h6,pre,address":value.targets;var targetNode=tin
 yMCE.getParentElement(this.getFocusElement(),targetElms);if(targetNode){targetNode.setAttribute(value.name,value.value);tinyMCE.triggerNodeChange()}}break;case"mceSetCSSClass":this.execCommand("mceSetStyleInfo",false,{command:"setattrib",name:"class",value:value});break;case"mceInsertRawHTML":var key='tiny_mce_marker';this.execCommand('mceBeginUndoLevel');this.execCommand('mceInsertContent',false,key);var scrollX=this.getBody().scrollLeft+this.getDoc().documentElement.scrollLeft;var scrollY=this.getBody().scrollTop+this.getDoc().documentElement.scrollTop;var html=this.getBody().innerHTML;if((pos=html.indexOf(key))!=-1)tinyMCE.setInnerHTML(this.getBody(),html.substring(0,pos)+value+html.substring(pos+key.length));this.contentWindow.scrollTo(scrollX,scrollY);this.execCommand('mceEndUndoLevel');break;case"mceInsertContent":if(!value)value='';var insertHTMLFailed=false;if(tinyMCE.isGecko||tinyMCE.isOpera){try{if(value.indexOf('<')==-1&&!value.match(/(&#38;|&#160;|&#60;|&#62;)/g)
 ){var r=this.getRng();var n=this.getDoc().createTextNode(tinyMCE.entityDecode(value));var s=this.getSel();var r2=r.cloneRange();s.removeAllRanges();r.deleteContents();r.insertNode(n);r2.selectNode(n);r2.collapse(false);s.removeAllRanges();s.addRange(r2)}else{value=tinyMCE.fixGeckoBaseHREFBug(1,this.getDoc(),value);this.getDoc().execCommand('inserthtml',false,value);tinyMCE.fixGeckoBaseHREFBug(2,this.getDoc(),value)}}catch(ex){insertHTMLFailed=true}if(!insertHTMLFailed){tinyMCE.triggerNodeChange();return}}if(!tinyMCE.isIE){var isHTML=value.indexOf('<')!=-1;var sel=this.getSel();var rng=this.getRng();if(isHTML){if(tinyMCE.isSafari){var tmpRng=this.getDoc().createRange();tmpRng.setStart(this.getBody(),0);tmpRng.setEnd(this.getBody(),0);value=tmpRng.createContextualFragment(value)}else value=rng.createContextualFragment(value)}else{value=doc.createTextNode(tinyMCE.entityDecode(value))}if(tinyMCE.isSafari&&!isHTML){this.execCommand('InsertText',false,value.nodeValue);tinyMCE.trig
 gerNodeChange();return true}else if(tinyMCE.isSafari&&isHTML){rng.deleteContents();rng.insertNode(value);tinyMCE.triggerNodeChange();return true}rng.deleteContents();if(rng.startContainer.nodeType==3){var node=rng.startContainer.splitText(rng.startOffset);node.parentNode.insertBefore(value,node)}else rng.insertNode(value);if(!isHTML){sel.selectAllChildren(doc.body);sel.removeAllRanges();var rng=doc.createRange();rng.selectNode(value);rng.collapse(false);sel.addRange(rng)}else rng.collapse(false);tinyMCE.fixGeckoBaseHREFBug(2,this.getDoc(),value)}else{var rng=doc.selection.createRange(),tmpRng=null;var c=value.indexOf('<!--')!=-1;if(c)value=tinyMCE.uniqueTag+value;if(rng.item)rng.item(0).outerHTML=value;else rng.pasteHTML(value);if(c){var e=this.getDoc().getElementById('mceTMPElement');e.parentNode.removeChild(e)}}tinyMCE.execCommand("mceAddUndoLevel");tinyMCE.triggerNodeChange();break;case"mceStartTyping":if(tinyMCE.settings.custom_undo_redo&&this.undoRedo.typingUndoIndex==-
 1){this.undoRedo.typingUndoIndex=this.undoRedo.undoIndex;tinyMCE.typingUndoIndex=tinyMCE.undoIndex;this.execCommand('mceAddUndoLevel')}break;case"mceEndTyping":if(tinyMCE.settings.custom_undo_redo&&this.undoRedo.typingUndoIndex!=-1){this.execCommand('mceAddUndoLevel');this.undoRedo.typingUndoIndex=-1}tinyMCE.typingUndoIndex=-1;break;case"mceBeginUndoLevel":this.undoRedoLevel=false;break;case"mceEndUndoLevel":this.undoRedoLevel=true;this.execCommand('mceAddUndoLevel');break;case"mceAddUndoLevel":if(tinyMCE.settings.custom_undo_redo&&this.undoRedoLevel){if(this.undoRedo.add())tinyMCE.triggerNodeChange(false)}break;case"Undo":if(tinyMCE.settings.custom_undo_redo){tinyMCE.execCommand("mceEndTyping");this.undoRedo.undo();tinyMCE.triggerNodeChange()}else this.getDoc().execCommand(command,user_interface,value);break;case"Redo":if(tinyMCE.settings.custom_undo_redo){tinyMCE.execCommand("mceEndTyping");this.undoRedo.redo();tinyMCE.triggerNodeChange()}else this.getDoc().execCommand(com
 mand,user_interface,value);break;case"mceToggleVisualAid":this.visualAid=!this.visualAid;tinyMCE.handleVisualAid(this.getBody(),true,this.visualAid,this);tinyMCE.triggerNodeChange();break;case"Indent":this.getDoc().execCommand(command,user_interface,value);tinyMCE.triggerNodeChange();if(tinyMCE.isIE){var n=tinyMCE.getParentElement(this.getFocusElement(),"blockquote");do{if(n&&n.nodeName=="BLOCKQUOTE"){n.removeAttribute("dir");n.removeAttribute("style")}}while(n!=null&&(n=n.parentNode)!=null)}break;case"RemoveFormat":case"removeformat":var text=this.selection.getSelectedText();if(tinyMCE.isOpera){this.getDoc().execCommand("RemoveFormat",false,null);return}if(tinyMCE.isIE){try{var rng=doc.selection.createRange();rng.execCommand("RemoveFormat",false,null)}catch(e){}this.execCommand("mceSetStyleInfo",false,{command:"removeformat"})}else{this.getDoc().execCommand(command,user_interface,value);this.execCommand("mceSetStyleInfo",false,{command:"removeformat"})}if(text.length==0)thi
 s.execCommand("mceSetCSSClass",false,"");tinyMCE.triggerNodeChange();break;default:this.getDoc().execCommand(command,user_interface,value);if(tinyMCE.isGecko)window.setTimeout('tinyMCE.triggerNodeChange(false);',1);else tinyMCE.triggerNodeChange()}if(command!="mceAddUndoLevel"&&command!="Undo"&&command!="Redo"&&command!="mceStartTyping"&&command!="mceEndTyping")tinyMCE.execCommand("mceAddUndoLevel")},queryCommandValue:function(c){try{return this.getDoc().queryCommandValue(c)}catch(e){return null}},queryCommandState:function(c){return this.getDoc().queryCommandState(c)},_addBogusBR:function(){var b=this.getBody();if(tinyMCE.isGecko&&!b.hasChildNodes())b.innerHTML='<br _moz_editor_bogus_node="TRUE" />'},_onAdd:function(replace_element,form_element_name,target_document){var hc,th,tos,editorTemplate,targetDoc,deltaWidth,deltaHeight,html,rng,fragment;var dynamicIFrame,tElm,doc,parentElm;th=this.settings.theme;tos=tinyMCE.themes[th];targetDoc=target_document?target_document:docume
 nt;this.targetDoc=targetDoc;tinyMCE.themeURL=tinyMCE.baseURL+"/themes/"+this.settings.theme;this.settings.themeurl=tinyMCE.themeURL;if(!replace_element){alert("Error: Could not find the target element.");return false}if(tos.getEditorTemplate)editorTemplate=tos.getEditorTemplate(this.settings,this.editorId);deltaWidth=editorTemplate.delta_width?editorTemplate.delta_width:0;deltaHeight=editorTemplate.delta_height?editorTemplate.delta_height:0;html='<span id="'+this.editorId+'_parent" class="mceEditorContainer">'+editorTemplate.html;html=tinyMCE.replaceVar(html,"editor_id",this.editorId);if(!this.settings.default_document)this.settings.default_document=tinyMCE.baseURL+"/blank.htm";this.settings.old_width=this.settings.width;this.settings.old_height=this.settings.height;if(this.settings.width==-1)this.settings.width=replace_element.offsetWidth;if(this.settings.height==-1)this.settings.height=replace_element.offsetHeight;if(this.settings.width==0)this.settings.width=replace_eleme
 nt.style.width;if(this.settings.height==0)this.settings.height=replace_element.style.height;if(this.settings.width==0)this.settings.width=320;if(this.settings.height==0)this.settings.height=240;this.settings.area_width=parseInt(this.settings.width);this.settings.area_height=parseInt(this.settings.height);this.settings.area_width+=deltaWidth;this.settings.area_height+=deltaHeight;this.settings.width_style=""+this.settings.width;this.settings.height_style=""+this.settings.height;if((""+this.settings.width).indexOf('%')!=-1)this.settings.area_width="100%";else this.settings.width_style+='px';if((""+this.settings.height).indexOf('%')!=-1)this.settings.area_height="100%";else this.settings.height_style+='px';if((""+replace_element.style.width).indexOf('%')!=-1){this.settings.width=replace_element.style.width;this.settings.area_width="100%";this.settings.width_style="100%"}if((""+replace_element.style.height).indexOf('%')!=-1){this.settings.height=replace_element.style.height;this
 .settings.area_height="100%";this.settings.height_style="100%"}html=tinyMCE.applyTemplate(html);this.settings.width=this.settings.old_width;this.settings.height=this.settings.old_height;this.visualAid=this.settings.visual;this.formTargetElementId=form_element_name;if(replace_element.nodeName=="TEXTAREA"||replace_element.nodeName=="INPUT")this.startContent=replace_element.value;else this.startContent=replace_element.innerHTML;if(replace_element.nodeName!="TEXTAREA"&&replace_element.nodeName!="INPUT"){this.oldTargetElement=replace_element;hc='<input type="hidden" id="'+form_element_name+'" name="'+form_element_name+'" />';this.oldTargetDisplay=tinyMCE.getStyle(this.oldTargetElement,'display','inline');this.oldTargetElement.style.display="none";html+='</span>';if(tinyMCE.isGecko)html=hc+html;else html+=hc;if(tinyMCE.isGecko){rng=replace_element.ownerDocument.createRange();rng.setStartBefore(replace_element);fragment=rng.createContextualFragment(html);tinyMCE.insertAfter(fragmen
 t,replace_element)}else replace_element.insertAdjacentHTML("beforeBegin",html)}else{html+='</span>';this.oldTargetElement=replace_element;this.oldTargetDisplay=tinyMCE.getStyle(this.oldTargetElement,'display','inline');this.oldTargetElement.style.display="none";if(tinyMCE.isGecko){rng=replace_element.ownerDocument.createRange();rng.setStartBefore(replace_element);fragment=rng.createContextualFragment(html);tinyMCE.insertAfter(fragment,replace_element)}else replace_element.insertAdjacentHTML("beforeBegin",html)}dynamicIFrame=false;tElm=targetDoc.getElementById(this.editorId);if(!tinyMCE.isIE){if(tElm&&(tElm.nodeName=="SPAN"||tElm.nodeName=="span")){tElm=tinyMCE._createIFrame(tElm,targetDoc);dynamicIFrame=true}this.targetElement=tElm;this.iframeElement=tElm;this.contentDocument=tElm.contentDocument;this.contentWindow=tElm.contentWindow;}else{if(tElm&&tElm.nodeName=="SPAN")tElm=tinyMCE._createIFrame(tElm,targetDoc,targetDoc.parentWindow);else tElm=targetDoc.frames[this.editorId
 ];this.targetElement=tElm;this.iframeElement=targetDoc.getElementById(this.editorId);if(tinyMCE.isOpera){this.contentDocument=this.iframeElement.contentDocument;this.contentWindow=this.iframeElement.contentWindow;dynamicIFrame=true}else{this.contentDocument=tElm.window.document;this.contentWindow=tElm.window}this.getDoc().designMode="on"}doc=this.contentDocument;if(dynamicIFrame){html=tinyMCE.getParam('doctype')+'<html><head xmlns="http://www.w3.org/1999/xhtml"><base href="'+tinyMCE.settings.base_href+'" /><title>blank_page</title><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"></head><body class="mceContentBody"></body></html>';try{if(!this.isHidden())this.getDoc().designMode="on";doc.open();doc.write(html);doc.close()}catch(e){this.getDoc().location.href=tinyMCE.baseURL+"/blank.htm"}}if(tinyMCE.isIE)window.setTimeout("tinyMCE.addEventHandlers(tinyMCE.instances[\""+this.editorId+"\"]);",1);parentElm=this.targetDoc.getElementById(this.editorId+'_parent');t
 his.formElement=tinyMCE.isGecko?parentElm.previousSibling:parentElm.nextSibling;tinyMCE.setupContent(this.editorId,true);return true},setBaseHREF:function(u){var h,b,d,nl;d=this.getDoc();nl=d.getElementsByTagName("base");b=nl.length>0?nl[0]:null;if(!b){nl=d.getElementsByTagName("head");h=nl.length>0?nl[0]:null;b=d.createElement("base");b.setAttribute('href',u);h.appendChild(b)}else{if(u==''||u==null)b.parentNode.removeChild(b);else b.setAttribute('href',u)}},getHTML:function(r){var h,d=this.getDoc(),b=this.getBody();if(r)return b.innerHTML;h=tinyMCE._cleanupHTML(this,d,this.settings,b,false,true,false,true);if(tinyMCE.getParam("convert_fonts_to_spans"))tinyMCE.convertSpansToFonts(d);return h},setHTML:function(h){this.execCommand('mceSetContent',false,h);this.repaint()},getFocusElement:function(){return this.selection.getFocusElement()},getSel:function(){return this.selection.getSel()},getRng:function(){return this.selection.getRng()},triggerSave:function(skip_cleanup,skip_ca
 llback){var e,nl=[],i,s,content,htm;if(!this.enabled)return;this.switchSettings();s=tinyMCE.settings;if(tinyMCE.isRealIE){e=this.iframeElement;do{if(e.style&&e.style.display=='none'){e.style.display='block';nl[nl.length]={elm:e,type:'style'}}if(e.style&&s.hidden_tab_class.length>0&&e.className.indexOf(s.hidden_tab_class)!=-1){e.className=s.display_tab_class;nl[nl.length]={elm:e,type:'class'}}}while((e=e.parentNode)!=null)}tinyMCE.settings.preformatted=false;if(typeof(skip_cleanup)=="undefined")skip_cleanup=false;if(typeof(skip_callback)=="undefined")skip_callback=false;tinyMCE._setHTML(this.getDoc(),this.getBody().innerHTML);if(this.settings.cleanup==false){tinyMCE.handleVisualAid(this.getBody(),true,false,this);tinyMCE._setEventsEnabled(this.getBody(),true)}tinyMCE._customCleanup(this,"submit_content_dom",this.contentWindow.document.body);htm=skip_cleanup?this.getBody().innerHTML:tinyMCE._cleanupHTML(this,this.getDoc(),this.settings,this.getBody(),tinyMCE.visualAid,true,tru
 e);htm=tinyMCE._customCleanup(this,"submit_content",htm);if(!skip_callback&&tinyMCE.settings.save_callback!=='')content=tinyMCE.resolveDots(tinyMCE.settings.save_callback,window)(this.formTargetElementId,htm,this.getBody());if((typeof(content)!="undefined")&&content!=null)htm=content;htm=tinyMCE.regexpReplace(htm,"&#40;","(","gi");htm=tinyMCE.regexpReplace(htm,"&#41;",")","gi");htm=tinyMCE.regexpReplace(htm,"&#59;",";","gi");htm=tinyMCE.regexpReplace(htm,"&#34;","&quot;","gi");htm=tinyMCE.regexpReplace(htm,"&#94;","^","gi");if(this.formElement)this.formElement.value=htm;if(tinyMCE.isSafari&&this.formElement)this.formElement.innerText=htm;for(i=0;i<nl.length;i++){if(nl[i].type=='style')nl[i].elm.style.display='none';else nl[i].elm.className=s.hidden_tab_class}}};tinyMCE.add(TinyMCE_Engine,{cleanupHTMLCode:function(s){s=s.replace(new RegExp('<p \\/>','gi'),'<p>&nbsp;</p>');s=s.replace(new RegExp('<p>\\s*<\\/p>','gi'),'<p>&nbsp;</p>');s=s.replace(new RegExp('<br>\\s*<\\/br>','g
 i'),'<br />');s=s.replace(new RegExp('<(h[1-6]|p|div|address|pre|form|table|li|ol|ul|td|b|font|em|strong|i|strike|u|span|a|ul|ol|li|blockquote)([a-z]*)([^\\\\|>]*)\\/>','gi'),'<$1$2$3></$1$2>');s=s.replace(new RegExp('\\s+></','gi'),'></');s=s.replace(new RegExp('<(img|br|hr)([^>]*)><\\/(img|br|hr)>','gi'),'<$1$2 />');if(tinyMCE.isIE)s=s.replace(new RegExp('<p><hr \\/><\\/p>','gi'),"<hr>");if(tinyMCE.isIE)s=s.replace(/<!(\s*)\/>/g,'');return s},parseStyle:function(str){var ar=[],st,i,re,pa;if(str==null)return ar;st=str.split(';');tinyMCE.clearArray(ar);for(i=0;i<st.length;i++){if(st[i]=='')continue;re=new RegExp('^\\s*([^:]*):\\s*(.*)\\s*$');pa=st[i].replace(re,'$1||$2').split('||');if(pa.length==2)ar[pa[0].toLowerCase()]=pa[1]}return ar},compressStyle:function(ar,pr,sf,res){var box=[],i,a;box[0]=ar[pr+'-top'+sf];box[1]=ar[pr+'-left'+sf];box[2]=ar[pr+'-right'+sf];box[3]=ar[pr+'-bottom'+sf];for(i=0;i<box.length;i++){if(box[i]==null)return;if(i&&box[i]!=box[i-1])return}ar[res]
 =box[0];ar[pr+'-top'+sf]=null;ar[pr+'-left'+sf]=null;ar[pr+'-right'+sf]=null;ar[pr+'-bottom'+sf]=null},serializeStyle:function(ar){var str="",key,val,m;tinyMCE.compressStyle(ar,"border","","border");tinyMCE.compressStyle(ar,"border","-width","border-width");tinyMCE.compressStyle(ar,"border","-color","border-color");tinyMCE.compressStyle(ar,"border","-style","border-style");tinyMCE.compressStyle(ar,"padding","","padding");tinyMCE.compressStyle(ar,"margin","","margin");for(key in ar){val=ar[key];if(typeof(val)=='function')continue;if(key.indexOf('mso-')==0)continue;if(val!=null&&val!==''){val=''+val;val=val.replace(new RegExp("url\\(\\'?([^\\']*)\\'?\\)",'gi'),"url('$1')");if(val.indexOf('url(')!=-1&&tinyMCE.getParam('convert_urls')){m=new RegExp("url\\('(.*?)'\\)").exec(val);if(m.length>1)val="url('"+eval(tinyMCE.getParam('urlconverter_callback')+"(m[1], null, true);")+"')"}if(tinyMCE.getParam("force_hex_style_colors"))val=tinyMCE.convertRGBToHex(val,true);val=val.replace(/\"
 /g,'\'');if(val!="url('')")str+=key.toLowerCase()+": "+val+"; "}}if(new RegExp('; $').test(str))str=str.substring(0,str.length-2);return str},convertRGBToHex:function(s,k){var re,rgb;if(s.toLowerCase().indexOf('rgb')!=-1){re=new RegExp("(.*?)rgb\\s*?\\(\\s*?([0-9]+).*?,\\s*?([0-9]+).*?,\\s*?([0-9]+).*?\\)(.*?)","gi");rgb=s.replace(re,"$1,$2,$3,$4,$5").split(',');if(rgb.length==5){r=parseInt(rgb[1]).toString(16);g=parseInt(rgb[2]).toString(16);b=parseInt(rgb[3]).toString(16);r=r.length==1?'0'+r:r;g=g.length==1?'0'+g:g;b=b.length==1?'0'+b:b;s="#"+r+g+b;if(k)s=rgb[0]+s+rgb[4]}}return s},convertHexToRGB:function(s){if(s.indexOf('#')!=-1){s=s.replace(new RegExp('[^0-9A-F]','gi'),'');return"rgb("+parseInt(s.substring(0,2),16)+","+parseInt(s.substring(2,4),16)+","+parseInt(s.substring(4,6),16)+")"}return s},convertSpansToFonts:function(doc){var s,i,size,fSize,x,fFace,fColor,sizes=tinyMCE.getParam('font_size_style_values').replace(/\s+/,'').split(',');s=tinyMCE.selectElements(doc,'s
 pan,font');for(i=0;i<s.length;i++){size=tinyMCE.trim(s[i].style.fontSize).toLowerCase();fSize=0;for(x=0;x<sizes.length;x++){if(sizes[x]==size){fSize=x+1;break}}if(fSize>0){tinyMCE.setAttrib(s[i],'size',fSize);s[i].style.fontSize=''}fFace=s[i].style.fontFamily;if(fFace!=null&&fFace!==''){tinyMCE.setAttrib(s[i],'face',fFace);s[i].style.fontFamily=''}fColor=s[i].style.color;if(fColor!=null&&fColor!==''){tinyMCE.setAttrib(s[i],'color',tinyMCE.convertRGBToHex(fColor));s[i].style.color=''}}},convertFontsToSpans:function(doc){var fsClasses,s,i,fSize,fFace,fColor,sizes=tinyMCE.getParam('font_size_style_values').replace(/\s+/,'').split(',');fsClasses=tinyMCE.getParam('font_size_classes');if(fsClasses!=='')fsClasses=fsClasses.replace(/\s+/,'').split(',');else fsClasses=null;s=tinyMCE.selectElements(doc,'span,font');for(i=0;i<s.length;i++){fSize=tinyMCE.getAttrib(s[i],'size');fFace=tinyMCE.getAttrib(s[i],'face');fColor=tinyMCE.getAttrib(s[i],'color');if(fSize!==''){fSize=parseInt(fSize
 );if(fSize>0&&fSize<8){if(fsClasses!=null)tinyMCE.setAttrib(s[i],'class',fsClasses[fSize-1]);else s[i].style.fontSize=sizes[fSize-1]}s[i].removeAttribute('size')}if(fFace!==''){s[i].style.fontFamily=fFace;s[i].removeAttribute('face')}if(fColor!==''){s[i].style.color=fColor;s[i].removeAttribute('color')}}},cleanupAnchors:function(doc){var i,cn,x,an=doc.getElementsByTagName("a");for(i=an.length-1;i>=0;i--){if(tinyMCE.getAttrib(an[i],"name")!==''&&tinyMCE.getAttrib(an[i],"href")==''){cn=an[i].childNodes;for(x=cn.length-1;x>=0;x--)tinyMCE.insertAfter(cn[x],an[i])}}},getContent:function(editor_id){if(typeof(editor_id)!="undefined")tinyMCE.getInstanceById(editor_id).select();if(tinyMCE.selectedInstance)return tinyMCE.selectedInstance.getHTML();return null},_fixListElements:function(d){var nl,x,a=['ol','ul'],i,n,p,r=new RegExp('^(OL|UL)$'),np;for(x=0;x<a.length;x++){nl=d.getElementsByTagName(a[x]);for(i=0;i<nl.length;i++){n=nl[i];p=n.parentNode;if(r.test(p.nodeName)){np=tinyMCE.pre
 vNode(n,'LI');if(!np){np=d.createElement('li');np.innerHTML='&nbsp;';np.appendChild(n);p.insertBefore(np,p.firstChild)}else np.appendChild(n)}}}},_fixTables:function(d){var nl,i,n,p,np,x,t;nl=d.getElementsByTagName('table');for(i=0;i<nl.length;i++){n=nl[i];if((p=tinyMCE.getParentElement(n,'p,h1,h2,h3,h4,h5,h6'))!=null){np=p.cloneNode(false);np.removeAttribute('id');t=n;while((n=n.nextSibling))np.appendChild(n);tinyMCE.insertAfter(np,p);tinyMCE.insertAfter(t,p)}}},_cleanupHTML:function(inst,doc,config,elm,visual,on_save,on_submit,inn){var h,d,t1,t2,t3,t4,t5,c,s,nb;if(!tinyMCE.getParam('cleanup'))return elm.innerHTML;on_save=typeof(on_save)=='undefined'?false:on_save;c=inst.cleanup;s=inst.settings;d=c.settings.debug;if(d)t1=new Date().getTime();inst._fixRootBlocks();if(tinyMCE.getParam("convert_fonts_to_spans"))tinyMCE.convertFontsToSpans(doc);if(tinyMCE.getParam("fix_list_elements"))tinyMCE._fixListElements(doc);if(tinyMCE.getParam("fix_table_elements"))tinyMCE._fixTables(doc
 );tinyMCE._customCleanup(inst,on_save?"get_from_editor_dom":"insert_to_editor_dom",doc.body);if(d)t2=new Date().getTime();c.settings.on_save=on_save;c.idCount=0;c.serializationId++;c.serializedNodes=[];c.sourceIndex=-1;if(s.cleanup_serializer=="xml")h=c.serializeNodeAsXML(elm,inn);else h=c.serializeNodeAsHTML(elm,inn);if(d)t3=new Date().getTime();nb=tinyMCE.getParam('entity_encoding')=='numeric'?'&#160;':'&nbsp;';h=h.replace(/<\/?(body|head|html)[^>]*>/gi,'');h=h.replace(new RegExp(' (rowspan="1"|colspan="1")','g'),'');h=h.replace(/<p><hr \/><\/p>/g,'<hr />');h=h.replace(/<p>(&nbsp;|&#160;)<\/p><hr \/><p>(&nbsp;|&#160;)<\/p>/g,'<hr />');h=h.replace(/<td>\s*<br \/>\s*<\/td>/g,'<td>'+nb+'</td>');h=h.replace(/<p>\s*<br \/>\s*<\/p>/g,'<p>'+nb+'</p>');h=h.replace(/<br \/>$/,'');h=h.replace(/<br \/><\/p>/g,'</p>');h=h.replace(/<p>\s*(&nbsp;|&#160;)\s*<br \/>\s*(&nbsp;|&#160;)\s*<\/p>/g,'<p>'+nb+'</p>');h=h.replace(/<p>\s*(&nbsp;|&#160;)\s*<br \/>\s*<\/p>/g,'<p>'+nb+'</p>');h=h.rep
 lace(/<p>\s*<br \/>\s*&nbsp;\s*<\/p>/g,'<p>'+nb+'</p>');h=h.replace(new RegExp('<a>(.*?)<\\/a>','g'),'$1');h=h.replace(/<p([^>]*)>\s*<\/p>/g,'<p$1>'+nb+'</p>');if(/^\s*(<br \/>|<p>&nbsp;<\/p>|<p>&#160;<\/p>|<p><\/p>)\s*$/.test(h))h='';if(s.preformatted){h=h.replace(/^<pre>/,'');h=h.replace(/<\/pre>$/,'');h='<pre>'+h+'</pre>'}if(tinyMCE.isGecko){h=h.replace(/<br \/>\s*<\/li>/g,'</li>');h=h.replace(/&nbsp;\s*<\/(dd|dt)>/g,'</$1>');h=h.replace(/<o:p _moz-userdefined="" \/>/g,'');h=h.replace(/<td([^>]*)>\s*<br \/>\s*<\/td>/g,'<td$1>'+nb+'</td>')}if(s.force_br_newlines)h=h.replace(/<p>(&nbsp;|&#160;)<\/p>/g,'<br />');h=tinyMCE._customCleanup(inst,on_save?"get_from_editor":"insert_to_editor",h);if(on_save){h=h.replace(new RegExp(' ?(mceItem[a-zA-Z0-9]*|'+s.visual_table_class+')','g'),'');h=h.replace(new RegExp(' ?class=""','g'),'')}if(s.remove_linebreaks&&!c.settings.indent)h=h.replace(/\n|\r/g,' ');if(d)t4=new Date().getTime();if(on_save&&c.settings.indent)h=c.formatHTML(h);if(on
 _submit&&(s.encoding=="xml"||s.encoding=="html"))h=c.xmlEncode(h);if(d)t5=new Date().getTime();if(c.settings.debug)tinyMCE.debug("Cleanup in ms: Pre="+(t2-t1)+", Serialize: "+(t3-t2)+", Post: "+(t4-t3)+", Format: "+(t5-t4)+", Sum: "+(t5-t1)+".");return h}});function TinyMCE_Cleanup(){this.isIE=(navigator.appName=="Microsoft Internet Explorer");this.rules=tinyMCE.clearArray([]);this.settings={indent_elements:'head,table,tbody,thead,tfoot,form,tr,ul,ol,blockquote,object',newline_before_elements:'h1,h2,h3,h4,h5,h6,pre,address,div,ul,ol,li,meta,option,area,title,link,base,script,td',newline_after_elements:'br,hr,p,pre,address,div,ul,ol,meta,option,area,link,base,script',newline_before_after_elements:'html,head,body,table,thead,tbody,tfoot,tr,form,ul,ol,blockquote,p,object,param,hr,div',indent_char:'\t',indent_levels:1,entity_encoding:'raw',valid_elements:'*[*]',entities:'',url_converter:'',invalid_elements:'',verify_html:false};this.vElements=tinyMCE.clearArray([]);this.vElement
 sRe='';this.closeElementsRe=/^(IMG|BR|HR|LINK|META|BASE|INPUT|AREA)$/;this.codeElementsRe=/^(SCRIPT|STYLE)$/;this.serializationId=0;this.mceAttribs={href:'mce_href',src:'mce_src',type:'mce_type'}}TinyMCE_Cleanup.prototype={init:function(s){var n,a,i,ir,or,st;for(n in s)this.settings[n]=s[n];s=this.settings;this.inRe=this._arrayToRe(s.indent_elements.split(','),'','^<(',')[^>]*');this.ouRe=this._arrayToRe(s.indent_elements.split(','),'','^<\\/(',')[^>]*');this.nlBeforeRe=this._arrayToRe(s.newline_before_elements.split(','),'gi','<(',')([^>]*)>');this.nlAfterRe=this._arrayToRe(s.newline_after_elements.split(','),'gi','<(',')([^>]*)>');this.nlBeforeAfterRe=this._arrayToRe(s.newline_before_after_elements.split(','),'gi','<(\\/?)(',')([^>]*)>');this.serializedNodes=[];this.serializationId=0;if(s.invalid_elements!=='')this.iveRe=this._arrayToRe(s.invalid_elements.toUpperCase().split(','),'g','^(',')$');else this.iveRe=null;st='';for(i=0;i<s.indent_levels;i++)st+=s.indent_char;this
 .inStr=st;if(!s.verify_html){s.valid_elements='*[*]';s.extended_valid_elements=''}this.fillStr=s.entity_encoding=="named"?"&nbsp;":"&#160;";this.idCount=0;this.xmlEncodeRe=new RegExp('[\u007F-\uFFFF<>&"]','g')},addRuleStr:function(s){var r=this.parseRuleStr(s),n;for(n in r){if(r[n])this.rules[n]=r[n]}this.vElements=tinyMCE.clearArray([]);for(n in this.rules){if(this.rules[n])this.vElements[this.vElements.length]=this.rules[n].tag}this.vElementsRe=this._arrayToRe(this.vElements,'')},isValid:function(n){if(!this.rulesDone)this._setupRules();if(!n)return true;n=n.replace(/[^a-z0-9]+/gi,'').toUpperCase();return!tinyMCE.getParam('cleanup')||this.vElementsRe.test(n)},addChildRemoveRuleStr:function(s){var x,y,p,i,t,tn,ta,cl,r;if(!s)return;ta=s.split(',');for(x=0;x<ta.length;x++){s=ta[x];p=this.split(/\[|\]/,s);if(p==null||p.length<1)t=s.toUpperCase();else t=p[0].toUpperCase();tn=this.split('/',t);for(y=0;y<tn.length;y++){r="^(";cl=this.split(/\|/,p[1]);for(i=0;i<cl.length;i++){if(c
 l[i]=='%istrict')r+=tinyMCE.inlineStrict;else if(cl[i]=='%itrans')r+=tinyMCE.inlineTransitional;else if(cl[i]=='%istrict_na')r+=tinyMCE.inlineStrict.substring(2);else if(cl[i]=='%itrans_na')r+=tinyMCE.inlineTransitional.substring(2);else if(cl[i]=='%btrans')r+=tinyMCE.blockElms;else if(cl[i]=='%strict')r+=tinyMCE.blockStrict;else r+=(cl[i].charAt(0)!='#'?cl[i].toUpperCase():cl[i]);r+=(i!=cl.length-1?'|':'')}r+=')$';if(this.childRules==null)this.childRules=tinyMCE.clearArray([]);this.childRules[tn[y]]=new RegExp(r);if(p.length>1)this.childRules[tn[y]].wrapTag=p[2]}}},parseRuleStr:function(s){var ta,p,r,a,i,x,px,t,tn,y,av,or=tinyMCE.clearArray([]),dv;if(s==null||s.length==0)return or;ta=s.split(',');for(x=0;x<ta.length;x++){s=ta[x];if(s.length==0)continue;p=this.split(/\[|\]/,s);if(p==null||p.length<1)t=s.toUpperCase();else t=p[0].toUpperCase();tn=this.split('/',t);for(y=0;y<tn.length;y++){r={};r.tag=tn[y];r.forceAttribs=null;r.defaultAttribs=null;r.validAttribValues=null;px=r
 .tag.charAt(0);r.forceOpen=px=='+';r.removeEmpty=px=='-';r.fill=px=='#';r.tag=r.tag.replace(/\+|-|#/g,'');r.oTagName=tn[0].replace(/\+|-|#/g,'').toLowerCase();r.isWild=new RegExp('\\*|\\?|\\+','g').test(r.tag);r.validRe=new RegExp(this._wildcardToRe('^'+r.tag+'$'));if(p.length>1){r.vAttribsRe='^(';a=this.split(/\|/,p[1]);for(i=0;i<a.length;i++){t=a[i];if(t.charAt(0)=='!'){a[i]=t=t.substring(1);if(!r.reqAttribsRe)r.reqAttribsRe='\\s+('+t;else r.reqAttribsRe+='|'+t}av=new RegExp('(=|:|<)(.*?)$').exec(t);t=t.replace(new RegExp('(=|:|<).*?$'),'');if(av&&av.length>0){if(av[0].charAt(0)==':'){if(!r.forceAttribs)r.forceAttribs=tinyMCE.clearArray([]);r.forceAttribs[t.toLowerCase()]=av[0].substring(1)}else if(av[0].charAt(0)=='='){if(!r.defaultAttribs)r.defaultAttribs=tinyMCE.clearArray([]);dv=av[0].substring(1);r.defaultAttribs[t.toLowerCase()]=dv==''?"mce_empty":dv}else if(av[0].charAt(0)=='<'){if(!r.validAttribValues)r.validAttribValues=tinyMCE.clearArray([]);r.validAttribValues[t
 .toLowerCase()]=this._arrayToRe(this.split('?',av[0].substring(1)),'i')}}r.vAttribsRe+=''+t.toLowerCase()+(i!=a.length-1?'|':'');a[i]=t.toLowerCase()}if(r.reqAttribsRe)r.reqAttribsRe=new RegExp(r.reqAttribsRe+')=\"','g');r.vAttribsRe+=')$';r.vAttribsRe=this._wildcardToRe(r.vAttribsRe);r.vAttribsReIsWild=new RegExp('\\*|\\?|\\+','g').test(r.vAttribsRe);r.vAttribsRe=new RegExp(r.vAttribsRe);r.vAttribs=a.reverse();}else{r.vAttribsRe='';r.vAttribs=tinyMCE.clearArray([]);r.vAttribsReIsWild=false}or[r.tag]=r}}return or},serializeNodeAsXML:function(n){var s,b;if(!this.xmlDoc){if(this.isIE){try{this.xmlDoc=new ActiveXObject('MSXML2.DOMDocument')}catch(e){}if(!this.xmlDoc)try{this.xmlDoc=new ActiveXObject('Microsoft.XmlDom')}catch(e){}}else this.xmlDoc=document.implementation.createDocument('','',null);if(!this.xmlDoc)alert("Error XML Parser could not be found.")}if(this.xmlDoc.firstChild)this.xmlDoc.removeChild(this.xmlDoc.firstChild);b=this.xmlDoc.createElement("html");b=this.xmlDo
 c.appendChild(b);this._convertToXML(n,b);if(this.isIE)return this.xmlDoc.xml;else return new XMLSerializer().serializeToString(this.xmlDoc)},_convertToXML:function(n,xn){var xd,el,i,l,cn,at,no,hc=false;if(tinyMCE.isRealIE&&this._isDuplicate(n))return;xd=this.xmlDoc;switch(n.nodeType){case 1:hc=n.hasChildNodes();el=xd.createElement(n.nodeName.toLowerCase());at=n.attributes;for(i=at.length-1;i>-1;i--){no=at[i];if(no.specified&&no.nodeValue)el.setAttribute(no.nodeName.toLowerCase(),no.nodeValue)}if(!hc&&!this.closeElementsRe.test(n.nodeName))el.appendChild(xd.createTextNode(""));xn=xn.appendChild(el);break;case 3:xn.appendChild(xd.createTextNode(n.nodeValue));return;case 8:xn.appendChild(xd.createComment(n.nodeValue));return}if(hc){cn=n.childNodes;for(i=0,l=cn.length;i<l;i++)this._convertToXML(cn[i],xn)}},serializeNodeAsHTML:function(n,inn){var en,no,h='',i,l,t,st,r,cn,va=false,f=false,at,hc,cr,nn;if(!this.rulesDone)this._setupRules();if(tinyMCE.isRealIE&&this._isDuplicate(n))r
 eturn'';if(n.parentNode&&this.childRules!=null){cr=this.childRules[n.parentNode.nodeName];if(typeof(cr)!="undefined"&&!cr.test(n.nodeName)){st=true;t=null}}switch(n.nodeType){case 1:hc=n.hasChildNodes();if(st)break;nn=n.nodeName;if(tinyMCE.isRealIE){if(n.nodeName.indexOf('/')!=-1)break;if(n.scopeName&&n.scopeName!='HTML')nn=n.scopeName.toUpperCase()+':'+nn.toUpperCase()}else if(tinyMCE.isOpera&&nn.indexOf(':')>0)nn=nn.toUpperCase();if(this.settings.convert_fonts_to_spans){if(this.settings.on_save&&nn=='FONT')nn='SPAN';if(!this.settings.on_save&&nn=='SPAN')nn='FONT'}if(this.vElementsRe.test(nn)&&(!this.iveRe||!this.iveRe.test(nn))&&!inn){va=true;r=this.rules[nn];if(!r){at=this.rules;for(no in at){if(at[no]&&at[no].validRe.test(nn)){r=at[no];break}}}en=r.isWild?nn.toLowerCase():r.oTagName;f=r.fill;if(r.removeEmpty&&!hc)return"";t='<'+en;if(r.vAttribsReIsWild){at=n.attributes;for(i=at.length-1;i>-1;i--){no=at[i];if(no.specified&&r.vAttribsRe.test(no.nodeName))t+=this._serialize
 Attribute(n,r,no.nodeName)}}else{for(i=r.vAttribs.length-1;i>-1;i--)t+=this._serializeAttribute(n,r,r.vAttribs[i])}if(!this.settings.on_save){at=this.mceAttribs;for(no in at){if(at[no])t+=this._serializeAttribute(n,r,at[no])}}if(r.reqAttribsRe&&!t.match(r.reqAttribsRe))t=null;if(t!=null&&this.closeElementsRe.test(nn))return t+' />';if(t!=null)h+=t+'>';if(this.isIE&&this.codeElementsRe.test(nn))h+=n.innerHTML}break;case 3:if(st)break;if(n.parentNode&&this.codeElementsRe.test(n.parentNode.nodeName))return this.isIE?'':n.nodeValue;return this.xmlEncode(n.nodeValue);case 8:if(st)break;return"<!--"+this._trimComment(n.nodeValue)+"-->"}if(hc){cn=n.childNodes;for(i=0,l=cn.length;i<l;i++)h+=this.serializeNodeAsHTML(cn[i])}if(f&&!hc)h+=this.fillStr;if(t!=null&&va)h+='</'+en+'>';return h},_serializeAttribute:function(n,r,an){var av='',t,os=this.settings.on_save;if(os&&(an.indexOf('mce_')==0||an.indexOf('_moz')==0))return'';if(os&&this.mceAttribs[an])av=this._getAttrib(n,this.mceAttrib
 s[an]);if(av.length==0)av=this._getAttrib(n,an);if(av.length==0&&r.defaultAttribs&&(t=r.defaultAttribs[an])){av=t;if(av=="mce_empty")return" "+an+'=""'}if(r.forceAttribs&&(t=r.forceAttribs[an]))av=t;if(os&&av.length!=0&&/^(src|href|longdesc)$/.test(an))av=this._urlConverter(this,n,av);if(av.length!=0&&r.validAttribValues&&r.validAttribValues[an]&&!r.validAttribValues[an].test(av))return"";if(av.length!=0&&av=="{$uid}")av="uid_"+(this.idCount++);if(av.length!=0){if(an.indexOf('on')!=0)av=this.xmlEncode(av,1);return" "+an+"="+'"'+av+'"'}return""},formatHTML:function(h){var s=this.settings,p='',i=0,li=0,o='',l;h=h.replace(/<pre([^>]*)>(.*?)<\/pre>/gi,function(a,b,c){c=c.replace(/<br\s*\/>/gi,'\n');return'<pre'+b+'>'+c+'</pre>'});h=h.replace(/\r/g,'');h='\n'+h;h=h.replace(new RegExp('\\n\\s+','gi'),'\n');h=h.replace(this.nlBeforeRe,'\n<$1$2>');h=h.replace(this.nlAfterRe,'<$1$2>\n');h=h.replace(this.nlBeforeAfterRe,'\n<$1$2$3>\n');h+='\n';while((i=h.indexOf('\n',i+1))!=-1){if((l=
 h.substring(li+1,i)).length!=0){if(this.ouRe.test(l)&&p.length>=s.indent_levels)p=p.substring(s.indent_levels);o+=p+l+'\n';if(this.inRe.test(l))p+=this.inStr}li=i}return o},xmlEncode:function(s){var cl=this,re=this.xmlEncodeRe;if(!this.entitiesDone)this._setupEntities();switch(this.settings.entity_encoding){case"raw":return tinyMCE.xmlEncode(s);case"named":return s.replace(re,function(c){var b=cl.entities[c.charCodeAt(0)];return b?'&'+b+';':c});case"numeric":return s.replace(re,function(c){return'&#'+c.charCodeAt(0)+';'})}return s},split:function(re,s){var i,l,o=[],c=s.split(re);for(i=0,l=c.length;i<l;i++){if(c[i]!=='')o[i]=c[i]}return o},_trimComment:function(s){s=s.replace(new RegExp('\\smce_src=\"[^\"]*\"','gi'),"");s=s.replace(new RegExp('\\smce_href=\"[^\"]*\"','gi'),"");return s},_getAttrib:function(e,n,d){var v,ex,nn;if(typeof(d)=="undefined")d="";if(!e||e.nodeType!=1)return d;try{v=e.getAttribute(n,0)}catch(ex){v=e.getAttribute(n,2)}if(n=="class"&&!v)v=e.className;if
 (this.isIE){if(n=="http-equiv")v=e.httpEquiv;nn=e.nodeName;if(nn=="FORM"&&n=="enctype"&&v=="application/x-www-form-urlencoded")v="";if(nn=="INPUT"&&n=="size"&&v=="20")v="";if(nn=="INPUT"&&n=="maxlength"&&v=="2147483647")v="";if(n=="width"||n=="height")v=e.getAttribute(n,2)}if(n=='style'&&v){if(!tinyMCE.isOpera)v=e.style.cssText;v=tinyMCE.serializeStyle(tinyMCE.parseStyle(v))}if(this.settings.on_save&&n.indexOf('on')!=-1&&this.settings.on_save&&v&&v!=='')v=tinyMCE.cleanupEventStr(v);return(v&&v!=='')?''+v:d},_urlConverter:function(c,n,v){if(!c.settings.on_save)return tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings.base_href,v);else if(tinyMCE.getParam('convert_urls')){if(!this.urlConverter)this.urlConverter=eval(tinyMCE.settings.urlconverter_callback);return this.urlConverter(v,n,true)}return v},_arrayToRe:function(a,op,be,af){var i,r;op=typeof(op)=="undefined"?"gi":op;be=typeof(be)=="undefined"?"^(":be;af=typeof(af)=="undefined"?")$":af;r=be;for(i=0;i<a.length;i++)r+=t
 his._wildcardToRe(a[i])+(i!=a.length-1?"|":"");r+=af;return new RegExp(r,op)},_wildcardToRe:function(s){s=s.replace(/\?/g,'(\\S?)');s=s.replace(/\+/g,'(\\S+)');s=s.replace(/\*/g,'(\\S*)');return s},_setupEntities:function(){var n,a,i,s=this.settings;if(s.entity_encoding=="named"){n=tinyMCE.clearArray([]);a=this.split(',',s.entities);for(i=0;i<a.length;i+=2)n[a[i]]=a[i+1];this.entities=n}this.entitiesDone=true},_setupRules:function(){var s=this.settings;this.addRuleStr(s.valid_elements);this.addRuleStr(s.extended_valid_elements);this.addChildRemoveRuleStr(s.valid_child_elements);this.rulesDone=true},_isDuplicate:function(n){var i,l,sn;if(!this.settings.fix_content_duplication)return false;if(tinyMCE.isRealIE&&n.nodeType==1){if(n.mce_serialized==this.serializationId)return true;n.setAttribute('mce_serialized',this.serializationId)}else{sn=this.serializedNodes;for(i=0,l=sn.length;i<l;i++){if(sn[i]==n)return true}sn.push(n)}return false}};tinyMCE.add(TinyMCE_Engine,{createTagHTM
 L:function(tn,a,h){var o='',f=tinyMCE.xmlEncode,n;o='<'+tn;if(a){for(n in a){if(typeof(a[n])!='function'&&a[n]!=null)o+=' '+f(n)+'="'+f(''+a[n])+'"'}}o+=!h?' />':'>'+h+'</'+tn+'>';return o},createTag:function(d,tn,a,h){var o=d.createElement(tn),n;if(a){for(n in a){if(typeof(a[n])!='function'&&a[n]!=null)tinyMCE.setAttrib(o,n,a[n])}}if(h)o.innerHTML=h;return o},getElementByAttributeValue:function(n,e,a,v){return(n=this.getElementsByAttributeValue(n,e,a,v)).length==0?null:n[0]},getElementsByAttributeValue:function(n,e,a,v){var i,nl=n.getElementsByTagName(e),o=[];for(i=0;i<nl.length;i++){if(tinyMCE.getAttrib(nl[i],a).indexOf(v)!=-1)o[o.length]=nl[i]}return o},isBlockElement:function(n){return n!=null&&n.nodeType==1&&this.blockRegExp.test(n.nodeName)},getParentBlockElement:function(n,r){return this.getParentNode(n,function(n){return tinyMCE.isBlockElement(n)},r);return null},insertAfter:function(n,r){if(r.nextSibling)r.parentNode.insertBefore(n,r.nextSibling);else r.parentNode.a
 ppendChild(n)},setInnerHTML:function(e,h){var i,nl,n;if(tinyMCE.isGecko){h=h.replace(/<embed([^>]*)>/gi,'<tmpembed$1>');h=h.replace(/<em([^>]*)>/gi,'<i$1>');h=h.replace(/<tmpembed([^>]*)>/gi,'<embed$1>');h=h.replace(/<strong([^>]*)>/gi,'<b$1>');h=h.replace(/<\/strong>/gi,'</b>');h=h.replace(/<\/em>/gi,'</i>')}if(tinyMCE.isRealIE){h=h.replace(/\s\/>/g,'>');h=h.replace(/<p([^>]*)>\u00A0?<\/p>/gi,'<p$1 mce_keep="true">&nbsp;</p>');h=h.replace(/<p([^>]*)>\s*&nbsp;\s*<\/p>/gi,'<p$1 mce_keep="true">&nbsp;</p>');h=h.replace(/<p([^>]*)>\s+<\/p>/gi,'<p$1 mce_keep="true">&nbsp;</p>');e.innerHTML=tinyMCE.uniqueTag+h;e.firstChild.removeNode(true);nl=e.getElementsByTagName("p");for(i=nl.length-1;i>=0;i--){n=nl[i];if(n.nodeName=='P'&&!n.hasChildNodes()&&!n.mce_keep)n.parentNode.removeChild(n)}}else{h=this.fixGeckoBaseHREFBug(1,e,h);e.innerHTML=h;this.fixGeckoBaseHREFBug(2,e,h)}},getOuterHTML:function(e){var d;if(tinyMCE.isIE)return e.outerHTML;d=e.ownerDocument.createElement("body");d.app
 endChild(e.cloneNode(true));return d.innerHTML},setOuterHTML:function(e,h,d){var d=typeof(d)=="undefined"?e.ownerDocument:d,i,nl,t;if(tinyMCE.isIE&&e.nodeType==1)e.outerHTML=h;else{t=d.createElement("body");t.innerHTML=h;for(i=0,nl=t.childNodes;i<nl.length;i++)e.parentNode.insertBefore(nl[i].cloneNode(true),e);e.parentNode.removeChild(e)}},_getElementById:function(id,d){var e,i,j,f;if(typeof(d)=="undefined")d=document;e=d.getElementById(id);if(!e){f=d.forms;for(i=0;i<f.length;i++){for(j=0;j<f[i].elements.length;j++){if(f[i].elements[j].name==id){e=f[i].elements[j];break}}}}return e},getNodeTree:function(n,na,t,nn){return this.selectNodes(n,function(n){return(!t||n.nodeType==t)&&(!nn||n.nodeName==nn)},na?na:[])},getParentElement:function(n,na,f,r){var re=na?new RegExp('^('+na.toUpperCase().replace(/,/g,'|')+')$'):0,v;if(f&&typeof(f)=='string')return this.getParentElement(n,na,function(no){return tinyMCE.getAttrib(no,f)!==''});return this.getParentNode(n,function(n){return((n.
 nodeType==1&&!re)||(re&&re.test(n.nodeName)))&&(!f||f(n))},r)},getParentNode:function(n,f,r){while(n){if(n==r)return null;if(f(n))return n;n=n.parentNode}return null},getAttrib:function(elm,name,dv){var v;if(typeof(dv)=="undefined")dv="";if(!elm||elm.nodeType!=1)return dv;try{v=elm.getAttribute(name,0)}catch(ex){v=elm.getAttribute(name,2)}if(name=="class"&&!v)v=elm.className;if(tinyMCE.isGecko){if(name=="src"&&elm.src!=null&&elm.src!=='')v=elm.src;if(name=="href"&&elm.href!=null&&elm.href!=='')v=elm.href}else if(tinyMCE.isIE){switch(name){case"http-equiv":v=elm.httpEquiv;break;case"width":case"height":v=elm.getAttribute(name,2);break}}if(name=="style"&&!tinyMCE.isOpera)v=elm.style.cssText;return(v&&v!=='')?v:dv},setAttrib:function(el,name,va,fix){if(typeof(va)=="number"&&va!=null)va=""+va;if(fix){if(va==null)va="";va=va.replace(/[^0-9%]/g,'')}if(name=="style")el.style.cssText=va;if(name=="class")el.className=va;if(va!=null&&va!==''&&va!=-1)el.setAttribute(name,va);else el.re
 moveAttribute(name)},setStyleAttrib:function(e,n,v){e.style[n]=v;if(tinyMCE.isIE&&v==null||v==''){v=tinyMCE.serializeStyle(tinyMCE.parseStyle(e.style.cssText));e.style.cssText=v;e.setAttribute("style",v)}},switchClass:function(ei,c){var e;if(tinyMCE.switchClassCache[ei])e=tinyMCE.switchClassCache[ei];else e=tinyMCE.switchClassCache[ei]=document.getElementById(ei);if(e){if(tinyMCE.settings.button_tile_map&&e.className&&e.className.indexOf('mceTiledButton')==0)c='mceTiledButton '+c;e.className=c}},getAbsPosition:function(n,cn){var l=0,t=0;while(n&&n!=cn){l+=n.offsetLeft;t+=n.offsetTop;n=n.offsetParent}return{absLeft:l,absTop:t}},prevNode:function(e,n){var a=n.split(','),i;while((e=e.previousSibling)!=null){for(i=0;i<a.length;i++){if(e.nodeName==a[i])return e}}return null},nextNode:function(e,n){var a=n.split(','),i;while((e=e.nextSibling)!=null){for(i=0;i<a.length;i++){if(e.nodeName==a[i])return e}}return null},selectElements:function(n,na,f){var i,a=[],nl,x;for(x=0,na=na.spli
 t(',');x<na.length;x++)for(i=0,nl=n.getElementsByTagName(na[x]);i<nl.length;i++)(!f||f(nl[i]))&&a.push(nl[i]);return a},selectNodes:function(n,f,a){var i;if(!a)a=[];if(f(n))a[a.length]=n;if(n.hasChildNodes()){for(i=0;i<n.childNodes.length;i++)tinyMCE.selectNodes(n.childNodes[i],f,a)}return a},addCSSClass:function(e,c,b){var o=this.removeCSSClass(e,c);return e.className=b?c+(o!==''?(' '+o):''):(o!==''?(o+' '):'')+c},removeCSSClass:function(e,c){c=e.className.replace(new RegExp("(^|\\s+)"+c+"(\\s+|$)"),' ');return e.className=c!=' '?c:''},hasCSSClass:function(n,c){return new RegExp('\\b'+c+'\\b','g').test(n.className)},renameElement:function(e,n,d){var ne,i,ar;d=typeof(d)=="undefined"?tinyMCE.selectedInstance.getDoc():d;if(e){ne=d.createElement(n);ar=e.attributes;for(i=ar.length-1;i>-1;i--){if(ar[i].specified&&ar[i].nodeValue)ne.setAttribute(ar[i].nodeName.toLowerCase(),ar[i].nodeValue)}ar=e.childNodes;for(i=0;i<ar.length;i++)ne.appendChild(ar[i].cloneNode(true));e.parentNode.
 replaceChild(ne,e)}},getViewPort:function(w){var d=w.document,m=d.compatMode=='CSS1Compat',b=d.body,de=d.documentElement;return{left:w.pageXOffset||(m?de.scrollLeft:b.scrollLeft),top:w.pageYOffset||(m?de.scrollTop:b.scrollTop),width:w.innerWidth||(m?de.clientWidth:b.clientWidth),height:w.innerHeight||(m?de.clientHeight:b.clientHeight)}},getStyle:function(n,na,d){if(!n)return false;if(tinyMCE.isGecko&&n.ownerDocument.defaultView){try{return n.ownerDocument.defaultView.getComputedStyle(n,null).getPropertyValue(na)}catch(n){return null}}na=na.replace(/-(\D)/g,function(a,b){return b.toUpperCase()});if(n.currentStyle)return n.currentStyle[na];return false}});tinyMCE.add(TinyMCE_Engine,{parseURL:function(url_str){var urlParts=[],i,pos,lastPos,chr;if(url_str){pos=url_str.indexOf('://');if(pos!=-1){urlParts.protocol=url_str.substring(0,pos);lastPos=pos+3}for(i=lastPos;i<url_str.length;i++){chr=url_str.charAt(i);if(chr==':')break;if(chr=='/')break}pos=i;urlParts.host=url_str.substrin
 g(lastPos,pos);urlParts.port="";lastPos=pos;if(url_str.charAt(pos)==':'){pos=url_str.indexOf('/',lastPos);urlParts.port=url_str.substring(lastPos+1,pos)}lastPos=pos;pos=url_str.indexOf('?',lastPos);if(pos==-1)pos=url_str.indexOf('#',lastPos);if(pos==-1)pos=url_str.length;urlParts.path=url_str.substring(lastPos,pos);lastPos=pos;if(url_str.charAt(pos)=='?'){pos=url_str.indexOf('#');pos=(pos==-1)?url_str.length:pos;urlParts.query=url_str.substring(lastPos+1,pos)}lastPos=pos;if(url_str.charAt(pos)=='#'){pos=url_str.length;urlParts.anchor=url_str.substring(lastPos+1,pos)}}return urlParts},serializeURL:function(up){var o="";if(up.protocol)o+=up.protocol+"://";if(up.host)o+=up.host;if(up.port)o+=":"+up.port;if(up.path)o+=up.path;if(up.query)o+="?"+up.query;if(up.anchor)o+="#"+up.anchor;return o},convertAbsoluteURLToRelativeURL:function(base_url,url_to_relative){var baseURL=this.parseURL(base_url),targetURL=this.parseURL(url_to_relative);var i,strTok1,strTok2,breakPoint=0,outPath=""
 ,forceSlash=false;var fileName,pos;if(targetURL.path=='')targetURL.path="/";else forceSlash=true;base_url=baseURL.path.substring(0,baseURL.path.lastIndexOf('/'));strTok1=base_url.split('/');strTok2=targetURL.path.split('/');if(strTok1.length>=strTok2.length){for(i=0;i<strTok1.length;i++){if(i>=strTok2.length||strTok1[i]!=strTok2[i]){breakPoint=i+1;break}}}if(strTok1.length<strTok2.length){for(i=0;i<strTok2.length;i++){if(i>=strTok1.length||strTok1[i]!=strTok2[i]){breakPoint=i+1;break}}}if(breakPoint==1)return targetURL.path;for(i=0;i<(strTok1.length-(breakPoint-1));i++)outPath+="../";for(i=breakPoint-1;i<strTok2.length;i++){if(i!=(breakPoint-1))outPath+="/"+strTok2[i];else outPath+=strTok2[i]}targetURL.protocol=null;targetURL.host=null;targetURL.port=null;targetURL.path=outPath==''&&forceSlash?"/":outPath;fileName=baseURL.path;if((pos=fileName.lastIndexOf('/'))!=-1)fileName=fileName.substring(pos+1);if(fileName==targetURL.path&&targetURL.anchor!=='')targetURL.path="";if(targ
 etURL.path==''&&!targetURL.anchor)targetURL.path=fileName!==''?fileName:"/";return this.serializeURL(targetURL)},convertRelativeToAbsoluteURL:function(base_url,relative_url){var baseURL=this.parseURL(base_url),baseURLParts,relURLParts,newRelURLParts,numBack,relURL=this.parseURL(relative_url),i;var len,absPath,start,end,newBaseURLParts;if(relative_url==''||relative_url.indexOf('://')!=-1||/^(mailto:|javascript:|#|\/)/.test(relative_url))return relative_url;baseURLParts=baseURL.path.split('/');relURLParts=relURL.path.split('/');newBaseURLParts=[];for(i=baseURLParts.length-1;i>=0;i--){if(baseURLParts[i].length==0)continue;newBaseURLParts[newBaseURLParts.length]=baseURLParts[i]}baseURLParts=newBaseURLParts.reverse();newRelURLParts=[];numBack=0;for(i=relURLParts.length-1;i>=0;i--){if(relURLParts[i].length==0||relURLParts[i]==".")continue;if(relURLParts[i]=='..'){numBack++;continue}if(numBack>0){numBack--;continue}newRelURLParts[newRelURLParts.length]=relURLParts[i]}relURLParts=ne
 wRelURLParts.reverse();len=baseURLParts.length-numBack;absPath=(len<=0?"":"/")+baseURLParts.slice(0,len).join('/')+"/"+relURLParts.join('/');start="";end="";relURL.protocol=baseURL.protocol;relURL.host=baseURL.host;relURL.port=baseURL.port;if(relURL.path.charAt(relURL.path.length-1)=="/")absPath+="/";relURL.path=absPath;return this.serializeURL(relURL)},convertURL:function(url,node,on_save){var dl=document.location,start,portPart,urlParts,baseUrlParts,tmpUrlParts,curl;var prot=dl.protocol,host=dl.hostname,port=dl.port;if(prot=="file:")return url;url=tinyMCE.regexpReplace(url,'(http|https):///','/');if(url.indexOf('mailto:')!=-1||url.indexOf('javascript:')!=-1||/^[ \t\r\n\+]*[#\?]/.test(url))return url;if(!tinyMCE.isIE&&!on_save&&url.indexOf("://")==-1&&url.charAt(0)!='/')return tinyMCE.settings.base_href+url;if(on_save&&tinyMCE.getParam('relative_urls')){curl=tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings.base_href,url);if(curl.charAt(0)=='/')curl=tinyMCE.settings.doc
 ument_base_prefix+curl;urlParts=tinyMCE.parseURL(curl);tmpUrlParts=tinyMCE.parseURL(tinyMCE.settings.document_base_url);if(urlParts.host==tmpUrlParts.host&&(urlParts.port==tmpUrlParts.port))return tinyMCE.convertAbsoluteURLToRelativeURL(tinyMCE.settings.document_base_url,curl)}if(!tinyMCE.getParam('relative_urls')){url=tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings.base_href,url);}if(tinyMCE.getParam('remove_script_host')){start="";portPart="";if(port!=='')portPart=":"+port;start=prot+"//"+host+portPart+"/";if(url.indexOf(start)==0)url=url.substring(start.length-1)}return url},convertAllRelativeURLs:function(body){var i,elms,src,href,mhref,msrc;elms=body.getElementsByTagName("img");for(i=0;i<elms.length;i++){src=tinyMCE.getAttrib(elms[i],'src');msrc=tinyMCE.getAttrib(elms[i],'mce_src');if(msrc!=='')src=msrc;if(src!==''){src=tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings.base_href,src);elms[i].setAttribute("src",src)}}elms=body.getElementsByTagName("a");for(i=0;
 i<elms.length;i++){href=tinyMCE.getAttrib(elms[i],'href');mhref=tinyMCE.getAttrib(elms[i],'mce_href');if(mhref!=='')href=mhref;if(href&&href!==''){href=tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings.base_href,href);elms[i].setAttribute("href",href)}}}});tinyMCE.add(TinyMCE_Engine,{clearArray:function(a){var n;for(n in a)a[n]=null;return a},explode:function(d,s){var ar=s.split(d),oar=[],i;for(i=0;i<ar.length;i++){if(ar[i]!=='')oar[oar.length]=ar[i]}return oar}});tinyMCE.add(TinyMCE_Engine,{_setEventsEnabled:function(node,state){var evs,x,y,elms,i,event;var events=['onfocus','onblur','onclick','ondblclick','onmousedown','onmouseup','onmouseover','onmousemove','onmouseout','onkeypress','onkeydown','onkeydown','onkeyup'];evs=tinyMCE.settings.event_elements.split(',');for(y=0;y<evs.length;y++){elms=node.getElementsByTagName(evs[y]);for(i=0;i<elms.length;i++){event="";for(x=0;x<events.length;x++){if((event=tinyMCE.getAttrib(elms[i],events[x]))!==''){event=tinyMCE.cleanupEve
 ntStr(""+event);if(!state)event="return true;"+event;else event=event.replace(/^return true;/gi,'');elms[i].removeAttribute(events[x]);elms[i].setAttribute(events[x],event)}}}}},_eventPatch:function(editor_id){var n,inst,win,e;if(typeof(tinyMCE)=="undefined")return true;try{if(tinyMCE.selectedInstance){win=tinyMCE.selectedInstance.getWin();if(win&&win.event){e=win.event;if(!e.target)e.target=e.srcElement;TinyMCE_Engine.prototype.handleEvent(e);return}}for(n in tinyMCE.instances){inst=tinyMCE.instances[n];if(!tinyMCE.isInstance(inst))continue;inst.select();win=inst.getWin();if(win&&win.event){e=win.event;if(!e.target)e.target=e.srcElement;TinyMCE_Engine.prototype.handleEvent(e);return}}}catch(ex){}},findEvent:function(e){var n,inst;if(e)return e;for(n in tinyMCE.instances){inst=tinyMCE.instances[n];if(tinyMCE.isInstance(inst)&&inst.getWin().event)return inst.getWin().event}return null},unloadHandler:function(){tinyMCE.triggerSave(true,true)},addEventHandlers:function(inst){th
 is.setEventHandlers(inst,1)},setEventHandlers:function(inst,s){var doc=inst.getDoc(),ie,ot,i,f=s?tinyMCE.addEvent:tinyMCE.removeEvent;ie=['keypress','keyup','keydown','click','mouseup','mousedown','controlselect','dblclick'];ot=['keypress','keyup','keydown','click','mouseup','mousedown','focus','blur','dragdrop'];inst.switchSettings();if(tinyMCE.isIE){for(i=0;i<ie.length;i++)f(doc,ie[i],TinyMCE_Engine.prototype._eventPatch)}else{for(i=0;i<ot.length;i++)f(doc,ot[i],tinyMCE.handleEvent);try{doc.designMode="On"}catch(e){}}},onMouseMove:function(){var inst,lh;if(tinyMCE.lastHover){lh=tinyMCE.lastHover;if(lh.className.indexOf('mceMenu')!=-1)tinyMCE._menuButtonEvent('out',lh);else lh.className=lh.className;tinyMCE.lastHover=null}if(!tinyMCE.hasMouseMoved){inst=tinyMCE.selectedInstance;if(inst.isFocused){inst.undoBookmark=inst.selection.getBookmark();tinyMCE.hasMouseMoved=true}}},cancelEvent:function(e){if(!e)return false;if(tinyMCE.isIE){e.returnValue=false;e.cancelBubble=true}els
 e{e.preventDefault();e.stopPropagation&&e.stopPropagation()}return false},addEvent:function(o,n,h){if(n!='unload'){function clean(){var ex;try{tinyMCE.removeEvent(o,n,h);tinyMCE.removeEvent(window,'unload',clean);o=n=h=null}catch(ex){}}tinyMCE.addEvent(window,'unload',clean)}if(o.attachEvent)o.attachEvent("on"+n,h);else o.addEventListener(n,h,false)},removeEvent:function(o,n,h){if(o.detachEvent)o.detachEvent("on"+n,h);else o.removeEventListener(n,h,false)},addSelectAccessibility:function(e,s,w){if(!s._isAccessible){s.onkeydown=tinyMCE.accessibleEventHandler;s.onblur=tinyMCE.accessibleEventHandler;s._isAccessible=true;s._win=w}return false},accessibleEventHandler:function(e){var elm,win=this._win;e=tinyMCE.isIE?win.event:e;elm=tinyMCE.isIE?e.srcElement:e.target;if(e.type=="blur"){if(elm.oldonchange){elm.onchange=elm.oldonchange;elm.oldonchange=null}return true}if(elm.nodeName=="SELECT"&&!elm.oldonchange){elm.oldonchange=elm.onchange;elm.onchange=null}if(e.keyCode==13||e.keyCo
 de==32){elm.onchange=elm.oldonchange;elm.onchange();elm.oldonchange=null;tinyMCE.cancelEvent(e);return false}return true},_resetIframeHeight:function(){var ife;if(tinyMCE.isRealIE){ife=tinyMCE.selectedInstance.iframeElement;if(ife._oldHeight){ife.style.height=ife._oldHeight;ife.height=ife._oldHeight}}}});function TinyMCE_Selection(inst){this.instance=inst};TinyMCE_Selection.prototype={getSelectedHTML:function(){var inst=this.instance,e,r=this.getRng(),h;if(!r)return null;e=document.createElement("body");if(r.cloneContents)e.appendChild(document.importNode(r.cloneContents(),true));else if(typeof(r.item)!='undefined'||typeof(r.htmlText)!='undefined')e.innerHTML=r.item?r.item(0).outerHTML:r.htmlText;else e.innerHTML=r.toString();h=tinyMCE._cleanupHTML(inst,inst.contentDocument,inst.settings,e,e,false,true,false);return h},getSelectedText:function(){var inst=this.instance,d,r,s,t;if(tinyMCE.isIE){d=inst.getDoc();if(d.selection.type=="Text"){r=d.selection.createRange();t=r.text}e
 lse t=''}else{s=this.getSel();if(s&&s.toString)t=s.toString();else t=''}return t},getBookmark:function(simple){var inst=this.instance,rng=this.getRng(),doc=inst.getDoc(),b=inst.getBody();var trng,sx,sy,xx=-999999999,vp=inst.getViewPort();var sp,le,s,e,nl,i,si,ei,w;sx=vp.left;sy=vp.top;if(simple)return{rng:rng,scrollX:sx,scrollY:sy};if(tinyMCE.isRealIE){if(rng.item){e=rng.item(0);nl=b.getElementsByTagName(e.nodeName);for(i=0;i<nl.length;i++){if(e==nl[i]){sp=i;break}}return{tag:e.nodeName,index:sp,scrollX:sx,scrollY:sy}}else{trng=doc.body.createTextRange();trng.moveToElementText(inst.getBody());trng.collapse(true);bp=Math.abs(trng.move('character',xx));trng=rng.duplicate();trng.collapse(true);sp=Math.abs(trng.move('character',xx));trng=rng.duplicate();trng.collapse(false);le=Math.abs(trng.move('character',xx))-sp;return{start:sp-bp,length:le,scrollX:sx,scrollY:sy}}}else{s=this.getSel();e=this.getFocusElement();if(!s)return null;if(e&&e.nodeName=='IMG'){return{start:-1,end:-1,i
 ndex:sp,scrollX:sx,scrollY:sy}}if(s.anchorNode==s.focusNode&&s.anchorOffset==s.focusOffset){e=this._getPosText(b,s.anchorNode,s.focusNode);if(!e)return{scrollX:sx,scrollY:sy};return{start:e.start+s.anchorOffset,end:e.end+s.focusOffset,scrollX:sx,scrollY:sy}}else{e=this._getPosText(b,rng.startContainer,rng.endContainer);if(!e)return{scrollX:sx,scrollY:sy};return{start:e.start+rng.startOffset,end:e.end+rng.endOffset,scrollX:sx,scrollY:sy}}}return null},moveToBookmark:function(bookmark){var inst=this.instance,rng,nl,i,ex,b=inst.getBody(),sd;var doc=inst.getDoc(),win=inst.getWin(),sel=this.getSel();if(!bookmark)return false;if(tinyMCE.isSafari&&bookmark.rng){sel.setBaseAndExtent(bookmark.rng.startContainer,bookmark.rng.startOffset,bookmark.rng.endContainer,bookmark.rng.endOffset);return true}if(tinyMCE.isRealIE){if(bookmark.rng){try{bookmark.rng.select()}catch(ex){}return true}win.focus();if(bookmark.tag){rng=b.createControlRange();nl=b.getElementsByTagName(bookmark.tag);if(nl.l
 ength>bookmark.index){try{rng.addElement(nl[bookmark.index])}catch(ex){}}}else{try{if(bookmark.start<0)return true;rng=inst.getSel().createRange();rng.moveToElementText(inst.getBody());rng.collapse(true);rng.moveStart('character',bookmark.start);rng.moveEnd('character',bookmark.length)}catch(ex){return true}}rng.select();win.scrollTo(bookmark.scrollX,bookmark.scrollY);return true}if(tinyMCE.isGecko||tinyMCE.isOpera){if(!sel)return false;if(bookmark.rng){sel.removeAllRanges();sel.addRange(bookmark.rng)}if(bookmark.start!=-1&&bookmark.end!=-1){try{sd=this._getTextPos(b,bookmark.start,bookmark.end);rng=doc.createRange();rng.setStart(sd.startNode,sd.startOffset);rng.setEnd(sd.endNode,sd.endOffset);sel.removeAllRanges();sel.addRange(rng);if(!tinyMCE.isOpera)win.focus()}catch(ex){}}win.scrollTo(bookmark.scrollX,bookmark.scrollY);return true}return false},_getPosText:function(r,sn,en){var w=document.createTreeWalker(r,NodeFilter.SHOW_TEXT,null,false),n,p=0,d={};while((n=w.nextNode(
 ))!=null){if(n==sn)d.start=p;if(n==en){d.end=p;return d}p+=n.nodeValue?n.nodeValue.length:0}return null},_getTextPos:function(r,sp,ep){var w=document.createTreeWalker(r,NodeFilter.SHOW_TEXT,null,false),n,p=0,d={};while((n=w.nextNode())!=null){p+=n.nodeValue?n.nodeValue.length:0;if(p>=sp&&!d.startNode){d.startNode=n;d.startOffset=sp-(p-n.nodeValue.length)}if(p>=ep){d.endNode=n;d.endOffset=ep-(p-n.nodeValue.length);return d}}return null},selectNode:function(node,collapse,select_text_node,to_start){var inst=this.instance,sel,rng,nodes;if(!node)return;if(typeof(collapse)=="undefined")collapse=true;if(typeof(select_text_node)=="undefined")select_text_node=false;if(typeof(to_start)=="undefined")to_start=true;if(inst.settings.auto_resize)inst.resizeToContent();if(tinyMCE.isRealIE){rng=inst.getDoc().body.createTextRange();try{rng.moveToElementText(node);if(collapse)rng.collapse(to_start);rng.select()}catch(e){}}else{sel=this.getSel();if(!sel)return;if(tinyMCE.isSafari){sel.setBaseAn
 dExtent(node,0,node,node.innerText.length);if(collapse){if(to_start)sel.collapseToStart();else sel.collapseToEnd()}this.scrollToNode(node);return}rng=inst.getDoc().createRange();if(select_text_node){nodes=tinyMCE.getNodeTree(node,[],3);if(nodes.length>0)rng.selectNodeContents(nodes[0]);else rng.selectNodeContents(node)}else rng.selectNode(node);if(collapse){if(!to_start&&node.nodeType==3){rng.setStart(node,node.nodeValue.length);rng.setEnd(node,node.nodeValue.length)}else rng.collapse(to_start)}sel.removeAllRanges();sel.addRange(rng)}this.scrollToNode(node);tinyMCE.selectedElement=null;if(node.nodeType==1)tinyMCE.selectedElement=node},scrollToNode:function(node){var inst=this.instance,w=inst.getWin(),vp=inst.getViewPort(),pos=tinyMCE.getAbsPosition(node),cvp,p,cwin;if(pos.absLeft<vp.left||pos.absLeft>vp.left+vp.width||pos.absTop<vp.top||pos.absTop>vp.top+(vp.height-25))w.scrollTo(pos.absLeft,pos.absTop-vp.height+25);if(inst.settings.auto_resize){cwin=inst.getContainerWin();c
 vp=tinyMCE.getViewPort(cwin);p=this.getAbsPosition(node);if(p.absLeft<cvp.left||p.absLeft>cvp.left+cvp.width||p.absTop<cvp.top||p.absTop>cvp.top+cvp.height)cwin.scrollTo(p.absLeft,p.absTop-cvp.height+25)}},getAbsPosition:function(n){var pos=tinyMCE.getAbsPosition(n),ipos=tinyMCE.getAbsPosition(this.instance.iframeElement);return{absLeft:ipos.absLeft+pos.absLeft,absTop:ipos.absTop+pos.absTop}},getSel:function(){var inst=this.instance;if(tinyMCE.isRealIE)return inst.getDoc().selection;return inst.contentWindow.getSelection()},getRng:function(){var s=this.getSel();if(s==null)return null;if(tinyMCE.isRealIE)return s.createRange();if(tinyMCE.isSafari&&!s.getRangeAt)return''+window.getSelection();if(s.rangeCount>0)return s.getRangeAt(0);return null},isCollapsed:function(){var r=this.getRng();if(r.item)return false;return r.boundingWidth==0||this.getSel().isCollapsed},collapse:function(b){var r=this.getRng(),s=this.getSel();if(r.select){r.collapse(b);r.select()}else{if(b)s.collapse
 ToStart();else s.collapseToEnd()}},getFocusElement:function(){var inst=this.instance,doc,rng,sel,elm;if(tinyMCE.isRealIE){doc=inst.getDoc();rng=doc.selection.createRange();elm=rng.item?rng.item(0):rng.parentElement()}else{if(!tinyMCE.isSafari&&inst.isHidden())return inst.getBody();sel=this.getSel();rng=this.getRng();if(!sel||!rng)return null;elm=rng.commonAncestorContainer;if(!rng.collapsed){if(rng.startContainer==rng.endContainer){if(rng.startOffset-rng.endOffset<2){if(rng.startContainer.hasChildNodes())elm=rng.startContainer.childNodes[rng.startOffset]}}}elm=tinyMCE.getParentElement(elm);}return elm}};function TinyMCE_UndoRedo(inst){this.instance=inst;this.undoLevels=[];this.undoIndex=0;this.typingUndoIndex=-1;this.undoRedo=true};TinyMCE_UndoRedo.prototype={add:function(l){var b,customUndoLevels,newHTML,inst=this.instance,i,ul,ur;if(l){this.undoLevels[this.undoLevels.length]=l;return true}if(this.typingUndoIndex!=-1){this.undoIndex=this.typingUndoIndex;if(tinyMCE.typingUnd
 oIndex!=-1)tinyMCE.undoIndex=tinyMCE.typingUndoIndex}newHTML=tinyMCE.trim(inst.getBody().innerHTML);if(this.undoLevels[this.undoIndex]&&newHTML!=this.undoLevels[this.undoIndex].content){inst.isNotDirty=false;tinyMCE.dispatchCallback(inst,'onchange_callback','onChange',inst);customUndoLevels=tinyMCE.settings.custom_undo_redo_levels;if(customUndoLevels!=-1&&this.undoLevels.length>customUndoLevels){for(i=0;i<this.undoLevels.length-1;i++)this.undoLevels[i]=this.undoLevels[i+1];this.undoLevels.length--;this.undoIndex--;}b=inst.undoBookmark;if(!b)b=inst.selection.getBookmark();this.undoIndex++;this.undoLevels[this.undoIndex]={content:newHTML,bookmark:b};ul=tinyMCE.undoLevels;for(i=tinyMCE.undoIndex+1;i<ul.length;i++){ur=ul[i].undoRedo;if(ur.undoIndex==ur.undoLevels.length-1)ur.undoIndex--;ur.undoLevels.length--}tinyMCE.undoLevels[tinyMCE.undoIndex++]=inst;tinyMCE.undoLevels.length=tinyMCE.undoIndex;this.undoLevels.length=this.undoIndex+1;return true}return false},undo:function(){v
 ar inst=this.instance;if(this.undoIndex>0){this.undoIndex--;tinyMCE.setInnerHTML(inst.getBody(),this.undoLevels[this.undoIndex].content);inst.repaint();if(inst.settings.custom_undo_redo_restore_selection)inst.selection.moveToBookmark(this.undoLevels[this.undoIndex].bookmark)}},redo:function(){var inst=this.instance;tinyMCE.execCommand("mceEndTyping");if(this.undoIndex<(this.undoLevels.length-1)){this.undoIndex++;tinyMCE.setInnerHTML(inst.getBody(),this.undoLevels[this.undoIndex].content);inst.repaint();if(inst.settings.custom_undo_redo_restore_selection)inst.selection.moveToBookmark(this.undoLevels[this.undoIndex].bookmark)}tinyMCE.triggerNodeChange()}};var TinyMCE_ForceParagraphs={_insertPara:function(inst,e){var doc=inst.getDoc(),sel=inst.getSel(),body=inst.getBody(),win=inst.contentWindow,rng=sel.getRangeAt(0);var rootElm=doc.documentElement,blockName="P",startNode,endNode,startBlock,endBlock;var rngBefore,rngAfter,direct,startNode,startOffset,endNode,endOffset,b=tinyMCE.
 isOpera?inst.selection.getBookmark():null;var paraBefore,paraAfter,startChop,endChop,contents,i;function isEmpty(para){var nodes;function isEmptyHTML(html){return html.replace(new RegExp('[ \t\r\n]+','g'),'').toLowerCase()==''}if(para.getElementsByTagName("img").length>0)return false;if(para.getElementsByTagName("table").length>0)return false;if(para.getElementsByTagName("hr").length>0)return false;nodes=tinyMCE.getNodeTree(para,[],3);for(i=0;i<nodes.length;i++){if(!isEmptyHTML(nodes[i].nodeValue))return false}return true}rngBefore=doc.createRange();rngBefore.setStart(sel.anchorNode,sel.anchorOffset);rngBefore.collapse(true);rngAfter=doc.createRange();rngAfter.setStart(sel.focusNode,sel.focusOffset);rngAfter.collapse(true);direct=rngBefore.compareBoundaryPoints(rngBefore.START_TO_END,rngAfter)<0;startNode=direct?sel.anchorNode:sel.focusNode;startOffset=direct?sel.anchorOffset:sel.focusOffset;endNode=direct?sel.focusNode:sel.anchorNode;endOffset=direct?sel.focusOffset:sel.anc
 horOffset;startNode=startNode.nodeName=="HTML"?doc.body:startNode;startNode=startNode.nodeName=="BODY"?startNode.firstChild:startNode;endNode=endNode.nodeName=="BODY"?endNode.firstChild:endNode;startBlock=inst.getParentBlockElement(startNode);endBlock=inst.getParentBlockElement(endNode);if(startBlock&&(startBlock.nodeName=='CAPTION'||/absolute|relative|static/gi.test(startBlock.style.position)))startBlock=null;if(endBlock&&(endBlock.nodeName=='CAPTION'||/absolute|relative|static/gi.test(endBlock.style.position)))endBlock=null;if(startBlock!=null){blockName=startBlock.nodeName;if(/(TD|TABLE|TH|CAPTION)/.test(blockName)||(blockName=="DIV"&&/left|right/gi.test(startBlock.style.cssFloat)))blockName="P"}if(tinyMCE.getParentElement(startBlock,"OL,UL",null,body)!=null)return false;if((startBlock!=null&&startBlock.nodeName=="TABLE")||(endBlock!=null&&endBlock.nodeName=="TABLE"))startBlock=endBlock=null;paraBefore=(startBlock!=null&&startBlock.nodeName==blockName)?startBlock.cloneNod
 e(false):doc.createElement(blockName);paraAfter=(endBlock!=null&&endBlock.nodeName==blockName)?endBlock.cloneNode(false):doc.createElement(blockName);if(/^(H[1-6])$/.test(blockName))paraAfter=doc.createElement("p");startChop=startNode;endChop=endNode;node=startChop;do{if(node==body||node.nodeType==9||tinyMCE.isBlockElement(node))break;startChop=node}while((node=node.previousSibling?node.previousSibling:node.parentNode));node=endChop;do{if(node==body||node.nodeType==9||tinyMCE.isBlockElement(node))break;endChop=node}while((node=node.nextSibling?node.nextSibling:node.parentNode));if(startChop.nodeName=="TD")startChop=startChop.firstChild;if(endChop.nodeName=="TD")endChop=endChop.lastChild;if(startBlock==null){rng.deleteContents();if(!tinyMCE.isSafari)sel.removeAllRanges();if(startChop!=rootElm&&endChop!=rootElm){rngBefore=rng.cloneRange();if(startChop==body)rngBefore.setStart(startChop,0);else rngBefore.setStartBefore(startChop);paraBefore.appendChild(rngBefore.cloneContents()
 );if(endChop.parentNode.nodeName==blockName)endChop=endChop.parentNode;rng.setEndAfter(endChop);if(endChop.nodeName!="#text"&&endChop.nodeName!="BODY")rngBefore.setEndAfter(endChop);contents=rng.cloneContents();if(contents.firstChild&&(contents.firstChild.nodeName==blockName||contents.firstChild.nodeName=="BODY"))paraAfter.innerHTML=contents.firstChild.innerHTML;else paraAfter.appendChild(contents);if(isEmpty(paraBefore))paraBefore.innerHTML="&nbsp;";if(isEmpty(paraAfter))paraAfter.innerHTML="&nbsp;";rng.deleteContents();rngAfter.deleteContents();rngBefore.deleteContents();if(tinyMCE.isOpera){paraBefore.normalize();rngBefore.insertNode(paraBefore);paraAfter.normalize();rngBefore.insertNode(paraAfter)}else{paraAfter.normalize();rngBefore.insertNode(paraAfter);paraBefore.normalize();rngBefore.insertNode(paraBefore)}}else{body.innerHTML="<"+blockName+">&nbsp;</"+blockName+"><"+blockName+">&nbsp;</"+blockName+">";paraAfter=body.childNodes[1]}inst.selection.moveToBookmark(b);inst
 .selection.selectNode(paraAfter,true,true);return true}if(startChop.nodeName==blockName)rngBefore.setStart(startChop,0);else rngBefore.setStartBefore(startChop);rngBefore.setEnd(startNode,startOffset);paraBefore.appendChild(rngBefore.cloneContents());rngAfter.setEndAfter(endChop);rngAfter.setStart(endNode,endOffset);contents=rngAfter.cloneContents();if(contents.firstChild&&contents.firstChild.nodeName==blockName){paraAfter.innerHTML=contents.firstChild.innerHTML}else paraAfter.appendChild(contents);if(isEmpty(paraBefore))paraBefore.innerHTML="&nbsp;";if(isEmpty(paraAfter))paraAfter.innerHTML="&nbsp;";rng=doc.createRange();if(!startChop.previousSibling&&startChop.parentNode.nodeName.toUpperCase()==blockName){rng.setStartBefore(startChop.parentNode)}else{if(rngBefore.startContainer.nodeName.toUpperCase()==blockName&&rngBefore.startOffset==0)rng.setStartBefore(rngBefore.startContainer);else rng.setStart(rngBefore.startContainer,rngBefore.startOffset)}if(!endChop.nextSibling&&en
 dChop.parentNode.nodeName.toUpperCase()==blockName)rng.setEndAfter(endChop.parentNode);else rng.setEnd(rngAfter.endContainer,rngAfter.endOffset);rng.deleteContents();if(tinyMCE.isOpera){rng.insertNode(paraBefore);rng.insertNode(paraAfter)}else{rng.insertNode(paraAfter);rng.insertNode(paraBefore)}paraAfter.normalize();paraBefore.normalize();inst.selection.moveToBookmark(b);inst.selection.selectNode(paraAfter,true,true);return true},_handleBackSpace:function(inst){var r=inst.getRng(),sn=r.startContainer,nv,s=false;if(sn&&sn.nextSibling&&sn.nextSibling.nodeName=="BR"&&sn.parentNode.nodeName!="BODY"){nv=sn.nodeValue;if(nv!=null&&r.startOffset==nv.length)sn.nextSibling.parentNode.removeChild(sn.nextSibling)}if(inst.settings.auto_resize)inst.resizeToContent();return s}};function TinyMCE_Layer(id,bm){this.id=id;this.blockerElement=null;this.events=false;this.element=null;this.blockMode=typeof(bm)!='undefined'?bm:true;this.doc=document};TinyMCE_Layer.prototype={moveRelativeTo:functi
 on(re,p){var rep=this.getAbsPosition(re),e=this.getElement(),x,y;var w=parseInt(re.offsetWidth),h=parseInt(re.offsetHeight);var ew=parseInt(e.offsetWidth),eh=parseInt(e.offsetHeight);switch(p){case"tl":x=rep.absLeft;y=rep.absTop;break;case"tr":x=rep.absLeft+w;y=rep.absTop;break;case"bl":x=rep.absLeft;y=rep.absTop+h;break;case"br":x=rep.absLeft+w;y=rep.absTop+h;break;case"cc":x=rep.absLeft+(w/ 2) - (ew /2);y=rep.absTop+(h/ 2) - (eh /2);break}this.moveTo(x,y)},moveBy:function(x,y){var e=this.getElement();this.moveTo(parseInt(e.style.left)+x,parseInt(e.style.top)+y)},moveTo:function(x,y){var e=this.getElement();e.style.left=x+"px";e.style.top=y+"px";this.updateBlocker()},resizeBy:function(w,h){var e=this.getElement();this.resizeTo(parseInt(e.style.width)+w,parseInt(e.style.height)+h)},resizeTo:function(w,h){var e=this.getElement();if(w!=null)e.style.width=w+"px";if(h!=null)e.style.height=h+"px";this.updateBlocker()},show:function(){var el=this.getElement();if(el){el.style.displ
 ay='block';this.updateBlocker()}},hide:function(){var el=this.getElement();if(el){el.style.display='none';this.updateBlocker()}},isVisible:function(){return this.getElement().style.display=='block'},getElement:function(){if(!this.element)this.element=this.doc.getElementById(this.id);return this.element},setBlockMode:function(s){this.blockMode=s},updateBlocker:function(){var e,b,x,y,w,h;b=this.getBlocker();if(b){if(this.blockMode){e=this.getElement();x=this.parseInt(e.style.left);y=this.parseInt(e.style.top);w=this.parseInt(e.offsetWidth);h=this.parseInt(e.offsetHeight);b.style.left=x+'px';b.style.top=y+'px';b.style.width=w+'px';b.style.height=h+'px';b.style.display=e.style.display}else b.style.display='none'}},getBlocker:function(){var d,b;if(!this.blockerElement&&this.blockMode){d=this.doc;b=d.getElementById(this.id+"_blocker");if(!b){b=d.createElement("iframe");b.setAttribute('id',this.id+"_blocker");b.style.cssText='display: none; position: absolute; left: 0; top: 0';b.sr
 c='javascript:false;';b.frameBorder='0';b.scrolling='no';d.body.appendChild(b)}this.blockerElement=b}return this.blockerElement},getAbsPosition:function(n){var p={absLeft:0,absTop:0};while(n){p.absLeft+=n.offsetLeft;p.absTop+=n.offsetTop;n=n.offsetParent}return p},create:function(n,c,p,h){var d=this.doc,e=d.createElement(n);e.setAttribute('id',this.id);if(c)e.className=c;if(!p)p=d.body;if(h)e.innerHTML=h;p.appendChild(e);return this.element=e},exists:function(){return this.doc.getElementById(this.id)!=null},parseInt:function(s){if(s==null||s=='')return 0;return parseInt(s)},remove:function(){var e=this.getElement(),b=this.getBlocker();if(e)e.parentNode.removeChild(e);if(b)b.parentNode.removeChild(b)}};function TinyMCE_Menu(){var id;if(typeof(tinyMCE.menuCounter)=="undefined")tinyMCE.menuCounter=0;id="mc_menu_"+tinyMCE.menuCounter++;TinyMCE_Layer.call(this,id,true);this.id=id;this.items=[];this.needsUpdate=true};TinyMCE_Menu.prototype=tinyMCE.extend(TinyMCE_Layer.prototype,{i
 nit:function(s){var n;this.settings={separator_class:'mceMenuSeparator',title_class:'mceMenuTitle',disabled_class:'mceMenuDisabled',menu_class:'mceMenu',drop_menu:true};for(n in s)this.settings[n]=s[n];this.create('div',this.settings.menu_class)},clear:function(){this.items=[]},addTitle:function(t){this.add({type:'title',text:t})},addDisabled:function(t){this.add({type:'disabled',text:t})},addSeparator:function(){this.add({type:'separator'})},addItem:function(t,js){this.add({text:t,js:js})},add:function(mi){this.items[this.items.length]=mi;this.needsUpdate=true},update:function(){var e=this.getElement(),h='',i,t,m=this.items,s=this.settings;if(this.settings.drop_menu)h+='<span class="mceMenuLine"></span>';h+='<table border="0" cellpadding="0" cellspacing="0">';for(i=0;i<m.length;i++){t=tinyMCE.xmlEncode(m[i].text);c=m[i].class_name?' class="'+m[i].class_name+'"':'';switch(m[i].type){case'separator':h+='<tr class="'+s.separator_class+'"><td>';break;case'title':h+='<tr class="
 '+s.title_class+'"><td><span'+c+'>'+t+'</span>';break;case'disabled':h+='<tr class="'+s.disabled_class+'"><td><span'+c+'>'+t+'</span>';break;default:h+='<tr><td><a href="'+tinyMCE.xmlEncode(m[i].js)+'" onmousedown="'+tinyMCE.xmlEncode(m[i].js)+';return tinyMCE.cancelEvent(event);" onclick="return tinyMCE.cancelEvent(event);" onmouseup="return tinyMCE.cancelEvent(event);"><span'+c+'>'+t+'</span></a>'}h+='</td></tr>'}h+='</table>';e.innerHTML=h;this.needsUpdate=false;this.updateBlocker()},show:function(){var nl,i;if(tinyMCE.lastMenu==this)return;if(this.needsUpdate)this.update();if(tinyMCE.lastMenu&&tinyMCE.lastMenu!=this)tinyMCE.lastMenu.hide();TinyMCE_Layer.prototype.show.call(this);if(!tinyMCE.isOpera){}tinyMCE.lastMenu=this}});tinyMCE.add(TinyMCE_Engine,{debug:function(){var m="",a,i,l=tinyMCE.log.length;for(i=0,a=this.debug.arguments;i<a.length;i++){m+=a[i];if(i<a.length-1)m+=', '}if(l<1000)tinyMCE.log[l]="[debug] "+m}});
\ No newline at end of file
+(function(c){var a=/^\s*|\s*$/g,d;var b={majorVersion:"3",minorVersion:"3.9",releaseDate:"2010-09-08",_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|_full)(_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.s
 ubstring(0,i.src.lastIndexOf("/"));if(j&&r.baseURL.indexOf("://")==-1&&r.baseURL.indexOf("/")!==0){r.baseURL=j+r.baseURL}return r.baseURL}return null}e=o.getElementsByTagName("script");for(l=0;l<e.length;l++){if(g(e[l])){return}}k=o.getElementsByTagName("head")[0];if(k){e=k.getElementsByTagName("script");for(l=0;l<e.length;l++){if(g(e[l])){return}}}return},is:function(f,e){if(!e){return f!==d}if(e=="array"&&(f.hasOwnProperty&&f instanceof Array)){return true}return typeof(f)==e},each:function(h,e,g){var i,f;if(!h){return 0}g=g||h;if(h.length!==d){for(i=0,f=h.length;i<f;i++){if(e.call(g,h[i],i,h)===false){return 0}}}else{for(i in h){if(h.hasOwnProperty(i)){if(e.call(g,h[i],i,h)===false){return 0}}}}return 1},map:function(e,g){var h=[];b.each(e,function(f){h.push(g(f))});return h},grep:function(e,g){var h=[];b.each(e,function(f){if(!g||g(f)){h.push(f)}});return h},inArray:function(f,g){var h,e;if(f){for(h=0,e=f.length;h<e;h++){if(f[h]===g){return h}}}return -1},extend:function
 (k,j){var h,g,f=arguments;for(h=1,g=f.length;h<g;h++){j=f[h];b.each(j,function(e,i){if(e!==d){k[i]=e}})}return k},trim:function(e){return(e?""+e:"").replace(a,"")},create:function(m,e){var l=this,f,h,i,j,g,k=0;m=/^((static) )?([\w.]+)(:([\w.]+))?/.exec(m);i=m[3].match(/(^|\.)(\w+)$/i)[2];h=l.createNS(m[3].replace(/\.\w+$/,""));if(h[i]){return}if(m[2]=="static"){h[i]=e;if(this.onCreate){this.onCreate(m[2],m[3],h[i])}return}if(!e[i]){e[i]=function(){};k=1}h[i]=e[i];l.extend(h[i].prototype,e);if(m[5]){f=l.resolve(m[5]).prototype;j=m[5].match(/\.(\w+)$/i)[1];g=h[i];if(k){h[i]=function(){return f[j].apply(this,arguments)}}else{h[i]=function(){this.parent=f[j];return g.apply(this,arguments)}}h[i].prototype[i]=h[i];l.each(f,function(o,p){h[i].prototype[p]=f[p]});l.each(e,function(o,p){if(f[p]){h[i].prototype[p]=function(){this.parent=f[p];return o.apply(this,arguments)}}else{if(p!=i){h[i].prototype[p]=o}}})}l.each(e["static"],function(o,p){h[i][p]=o});if(this.onCreate){this.onCreat
 e(m[2],m[3],h[i].prototype)}},walk:function(h,g,i,e){e=e||this;if(h){if(i){h=h[i]}b.each(h,function(j,f){if(g.call(e,j,f,i)===false){return false}b.walk(j,g,i,e)})}},createNS:function(h,g){var f,e;g=g||c;h=h.split(".");for(f=0;f<h.length;f++){e=h[f];if(!g[e]){g[e]={}}g=g[e]}return g},resolve:function(h,g){var f,e;g=g||c;h=h.split(".");for(f=0,e=h.length;f<e;f++){g=g[h[f]];if(!g){break}}return g},addUnload:function(i,h){var g=this;i={func:i,scope:h||this};if(!g.unloads){function e(){var f=g.unloads,k,l;if(f){for(l in f){k=f[l];if(k&&k.func){k.func.call(k.scope,1)}}if(c.detachEvent){c.detachEvent("onbeforeunload",j);c.detachEvent("onunload",e)}else{if(c.removeEventListener){c.removeEventListener("unload",e,false)}}g.unloads=k=f=w=e=0;if(c.CollectGarbage){CollectGarbage()}}}function j(){var k=document;if(k.readyState=="interactive"){function f(){k.detachEvent("onstop",f);if(e){e()}k=0}if(k){k.attachEvent("onstop",f)}c.setTimeout(function(){if(k){k.detachEvent("onstop",f)}},0)}}
 if(c.attachEvent){c.attachEvent("onunload",e);c.attachEvent("onbeforeunload",j)}else{if(c.addEventListener){c.addEventListener("unload",e,false)}}g.unloads=[i]}else{g.unloads.push(i)}return i},removeUnload:function(h){var e=this.unloads,g=null;b.each(e,function(j,f){if(j&&j.func==h){e.splice(f,1);g=h;return false}});return g},explode:function(e,f){return e?b.map(e.split(f||","),b.trim):e},_addVer:function(f){var e;if(!this.query){return f}e=(f.indexOf("?")==-1?"?":"&")+this.query;if(f.indexOf("#")==-1){return f+e}return f.replace("#",e+"#")}};b._init();c.tinymce=c.tinyMCE=b})(window);tinymce.create("tinymce.util.Dispatcher",{scope:null,listeners:null,Dispatcher:function(a){this.scope=a||this;this.listeners=[]},add:function(a,b){this.listeners.push({cb:a,scope:b||this.scope});return a},addToTop:function(a,b){this.listeners.unshift({cb:a,scope:b||this.scope});return a},remove:function(a){var b=this.listeners,c=null;tinymce.each(b,function(e,d){if(a==e.cb){c=a;b.splice(d,1);ret
 urn 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.serial
 ize({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|heigh
 t|borderWidth)$/,props:{"for":"htmlFor","class":"className",className:"className",checked:"checked",disabled:"disabled",maxlength:"maxLength",readonly:"readOnly",selected:"selected",value:"value",id:"id",name:"name",type:"type"},DOMUtils:function(u,q){var p=this,o;p.doc=u;p.win=window;p.files={};p.cssFlicker=false;p.counter=0;p.boxModel=!m.isIE||u.compatMode=="CSS1Compat";p.stdMode=u.documentMode===8;p.settings=q=m.extend({keep_values:false,hex_colors:1,process_html:1},q);if(m.isIE6){try{u.execCommand("BackgroundImageCache",false,true)}catch(r){p.cssFlicker=true}}if(q.valid_styles){p._styles={};k(q.valid_styles,function(t,s){p._styles[s]=m.explode(t)})}m.addUnload(p.destroy,p)},getRoot:function(){var o=this,p=o.settings;return(p&&o.get(p.root_element))||o.doc.body},getViewPort:function(p){var q,o;p=!p?this.win:p;q=p.document;o=this.boxModel?q.documentElement:q.body;return{x:p.pageXOffset||o.scrollLeft,y:p.pageYOffset||o.scrollTop,w:p.innerWidth||o.clientWidth,h:p.innerHeight
 ||o.clientHeight}},getRect:function(s){var r,o=this,q;s=o.get(s);r=o.getPos(s);q=o.getSize(s);return{x:r.x,y:r.y,w:q.w,h:q.h}},getSize:function(r){var p=this,o,q;r=p.get(r);o=p.getStyle(r,"width");q=p.getStyle(r,"height");if(o.indexOf("px")===-1){o=0}if(q.indexOf("px")===-1){q=0}return{w:parseInt(o)||r.offsetWidth||r.clientWidth,h:parseInt(q)||r.offsetHeight||r.clientHeight}},getParent:function(q,p,o){return this.getParents(q,p,o,false)},getParents:function(z,v,s,y){var q=this,p,u=q.settings,x=[];z=q.get(z);y=y===undefined;if(u.strict_root){s=s||q.getRoot()}if(j(v,"string")){p=v;if(v==="*"){v=function(o){return o.nodeType==1}}else{v=function(o){return q.is(o,p)}}}while(z){if(z==s||!z.nodeType||z.nodeType===9){break}if(!v||v(z)){if(y){x.push(z)}else{return z}}z=z.parentNode}return y?x:null},get:function(o){var p;if(o&&this.doc&&typeof(o)=="string"){p=o;o=this.doc.getElementById(o);if(o&&o.id!==p){return this.doc.getElementsByName(p)[1]}}return o},getNext:function(p,o){return 
 this._findSib(p,o,"nextSibling")},getPrev:function(p,o){return this._findSib(p,o,"previousSibling")},select:function(q,p){var o=this;return m.dom.Sizzle(q,o.get(p)||o.get(o.settings.root_element)||o.doc,[])},is:function(q,o){var p;if(q.length===undefined){if(o==="*"){return q.nodeType==1}if(b.test(o)){o=o.toLowerCase().split(/,/);q=q.nodeName.toLowerCase();for(p=o.length-1;p>=0;p--){if(o[p]==q){return true}}return false}}return m.dom.Sizzle.matches(o,q.nodeType?[q]:q).length>0},add:function(s,v,o,r,u){var q=this;return this.run(s,function(y){var x,t;x=j(v,"string")?q.doc.createElement(v):v;q.setAttribs(x,o);if(r){if(r.nodeType){x.appendChild(r)}else{q.setHTML(x,r)}}return !u?y.appendChild(x):x})},create:function(q,o,p){return this.add(this.doc.createElement(q),q,o,p,1)},createHTML:function(v,p,s){var u="",r=this,q;u+="<"+v;for(q in p){if(p.hasOwnProperty(q)){u+=" "+q+'="'+r.encode(p[q])+'"'}}if(m.is(s)){return u+">"+s+"</"+v+">"}return u+" />"},remove:function(o,p){return th
 is.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.nodeTy
 pe){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,fu
 nction(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.getAttribu
 te(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_sco
 pe||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.seri
 alizeStyle(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)},ge
 tAttribs: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=fun
 ction(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],endOffse
 t: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.parentNo
 de){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.appendCh
 ild(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.colla
 pse(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.nextS
 ibling: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.end
 Container;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(){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.fin
 d(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-\uFFF
 F\-]|\\.)+)/,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.s
 electedIndex;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},T
 AG: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.setS
 tart(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.getElements
 ByTagName("*").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.getElementsB
 yClassName("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.nodeN
 ame!=="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(){t
 his.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(["onBeforeSet
 Content","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.dis
 patch(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.duplica
 te||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){retu
 rn{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");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:functi
 on(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.startContai
 ner.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();th
 is.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,ae
 lig,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,870
 4,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.a
 ppendChild(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,tru
 e))});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.cont
 ent).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}},_getA
 ttrib: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()),su
 ccess: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.Me
 nu: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:Mat
 h.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["c
 lass"]:"")});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.sel
 ectedIndex=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.isDisable
 d()||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 mceNoIcon
 s",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.select
 ByIndex(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.rem
 ove(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+"Me
 nu",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,"mceSplitButtonHove
 r")}});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: re
 lative">'+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",{AddOnManager:function(){var d=this;d.items=[];d.urls={};d.lookup={};d.onAdd=new a(d)},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("/"));if(!f.lookup[h]){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.ScriptLoade
 r,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.isI
 E){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.isWeb
 Kit,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,ad
 d_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|sele
 cted|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_trig
 ger){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:funct
 ion(){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!="mceRe
 paint"&&(!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:(f
 unction(){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,{va
 lid_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:[{i
 nline:"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.onGetC
 ontent.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.execCal
 lback("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.callb
 ackLookup=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},getD
 oc: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,"mceItem
 Anchor")}}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.settin
 gs,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.s
 etContent(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(funct
 ion(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(funct
 ion(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,JustifyFul
 l":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:functio
 n(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,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:fu
 nction(){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.getE
 nd(),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.appendCh
 ild(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()&&s){v=u.getParent(v,u.isBlock);if(v&&v.nodeName!="LI"){v.innerHTML="";if(o._previousFormats){v.appendChild(s.wrap
 per);s.inner.innerHTML="\uFEFF"}else{v.innerHTML="\uFEFF"}p.select(v,1);t.getDoc().execCommand("Delete",false,null);o._previousFormats=0}}}})}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.appendCh
 ild(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.node
 Name=="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.previousSibli
 ng&&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.ins
 ertNode(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,NodeF
 ilter.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.createC
 ontrol){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("un
 available",""),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.pa
 rams=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)},execComman
 d: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.dee
 p=!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.nodeN
 ame.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,a
 j=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}fu
 nction 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.le
 ngth;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.get
 Root()){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,"sty
 le")))){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){e.each(i,function(l,k){if(l){g.setStyle(j,k,l)}});g.rename(j,"span")}d={font:fu
 nction(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

Added: plog/branches/lifetype-1.2/js/tinymce/tiny_mce_gzip.js
===================================================================
--- plog/branches/lifetype-1.2/js/tinymce/tiny_mce_gzip.js	                        (rev 0)
+++ plog/branches/lifetype-1.2/js/tinymce/tiny_mce_gzip.js	2010-09-21 23:00:22 UTC (rev 7027)
@@ -0,0 +1,134 @@
+var tinyMCE_GZ = {
+	settings : {
+		themes : '',
+		plugins : '',
+		languages : '',
+		disk_cache : false,
+		page_name : 'tiny_mce_gzip.php',
+		debug : true,
+		suffix : ''
+	},
+
+	init : function(s, cb, sc) {
+		var t = this, n, i, nl = document.getElementsByTagName('script');
+
+		for (n in s)
+			t.settings[n] = s[n];
+
+		s = t.settings;
+
+		for (i=0; i<nl.length; i++) {
+			n = nl[i];
+
+			if (n.src && n.src.indexOf('tiny_mce') != -1)
+				t.baseURL = n.src.substring(0, n.src.lastIndexOf('/'));
+		}
+
+		if (!t.coreLoaded)
+			t.loadScripts(1, s.themes, s.plugins, s.languages, cb, sc);
+	},
+
+	loadScripts : function(co, th, pl, la, cb, sc) {
+		var t = this, x, w = window, q, c = 0, ti, s = t.settings;
+
+		function get(s) {
+			x = 0;
+
+			try {
+				x = new ActiveXObject(s);
+			} catch (s) {
+			}
+
+			return x;
+		};
+
+		// Build query string
+		q = 'js=true&diskcache=' + (s.disk_cache ? 'true' : 'false') + '&core=' + (co ? 'true' : 'false') + '&suffix=' + escape(s.suffix) + '&themes=' + escape(th) + '&plugins=' + escape(pl) + '&languages=' + escape(la);
+
+		if (co)
+			t.coreLoaded = 1;
+
+		// Send request
+		x = w.XMLHttpRequest ? new XMLHttpRequest() : get('Msxml2.XMLHTTP') || get('Microsoft.XMLHTTP');
+		x.overrideMimeType && x.overrideMimeType('text/javascript');
+		x.open('GET', t.baseURL + '/' + s.page_name + '?' + q, !!cb);
+//		x.setRequestHeader('Content-Type', 'text/javascript');
+		x.send('');
+
+		// Handle asyncronous loading
+		if (cb) {
+			// Wait for response
+			ti = w.setInterval(function() {
+				if (x.readyState == 4 || c++ > 10000) {
+					w.clearInterval(ti);
+
+					if (c < 10000 && x.status == 200) {
+						t.loaded = 1;
+						t.eval(x.responseText);
+						tinymce.dom.Event.domLoaded = true;
+						cb.call(sc || t, x);
+					}
+
+					ti = x = null;
+				}
+			}, 10);
+		} else
+			t.eval(x.responseText);
+	},
+
+	start : function() {
+		var t = this, each = tinymce.each, s = t.settings, ln = s.languages.split(',');
+
+		tinymce.suffix = s.suffix;
+
+		function load(u) {
+			tinymce.ScriptLoader.markDone(tinyMCE.baseURI.toAbsolute(u));
+		};
+
+		// Add core languages
+		each(ln, function(c) {
+			if (c)
+				load('langs/' + c + '.js');
+		});
+
+		// Add themes with languages
+		each(s.themes.split(','), function(n) {
+			if (n) {
+				load('themes/' + n + '/editor_template' + s.suffix + '.js');
+
+				each (ln, function(c) {
+					if (c)
+						load('themes/' + n + '/langs/' + c + '.js');
+				});
+			}
+		});
+
+		// Add plugins with languages
+		each(s.plugins.split(','), function(n) {
+			if (n) {
+				load('plugins/' + n + '/editor_plugin' + s.suffix + '.js');
+
+				each(ln, function(c) {
+					if (c)
+						load('plugins/' + n + '/langs/' + c + '.js');
+				});
+			}
+		});
+	},
+
+	end : function() {
+	},
+
+	eval : function(co) {
+		var w = window;
+
+		// Evaluate script
+		if (!w.execScript) {
+			if (/Gecko/.test(navigator.userAgent))
+				eval(co, w); // Firefox 3.0
+			else
+				eval.call(w, co);
+		} else
+			w.execScript(co); // IE
+	}
+};

Modified: plog/branches/lifetype-1.2/js/tinymce/tiny_mce_gzip.php
===================================================================
--- plog/branches/lifetype-1.2/js/tinymce/tiny_mce_gzip.php	2010-09-21 21:29:55 UTC (rev 7026)
+++ plog/branches/lifetype-1.2/js/tinymce/tiny_mce_gzip.php	2010-09-21 23:00:22 UTC (rev 7027)
@@ -1,10 +1,7 @@
 <?php
 /**
- * $RCSfile: tiny_mce_gzip.php,v $
- * $Revision: $
- * $Date: $
+ * $Id: tiny_mce_gzip.php 315 2007-10-25 14:03:43Z spocke $
  *
- * @version 1.08
  * @author Moxiecode
  * @copyright Copyright © 2005-2006, Moxiecode Systems AB, All rights reserved.
  *
@@ -13,256 +10,174 @@
  * Notice: This script defaults the button_tile_map option to true for extra performance.
  */
 
-// General options
-$suffix = "";							// Set to "_src" to use source version
-$expiresOffset = 3600 * 24 * 10;		// 10 days util client cache expires
-$diskCache = false;						// If you enable this option gzip files will be cached on disk.
-$cacheDir = realpath(".");				// Absolute directory path to where cached gz files will be stored
-$debug = false;							// Enable this option if you need debuging info
+	// Set the error reporting to minimal.
+	@error_reporting(E_ERROR | E_WARNING | E_PARSE);
 
-// Headers
-header("Content-type: text/javascript; charset: UTF-8");
-// header("Cache-Control: must-revalidate");
-header("Vary: Accept-Encoding"); // Handle proxies
-header("Expires: " . gmdate("D, d M Y H:i:s", time() + $expiresOffset) . " GMT");
+	// Get input
+	$plugins = explode(',', getParam("plugins", ""));
+	$languages = explode(',', getParam("languages", ""));
+	$themes = explode(',', getParam("themes", ""));
+	$diskCache = getParam("diskcache", "") == "true";
+	$isJS = getParam("js", "") == "true";
+	$compress = getParam("compress", "true") == "true";
+	$core = getParam("core", "true") == "true";
+	$suffix = getParam("suffix", "_src") == "_src" ? "_src" : "";
+	$cachePath = realpath("."); // Cache path, this is where the .gz files will be stored
+	$expiresOffset = 3600 * 24 * 10; // Cache for 10 days in browser cache
+	$content = "";
+	$encodings = array();
+	$supportsGzip = false;
+	$enc = "";
+	$cacheKey = "";
 
-// Get data to load
-$theme = isset($_GET['theme']) ? TinyMCE_cleanInput($_GET['theme']) : "";
-$language = isset($_GET['language']) ? TinyMCE_cleanInput($_GET['language']) : "";
-$plugins = isset($_GET['plugins']) ? TinyMCE_cleanInput($_GET['plugins']) : "";
-$lang = isset($_GET['lang']) ? TinyMCE_cleanInput($_GET['lang']) : "en";
-$index = isset($_GET['index']) ? TinyMCE_cleanInput($_GET['index']) : -1;
-$cacheKey = md5($theme . $language . $plugins . $lang . $index . $debug);
-$cacheFile = $cacheDir == "" ? "" : $cacheDir . "/" . "tinymce_" .  $cacheKey . ".gz";
-$cacheData = "";
+	// Custom extra javascripts to pack
+	$custom = array(/*
+		"some custom .js file",
+		"some custom .js file"
+	*/);
 
-// Patch older versions of PHP < 4.3.0
-if (!function_exists('file_get_contents')) {
-	function file_get_contents($filename) {
-		$fd = fopen($filename, 'rb');
-		$content = fread($fd, filesize($filename));
-		fclose($fd);
-		return $content;
+	// Headers
+	header("Content-type: text/javascript");
+	header("Vary: Accept-Encoding");  // Handle proxies
+	header("Expires: " . gmdate("D, d M Y H:i:s", time() + $expiresOffset) . " GMT");
+
+	// Is called directly then auto init with default settings
+	if (!$isJS) {
+		echo getFileContents("tiny_mce_gzip.js");
+		echo "tinyMCE_GZ.init({});";
+		die();
 	}
-}
 
-// Security check function, can only contain a-z 0-9 , _ - and whitespace.
-function TinyMCE_cleanInput($str) {
-	return preg_replace("/[^0-9a-z\-_,]+/i", "", $str); // Remove anything but 0-9,a-z,-_
-}
+	// Setup cache info
+	if ($diskCache) {
+		if (!$cachePath)
+			die("alert('Real path failed.');");
 
-function TinyMCE_echo($str) {
-	global $cacheData, $diskCache;
+		$cacheKey = getParam("plugins", "") . getParam("languages", "") . getParam("themes", "") . $suffix;
 
-	if ($diskCache)
-		$cacheData .= $str;
-	else
-		echo $str;
-}
+		foreach ($custom as $file)
+			$cacheKey .= $file;
 
-// Only gzip the contents if clients and server support it
-$encodings = array();
+		$cacheKey = md5($cacheKey);
 
-if (isset($_SERVER['HTTP_ACCEPT_ENCODING']))
-	$encodings = explode(',', strtolower(preg_replace("/\s+/", "", $_SERVER['HTTP_ACCEPT_ENCODING'])));
-
-// Check for gzip header or northon internet securities
-if ((in_array('gzip', $encodings) || in_array('x-gzip', $encodings) || isset($_SERVER['---------------'])) && function_exists('ob_gzhandler') && !ini_get('zlib.output_compression')) {
-	$enc = in_array('x-gzip', $encodings) ? "x-gzip" : "gzip";
-
-	// Use cached file if it exists but not in debug mode
-	if (file_exists($cacheFile) && !$debug) {
-		header("Content-Encoding: " . $enc);
-		echo file_get_contents($cacheFile);
-		die;
+		if ($compress)
+			$cacheFile = $cachePath . "/tiny_mce_" . $cacheKey . ".gz";
+		else
+			$cacheFile = $cachePath . "/tiny_mce_" . $cacheKey . ".js";
 	}
 
-	if (!$diskCache)
-		ob_start("ob_gzhandler");
-} else
-	$diskCache = false;
+	// Check if it supports gzip
+	if (isset($_SERVER['HTTP_ACCEPT_ENCODING']))
+		$encodings = explode(',', strtolower(preg_replace("/\s+/", "", $_SERVER['HTTP_ACCEPT_ENCODING'])));
 
-if ($index > -1) {
-	// Write main script and patch some things
-	if ($index == 0) {
-		TinyMCE_echo(file_get_contents(realpath("tiny_mce" . $suffix . ".js")));
-		TinyMCE_echo('TinyMCE.prototype.orgLoadScript = TinyMCE.prototype.loadScript;');
-		TinyMCE_echo('TinyMCE.prototype.loadScript = function() {};var realTinyMCE = tinyMCE;');
-	} else
-		TinyMCE_echo('tinyMCE = realTinyMCE;');
-
-	// Do init based on index
-	TinyMCE_echo("tinyMCE.init(tinyMCECompressed.configs[" . $index . "]);");
-
-	// Load external plugins
-	if ($index == 0)
-		TinyMCE_echo("tinyMCECompressed.loadPlugins();");
-
-	// Load theme, language pack and theme language packs
-	if ($theme) {
-		TinyMCE_echo(file_get_contents(realpath("themes/" . $theme . "/editor_template" . $suffix . ".js")));
-		TinyMCE_echo(file_get_contents(realpath("themes/" . $theme . "/langs/" . $lang . ".js")));
+	if ((in_array('gzip', $encodings) || in_array('x-gzip', $encodings) || isset($_SERVER['---------------'])) && function_exists('ob_gzhandler') && !ini_get('zlib.output_compression')) {
+		$enc = in_array('x-gzip', $encodings) ? "x-gzip" : "gzip";
+		$supportsGzip = true;
 	}
 
-	if ($language)
-		TinyMCE_echo(file_get_contents(realpath("langs/" . $language . ".js")));
+	// Use cached file disk cache
+	if ($diskCache && $supportsGzip && file_exists($cacheFile)) {
+		if ($compress)
+			header("Content-Encoding: " . $enc);
 
-	// Load all plugins and their language packs
-	$plugins = explode(",", $plugins);
-	foreach ($plugins as $plugin) {
-		$pluginFile = realpath("plugins/" . $plugin . "/editor_plugin" . $suffix . ".js");
-		$languageFile = realpath("plugins/" . $plugin . "/langs/" . $lang . ".js");
-
-		if ($pluginFile)
-			TinyMCE_echo(file_get_contents($pluginFile));
-
-		if ($languageFile)
-			TinyMCE_echo(file_get_contents($languageFile));
+		echo getFileContents($cacheFile);
+		die();
 	}
 
-	// Reset tinyMCE compressor engine
-	TinyMCE_echo("tinyMCE = tinyMCECompressed;");
+	// Add core
+	if ($core == "true") {
+		$content .= getFileContents("tiny_mce" . $suffix . ".js");
 
-	// Write to cache
-	if ($diskCache) {
-		// Calculate compression ratio and debug target output path
-		if ($debug) {
-			$ratio = round(100 - strlen(gzencode($cacheData, 9, FORCE_GZIP)) / strlen($cacheData) * 100.0);
-			TinyMCE_echo("alert('TinyMCE was compressed by " . $ratio . "%.\\nOutput cache file: " . $cacheFile . "');");
-		}
-
-		$cacheData = gzencode($cacheData, 9, FORCE_GZIP);
-
-		// Write to file if possible
-		$fp = @fopen($cacheFile, "wb");
-		if ($fp) {
-			fwrite($fp, $cacheData);
-			fclose($fp);
-		}
-
-		// Output
-		header("Content-Encoding: " . $enc);
-		echo $cacheData;
+		// Patch loading functions
+		$content .= "tinyMCE_GZ.start();";
 	}
 
-	die;
-}
-?>
+	// Add core languages
+	foreach ($languages as $lang)
+		$content .= getFileContents("langs/" . $lang . ".js");
 
-function TinyMCECompressed() {
-	this.configs = new Array();
-	this.loadedFiles = new Array();
-	this.externalPlugins = new Array();
-	this.loadAdded = false;
-	this.isLoaded = false;
-}
+	// Add themes
+	foreach ($themes as $theme) {
+		$content .= getFileContents( "themes/" . $theme . "/editor_template" . $suffix . ".js");
 
-TinyMCECompressed.prototype.init = function(settings) {
-	var elements = document.getElementsByTagName('script');
-	var scriptURL = "";
-
-	for (var i=0; i<elements.length; i++) {
-		if (elements[i].src && elements[i].src.indexOf("tiny_mce_gzip.php") != -1) {
-			scriptURL = elements[i].src;
-			break;
-		}
+		foreach ($languages as $lang)
+			$content .= getFileContents("themes/" . $theme . "/langs/" . $lang . ".js");
 	}
 
-	settings["theme"] = typeof(settings["theme"]) != "undefined" ? settings["theme"] : "default";
-	settings["plugins"] = typeof(settings["plugins"]) != "undefined" ? settings["plugins"] : "";
-	settings["language"] = typeof(settings["language"]) != "undefined" ? settings["language"] : "en";
-	settings["button_tile_map"] = typeof(settings["button_tile_map"]) != "undefined" ? settings["button_tile_map"] : true;
-	this.configs[this.configs.length] = settings;
-	this.settings = settings;
+	// Add plugins
+	foreach ($plugins as $plugin) {
+		$content .= getFileContents("plugins/" . $plugin . "/editor_plugin" . $suffix . ".js");
 
-	scriptURL += "?theme=" + escape(this.getOnce(settings["theme"])) + "&language=" + escape(this.getOnce(settings["language"])) + "&plugins=" + escape(this.getOnce(settings["plugins"])) + "&lang=" + settings["language"] + "&index=" + escape(this.configs.length-1);
-	document.write('<sc'+'ript language="javascript" type="text/javascript" src="' + scriptURL + '"></script>');
-
-	if (!this.loadAdded) {
-		tinyMCE.addEvent(window, "DOMContentLoaded", TinyMCECompressed.prototype.onLoad);
-		tinyMCE.addEvent(window, "load", TinyMCECompressed.prototype.onLoad);
-		this.loadAdded = true;
+		foreach ($languages as $lang)
+			$content .= getFileContents("plugins/" . $plugin . "/langs/" . $lang . ".js");
 	}
-}
 
-TinyMCECompressed.prototype.onLoad = function() {
-	if (tinyMCE.isLoaded)
-		return true;
+	// Add custom files
+	foreach ($custom as $file)
+		$content .= getFileContents($file);
 
-	tinyMCE = realTinyMCE;
-	TinyMCE_Engine.prototype.onLoad();
-	tinyMCE._addUnloadEvents();
+	// Restore loading functions
+	if ($core == "true")
+		$content .= "tinyMCE_GZ.end();";
 
-	tinyMCE.isLoaded = true;
-}
+	// Generate GZIP'd content
+	if ($supportsGzip) {
+		if ($compress) {
+			header("Content-Encoding: " . $enc);
+			$cacheData = gzencode($content, 9, FORCE_GZIP);
+		} else
+			$cacheData = $content;
 
-TinyMCECompressed.prototype.addEvent = function(o, n, h) {
-	if (o.attachEvent)
-		o.attachEvent("on" + n, h);
-	else
-		o.addEventListener(n, h, false);
-}
+		// Write gz file
+		if ($diskCache && $cacheKey != "")
+			putFileContents($cacheFile, $cacheData);
 
-TinyMCECompressed.prototype.getOnce = function(str) {
-	var ar = str.replace(/\s+/g, '').split(',');
-
-	for (var i=0; i<ar.length; i++) {
-		if (ar[i] == '' || ar[i].charAt(0) == '-') {
-			ar[i] = null;
-			continue;
-		}
-
-		// Skip load
-		for (var x=0; x<this.loadedFiles.length; x++) {
-			if (this.loadedFiles[x] == ar[i])
-				ar[i] = null;
-		}
-
-		this.loadedFiles[this.loadedFiles.length] = ar[i];
+		// Stream to client
+		echo $cacheData;
+	} else {
+		// Stream uncompressed content
+		echo $content;
 	}
 
-	// Glue
-	str = "";
-	for (var i=0; i<ar.length; i++) {
-		if (ar[i] == null)
-			continue;
+	/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
-		str += ar[i];
+	function getParam($name, $def = false) {
+		if (!isset($_GET[$name]))
+			return $def;
 
-		if (i != ar.length-1)
-			str += ",";
+		return preg_replace("/[^0-9a-z\-_,]+/i", "", $_GET[$name]); // Remove anything but 0-9,a-z,-_
 	}
 
-	return str;
-};
+	function getFileContents($path) {
+		$path = realpath($path);
 
-TinyMCECompressed.prototype.loadPlugins = function() {
-	var i, ar;
+		if (!$path || !@is_file($path))
+			return "";
 
-	TinyMCE.prototype.loadScript = TinyMCE.prototype.orgLoadScript;
-	tinyMCE = realTinyMCE;
+		if (function_exists("file_get_contents"))
+			return @file_get_contents($path);
 
-	ar = tinyMCECompressed.externalPlugins;
-	for (i=0; i<ar.length; i++)
-		tinyMCE.loadPlugin(ar[i].name, ar[i].url);
+		$content = "";
+		$fp = @fopen($path, "r");
+		if (!$fp)
+			return "";
 
-	TinyMCE.prototype.loadScript = function() {};
-};
+		while (!feof($fp))
+			$content .= fgets($fp);
 
-TinyMCECompressed.prototype.loadPlugin = function(n, u) {
-	this.externalPlugins[this.externalPlugins.length] = {name : n, url : u};
-};
+		fclose($fp);
 
-TinyMCECompressed.prototype.importPluginLanguagePack = function(n, v) {
-	tinyMCE = realTinyMCE;
-	TinyMCE.prototype.loadScript = TinyMCE.prototype.orgLoadScript;
-	tinyMCE.importPluginLanguagePack(n, v);
-};
+		return $content;
+	}
 
-TinyMCECompressed.prototype.addPlugin = function(n, p) {
-	tinyMCE = realTinyMCE;
-	tinyMCE.addPlugin(n, p);
-};
+	function putFileContents($path, $content) {
+		if (function_exists("file_put_contents"))
+			return @file_put_contents($path, $content);
 
-var tinyMCE = new TinyMCECompressed();
-var tinyMCECompressed = tinyMCE;
+		$fp = @fopen($path, "wb");
+		if ($fp) {
+			fwrite($fp, $content);
+			fclose($fp);
+		}
+	}
+?>
\ No newline at end of file

Modified: plog/branches/lifetype-1.2/js/tinymce/tiny_mce_popup.js
===================================================================
--- plog/branches/lifetype-1.2/js/tinymce/tiny_mce_popup.js	2010-09-21 21:29:55 UTC (rev 7026)
+++ plog/branches/lifetype-1.2/js/tinymce/tiny_mce_popup.js	2010-09-21 23:00:22 UTC (rev 7027)
@@ -1,294 +1,5 @@
-// Some global instances, this will be filled later
-var tinyMCE = null, tinyMCELang = null;
-
-function TinyMCE_Popup() {
-};
-
-TinyMCE_Popup.prototype = {
-	findWin : function(w) {
-		var c;
-
-		// Check parents
-		c = w;
-		while (c && (c = c.parent) != null) {
-			if (typeof(c.tinyMCE) != "undefined")
-				return c;
-		}
-
-		// Check openers
-		c = w;
-		while (c && (c = c.opener) != null) {
-			if (typeof(c.tinyMCE) != "undefined")
-				return c;
-		}
-
-		// Try top
-		if (typeof(top.tinyMCE) != "undefined")
-			return top;
-
-		return null;
-	},
-
-	init : function() {
-		var win = window.opener ? window.opener : window.dialogArguments, c;
-		var inst, re, title, divElm;
-
-		if (!win)
-			win = this.findWin(window);
-
-		if (!win) {
-			alert("tinyMCE object reference not found from popup.");
-			return;
-		}
-
-		window.opener = win;
-		this.windowOpener = win;
-		this.onLoadEval = "";
-
-		// Setup parent references
-		tinyMCE = win.tinyMCE;
-		tinyMCELang = win.tinyMCELang;
-
-		inst = tinyMCE.selectedInstance;
-		this.isWindow = tinyMCE.getWindowArg('mce_inside_iframe', false) == false;
-		this.storeSelection = (tinyMCE.isRealIE) && !this.isWindow && tinyMCE.getWindowArg('mce_store_selection', true);
-
-		if (this.isWindow)
-			window.focus();
-
-		// Store selection
-		if (this.storeSelection)
-			inst.selectionBookmark = inst.selection.getBookmark(true);
-
-		// Setup dir
-		if (tinyMCELang.lang_dir)
-			document.dir = tinyMCELang.lang_dir;
-
-		// Setup title
-		re = new RegExp('{|\\\$|}', 'g');
-		title = document.title.replace(re, "");
-		if (typeof(tinyMCELang[title]) != "undefined") {
-			divElm = document.createElement("div");
-			divElm.innerHTML = tinyMCELang[title];
-			document.title = divElm.innerHTML;
-
-			if (typeof(tinyMCE.setWindowTitle) != 'undefined')
-				tinyMCE.setWindowTitle(window, divElm.innerHTML);
-		}
-
-		// Output Popup CSS class
-		document.write('<link href="' + tinyMCE.getParam("popups_css") + '" rel="stylesheet" type="text/css">');
-
-		if (tinyMCE.getParam("popups_css_add")) {
-			c = tinyMCE.getParam("popups_css_add");
-
-			// Is relative
-			if (c.indexOf('://') == -1 && c.charAt(0) != '/')
-				c = tinyMCE.documentBasePath + "/" + c;
-
-			document.write('<link href="' + c + '" rel="stylesheet" type="text/css">');
-		}
-
-		tinyMCE.addEvent(window, "load", this.onLoad);
-	},
-
-	onLoad : function() {
-		var dir, i, elms, body = document.body;
-
-		if (tinyMCE.getWindowArg('mce_replacevariables', true))
-			body.innerHTML = tinyMCE.applyTemplate(body.innerHTML, tinyMCE.windowArgs);
-
-		dir = tinyMCE.selectedInstance.settings.directionality;
-		if (dir == "rtl" && document.forms && document.forms.length > 0) {
-			elms = document.forms[0].elements;
-			for (i=0; i<elms.length; i++) {
-				if ((elms[i].type == "text" || elms[i].type == "textarea") && elms[i].getAttribute("dir") != "ltr")
-					elms[i].dir = dir;
-			}
-		}
-
-		if (body.style.display == 'none')
-			body.style.display = 'block';
-
-		// Execute real onload (Opera fix)
-		if (tinyMCEPopup.onLoadEval !== '')
-			eval(tinyMCEPopup.onLoadEval);
-	},
-
-	executeOnLoad : function(str) {
-		if (tinyMCE.isOpera && parseFloat(opera.version()) < 9.5)
-			this.onLoadEval = str;
-		else
-			eval(str);
-	},
-
-	resizeToInnerSize : function() {
-		var i, doc, body, oldMargin, wrapper, iframe, nodes, dx, dy;
-
-		// Netscape 7.1 workaround
-		if (this.isWindow && tinyMCE.isNS71) {
-			window.resizeBy(0, 10);
-			return;
-		}
-
-		if (this.isWindow) {
-			doc = document;
-			body = doc.body;
-
-			if (body.style.display == 'none')
-				body.style.display = 'block';
-
-			// Remove margin
-			oldMargin = body.style.margin;
-			body.style.margin = '0';
-
-			// Create wrapper
-			wrapper = doc.createElement("div");
-			wrapper.id = 'mcBodyWrapper';
-			wrapper.style.display = 'none';
-			wrapper.style.margin = '0';
-
-			// Wrap body elements
-			nodes = doc.body.childNodes;
-			for (i=nodes.length-1; i>=0; i--) {
-				if (wrapper.hasChildNodes())
-					wrapper.insertBefore(nodes[i].cloneNode(true), wrapper.firstChild);
-				else
-					wrapper.appendChild(nodes[i].cloneNode(true));
-
-				nodes[i].parentNode.removeChild(nodes[i]);
-			}
-
-			// Add wrapper
-			doc.body.appendChild(wrapper);
-
-			// Create iframe
-			iframe = document.createElement("iframe");
-			iframe.id = "mcWinIframe";
-			iframe.src = document.location.href.toLowerCase().indexOf('https') == -1 ? "about:blank" : tinyMCE.settings.default_document;
-			iframe.width = "100%";
-			iframe.height = "100%";
-			iframe.style.margin = '0';
-
-			// Add iframe
-			doc.body.appendChild(iframe);
-
-			// Measure iframe
-			iframe = document.getElementById('mcWinIframe');
-			dx = tinyMCE.getWindowArg('mce_width') - iframe.clientWidth;
-			dy = tinyMCE.getWindowArg('mce_height') - iframe.clientHeight;
-
-			// Resize window
-			// tinyMCE.debug(tinyMCE.getWindowArg('mce_width') + "," + tinyMCE.getWindowArg('mce_height') + " - " + dx + "," + dy);
-			window.resizeBy(dx, dy);
-
-			// Hide iframe and show wrapper
-			body.style.margin = oldMargin;
-			iframe.style.display = 'none';
-			wrapper.style.display = 'block';
-		}
-	},
-
-	resizeToContent : function() {
-		var isMSIE = (navigator.appName == "Microsoft Internet Explorer");
-		var isOpera = (navigator.userAgent.indexOf("Opera") != -1);
-		var elm, width, height, x, y, dx, dy;
-
-		if (isOpera)
-			return;
-
-		if (isMSIE) {
-			try { window.resizeTo(10, 10); } catch (e) {}
-
-			elm = document.body;
-			width = elm.offsetWidth;
-			height = elm.offsetHeight;
-			dx = (elm.scrollWidth - width) + 4;
-			dy = elm.scrollHeight - height;
-
-			try { window.resizeBy(dx, dy); } catch (e) {}
-		} else {
-			window.scrollBy(1000, 1000);
-			if (window.scrollX > 0 || window.scrollY > 0) {
-				window.resizeBy(window.innerWidth * 2, window.innerHeight * 2);
-				window.sizeToContent();
-				window.scrollTo(0, 0);
-				x = parseInt(screen.width / 2.0) - (window.outerWidth / 2.0);
-				y = parseInt(screen.height / 2.0) - (window.outerHeight / 2.0);
-				window.moveTo(x, y);
-			}
-		}
-	},
-
-	getWindowArg : function(name, default_value) {
-		return tinyMCE.getWindowArg(name, default_value);
-	},
-
-	restoreSelection : function() {
-		var inst;
-
-		if (this.storeSelection) {
-			inst = tinyMCE.selectedInstance;
-
-			inst.getWin().focus();
-
-			if (inst.selectionBookmark)
-				inst.selection.moveToBookmark(inst.selectionBookmark);
-		}
-	},
-
-	execCommand : function(command, user_interface, value) {
-		var inst = tinyMCE.selectedInstance;
-
-		this.restoreSelection();
-		inst.execCommand(command, user_interface, value);
-
-		// Store selection
-		if (this.storeSelection)
-			inst.selectionBookmark = inst.selection.getBookmark(true);
-	},
-
-	close : function() {
-		tinyMCE.closeWindow(window);
-	},
-
-	pickColor : function(e, element_id) {
-		tinyMCE.selectedInstance.execCommand('mceColorPicker', true, {
-			element_id : element_id,
-			document : document,
-			window : window,
-			store_selection : false
-		});
-	},
-
-	openBrowser : function(element_id, type, option) {
-		var cb = tinyMCE.getParam(option, tinyMCE.getParam("file_browser_callback"));
-		var url = document.getElementById(element_id).value;
-
-		tinyMCE.setWindowArg("window", window);
-		tinyMCE.setWindowArg("document", document);
-
-		// Call to external callback
-		if (eval('typeof(tinyMCEPopup.windowOpener.' + cb + ')') == "undefined")
-			alert("Callback function: " + cb + " could not be found.");
-		else
-			eval("tinyMCEPopup.windowOpener." + cb + "(element_id, url, type, window);");
-	},
-
-	importClass : function(c) {
-		var n;
-
-		window[c] = function() {};
-
-		for (n in window.opener[c].prototype)
-			window[c].prototype[n] = window.opener[c].prototype[n];
-
-		window[c].constructor = window.opener[c].constructor;
-	}
-
-	};
-
-// Setup global instance
-var tinyMCEPopup = new TinyMCE_Popup();
-
-tinyMCEPopup.init();
+
+// 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_foc
 us=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:func
 tion(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=docum
 ent.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);win
 dow.addEventListener("load",tinyMCEPopup._onDOMLoaded,false)}}}};tinyMCEPopup.init();tinyMCEPopup._wait();
\ No newline at end of file

Modified: plog/branches/lifetype-1.2/js/tinymce/tiny_mce_src.js
===================================================================
--- plog/branches/lifetype-1.2/js/tinymce/tiny_mce_src.js	2010-09-21 21:29:55 UTC (rev 7026)
+++ plog/branches/lifetype-1.2/js/tinymce/tiny_mce_src.js	2010-09-21 23:00:22 UTC (rev 7027)
@@ -1,7610 +1,14181 @@
+(function(win) {
+	var whiteSpaceRe = /^\s*|\s*$/g,
+		undefined;
 
-/* file:jscripts/tiny_mce/classes/TinyMCE_Engine.class.js */
+	var tinymce = {
+		majorVersion : '3',
 
-function TinyMCE_Engine() {
-	var ua;
+		minorVersion : '3.9',
 
-	this.majorVersion = "2";
-	this.minorVersion = "1.3";
-	this.releaseDate = "2007-11-27";
+		releaseDate : '2010-09-08',
 
-	this.instances = [];
-	this.switchClassCache = [];
-	this.windowArgs = [];
-	this.loadedFiles = [];
-	this.pendingFiles = [];
-	this.loadingIndex = 0;
-	this.configs = [];
-	this.currentConfig = 0;
-	this.eventHandlers = [];
-	this.log = [];
-	this.undoLevels = [];
-	this.undoIndex = 0;
-	this.typingUndoIndex = -1;
-	this.settings = [];
+		_init : function() {
+			var t = this, d = document, na = navigator, ua = na.userAgent, i, nl, n, base, p, v;
 
-	// Browser check
-	ua = navigator.userAgent;
-	this.isMSIE = (navigator.appName == "Microsoft Internet Explorer");
-	this.isMSIE5 = this.isMSIE && (ua.indexOf('MSIE 5') != -1);
-	this.isMSIE5_0 = this.isMSIE && (ua.indexOf('MSIE 5.0') != -1);
-	this.isMSIE7 = this.isMSIE && (ua.indexOf('MSIE 7') != -1);
-	this.isGecko = ua.indexOf('Gecko') != -1; // Will also be true on Safari
-	this.isSafari = ua.indexOf('Safari') != -1;
-	this.isOpera = window['opera'] && opera.buildNumber ? true : false;
-	this.isMac = ua.indexOf('Mac') != -1;
-	this.isNS7 = ua.indexOf('Netscape/7') != -1;
-	this.isNS71 = ua.indexOf('Netscape/7.1') != -1;
-	this.dialogCounter = 0;
-	this.plugins = [];
-	this.themes = [];
-	this.menus = [];
-	this.loadedPlugins = [];
-	this.buttonMap = [];
-	this.isLoaded = false;
+			t.isOpera = win.opera && opera.buildNumber;
 
-	// Fake MSIE on Opera and if Opera fakes IE, Gecko or Safari cancel those
-	if (this.isOpera) {
-		this.isMSIE = true;
-		this.isGecko = false;
-		this.isSafari =  false;
-	}
+			t.isWebKit = /WebKit/.test(ua);
 
-	this.isIE = this.isMSIE;
-	this.isRealIE = this.isMSIE && !this.isOpera;
+			t.isIE = !t.isWebKit && !t.isOpera && (/MSIE/gi).test(ua) && (/Explorer/gi).test(na.appName);
 
-	// TinyMCE editor id instance counter
-	this.idCounter = 0;
-};
+			t.isIE6 = t.isIE && /MSIE [56]/.test(ua);
 
-TinyMCE_Engine.prototype = {
-	init : function(settings) {
-		var theme, nl, baseHREF = "", i, cssPath, entities, h, p, src, elements = [], head;
+			t.isGecko = !t.isWebKit && /Gecko/.test(ua);
 
-		// IE 5.0x is no longer supported since 5.5, 6.0 and 7.0 now exists. We can't support old browsers forever, sorry.
-		if (this.isMSIE5_0)
-			return;
+			t.isMac = ua.indexOf('Mac') != -1;
 
-		this.settings = settings;
+			t.isAir = /adobeair/i.test(ua);
 
-		// Check if valid browser has execcommand support
-		if (typeof(document.execCommand) == 'undefined')
-			return;
+			t.isIDevice = /(iPad|iPhone)/.test(ua);
 
-		// Get script base path
-		if (!tinyMCE.baseURL) {
-			// Search through head
-			head = document.getElementsByTagName('head')[0];
-
-			if (head) {
-				for (i=0, nl = head.getElementsByTagName('script'); i<nl.length; i++)
-					elements.push(nl[i]);
+			// TinyMCE .NET webcontrol might be setting the values for TinyMCE
+			if (win.tinyMCEPreInit) {
+				t.suffix = tinyMCEPreInit.suffix;
+				t.baseURL = tinyMCEPreInit.base;
+				t.query = tinyMCEPreInit.query;
+				return;
 			}
 
-			// Search through rest of document
-			for (i=0, nl = document.getElementsByTagName('script'); i<nl.length; i++)
-				elements.push(nl[i]);
+			// Get suffix and base
+			t.suffix = '';
 
 			// If base element found, add that infront of baseURL
-			nl = document.getElementsByTagName('base');
+			nl = d.getElementsByTagName('base');
 			for (i=0; i<nl.length; i++) {
-				if (nl[i].href)
-					baseHREF = nl[i].href;
+				if (v = nl[i].href) {
+					// Host only value like http://site.com or http://site.com:8008
+					if (/^https?:\/\/[^\/]+$/.test(v))
+						v += '/';
+
+					base = v ? v.match(/.*\//)[0] : ''; // Get only directory
+				}
 			}
 
-			for (i=0; i<elements.length; i++) {
-				if (elements[i].src && (elements[i].src.indexOf("tiny_mce.js") != -1 || elements[i].src.indexOf("tiny_mce_dev.js") != -1 || elements[i].src.indexOf("tiny_mce_src.js") != -1 || elements[i].src.indexOf("tiny_mce_gzip") != -1)) {
-					src = elements[i].src;
+			function getBase(n) {
+				if (n.src && /tiny_mce(|_gzip|_jquery|_prototype|_full)(_dev|_src)?.js/.test(n.src)) {
+					if (/_(src|dev)\.js/g.test(n.src))
+						t.suffix = '_src';
 
-					tinyMCE.srcMode = (src.indexOf('_src') != -1 || src.indexOf('_dev') != -1) ? '_src' : '';
-					tinyMCE.gzipMode = src.indexOf('_gzip') != -1;
-					src = src.substring(0, src.lastIndexOf('/'));
+					if ((p = n.src.indexOf('?')) != -1)
+						t.query = n.src.substring(p + 1);
 
-					if (settings.exec_mode == "src" || settings.exec_mode == "normal")
-						tinyMCE.srcMode = settings.exec_mode == "src" ? '_src' : '';
+					t.baseURL = n.src.substring(0, n.src.lastIndexOf('/'));
 
-					// Force it absolute if page has a base href
-					if (baseHREF !== '' && src.indexOf('://') == -1)
-						tinyMCE.baseURL = baseHREF + src;
-					else
-						tinyMCE.baseURL = src;
+					// If path to script is relative and a base href was found add that one infront
+					// the src property will always be an absolute one on non IE browsers and IE 8
+					// so this logic will basically only be executed on older IE versions
+					if (base && t.baseURL.indexOf('://') == -1 && t.baseURL.indexOf('/') !== 0)
+						t.baseURL = base + t.baseURL;
 
-					break;
+					return t.baseURL;
 				}
+
+				return null;
+			};
+
+			// Check document
+			nl = d.getElementsByTagName('script');
+			for (i=0; i<nl.length; i++) {
+				if (getBase(nl[i]))
+					return;
 			}
-		}
 
-		// Get document base path
-		this.documentBasePath = document.location.href;
-		if (this.documentBasePath.indexOf('?') != -1)
-			this.documentBasePath = this.documentBasePath.substring(0, this.documentBasePath.indexOf('?'));
-		this.documentURL = this.documentBasePath;
-		this.documentBasePath = this.documentBasePath.substring(0, this.documentBasePath.lastIndexOf('/'));
+			// Check head
+			n = d.getElementsByTagName('head')[0];
+			if (n) {
+				nl = n.getElementsByTagName('script');
+				for (i=0; i<nl.length; i++) {
+					if (getBase(nl[i]))
+						return;
+				}
+			}
 
-		// If not HTTP absolute
-		if (tinyMCE.baseURL.indexOf('://') == -1 && tinyMCE.baseURL.charAt(0) != '/') {
-			// If site absolute
-			tinyMCE.baseURL = this.documentBasePath + "/" + tinyMCE.baseURL;
-		}
+			return;
+		},
 
-		// Set default values on settings
-		this._def("mode", "none");
-		this._def("theme", "advanced");
-		this._def("plugins", "", true);
-		this._def("language", "en");
-		this._def("docs_language", this.settings.language);
-		this._def("elements", "");
-		this._def("textarea_trigger", "mce_editable");
-		this._def("editor_selector", "");
-		this._def("editor_deselector", "mceNoEditor");
-		this._def("valid_elements", "+a[id|style|rel|rev|charset|hreflang|dir|lang|tabindex|accesskey|type|name|href|target|title|class|onfocus|onblur|onclick|ondblclick|onmousedown|onmouseup|onmouseover|onmousemove|onmouseout|onkeypress|onkeydown|onkeyup],-strong/-b[class|style],-em/-i[class|style],-strike[class|style],-u[class|style],#p[id|style|dir|class|align],-ol[class|style],-ul[class|style],-li[class|style],br,img[id|dir|lang|longdesc|usemap|style|class|src|onmouseover|onmouseout|border|alt=|title|hspace|vspace|width|height|align],-sub[style|class],-sup[style|class],-blockquote[dir|style],-table[border=0|cellspacing|cellpadding|width|height|class|align|summary|style|dir|id|lang|bgcolor|background|bordercolor],-tr[id|lang|dir|class|rowspan|width|height|align|valign|style|bgcolor|background|bordercolor],tbody[id|class],thead[id|class],tfoot[id|class],#td[id|lang|dir|class|colspan|rowspan|width|height|align|valign|style|bgcolor|background|bordercolor|scope],-th[id|lang|dir|cla
 ss|colspan|rowspan|width|height|align|valign|style|scope],caption[id|lang|dir|class|style],-div[id|dir|class|align|style],-span[style|class|align],-pre[class|align|style],address[class|align|style],-h1[id|style|dir|class|align],-h2[id|style|dir|class|align],-h3[id|style|dir|class|align],-h4[id|style|dir|class|align],-h5[id|style|dir|class|align],-h6[id|style|dir|class|align],hr[class|style],-font[face|size|style|id|class|dir|color],dd[id|class|title|style|dir|lang],dl[id|class|title|style|dir|lang],dt[id|class|title|style|dir|lang],cite[title|id|class|style|dir|lang],abbr[title|id|class|style|dir|lang],acronym[title|id|class|style|dir|lang],del[title|id|class|style|dir|lang|datetime|cite],ins[title|id|class|style|dir|lang|datetime|cite]");
-		this._def("extended_valid_elements", "");
-		this._def("invalid_elements", "");
-		this._def("encoding", "");
-		this._def("urlconverter_callback", tinyMCE.getParam("urlconvertor_callback", "TinyMCE_Engine.prototype.convertURL"));
-		this._def("save_callback", "");
-		this._def("force_br_newlines", false);
-		this._def("force_p_newlines", true);
-		this._def("add_form_submit_trigger", true);
-		this._def("relative_urls", true);
-		this._def("remove_script_host", true);
-		this._def("focus_alert", true);
-		this._def("document_base_url", this.documentURL);
-		this._def("visual", true);
-		this._def("visual_table_class", "mceVisualAid");
-		this._def("setupcontent_callback", "");
-		this._def("fix_content_duplication", true);
-		this._def("custom_undo_redo", true);
-		this._def("custom_undo_redo_levels", -1);
-		this._def("custom_undo_redo_keyboard_shortcuts", true);
-		this._def("custom_undo_redo_restore_selection", true);
-		this._def("custom_undo_redo_global", false);
-		this._def("verify_html", true);
-		this._def("apply_source_formatting", false);
-		this._def("directionality", "ltr");
-		this._def("cleanup_on_startup", false);
-		this._def("inline_styles", false);
-		this._def("convert_newlines_to_brs", false);
-		this._def("auto_reset_designmode", true);
-		this._def("entities", "39,#39,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,34,quot,38,amp,60,lt,62,gt,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", true);
-		this._def("entity_encoding", "named");
-		this._def("cleanup_callback", "");
-		this._def("add_unload_trigger", true);
-		this._def("ask", false);
-		this._def("nowrap", false);
-		this._def("auto_resize", false);
-		this._def("auto_focus", false);
-		this._def("cleanup", true);
-		this._def("remove_linebreaks", true);
-		this._def("button_tile_map", false);
-		this._def("submit_patch", true);
-		this._def("browsers", "msie,safari,gecko,opera", true);
-		this._def("dialog_type", "window");
-		this._def("accessibility_warnings", true);
-		this._def("accessibility_focus", true);
-		this._def("merge_styles_invalid_parents", "");
-		this._def("force_hex_style_colors", true);
-		this._def("trim_span_elements", true);
-		this._def("convert_fonts_to_spans", false);
-		this._def("doctype", '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">');
-		this._def("font_size_classes", '');
-		this._def("font_size_style_values", 'xx-small,x-small,small,medium,large,x-large,xx-large', true);
-		this._def("event_elements", 'a,img', true);
-		this._def("convert_urls", true);
-		this._def("table_inline_editing", false);
-		this._def("object_resizing", true);
-		this._def("custom_shortcuts", true);
-		this._def("convert_on_click", false);
-		this._def("content_css", '');
-		this._def("fix_list_elements", true);
-		this._def("fix_table_elements", false);
-		this._def("strict_loading_mode", document.contentType == 'application/xhtml+xml');
-		this._def("hidden_tab_class", '');
-		this._def("display_tab_class", '');
-		this._def("gecko_spellcheck", false);
-		this._def("hide_selects_on_submit", true);
-		this._def("forced_root_block", false);
-		this._def("remove_trailing_nbsp", false);
-		this._def("save_on_tinymce_forms", false);
+		is : function(o, t) {
+			if (!t)
+				return o !== undefined;
 
-		// Force strict loading mode to false on non Gecko browsers
-		if (this.isMSIE && !this.isOpera)
-			this.settings.strict_loading_mode = false;
+			if (t == 'array' && (o.hasOwnProperty && o instanceof Array))
+				return true;
 
-		// Browser check IE
-		if (this.isMSIE && this.settings.browsers.indexOf('msie') == -1)
-			return;
+			return typeof(o) == t;
+		},
 
-		// Browser check Gecko
-		if (this.isGecko && this.settings.browsers.indexOf('gecko') == -1)
-			return;
+		each : function(o, cb, s) {
+			var n, l;
 
-		// Browser check Safari
-		if (this.isSafari && this.settings.browsers.indexOf('safari') == -1)
-			return;
+			if (!o)
+				return 0;
 
-		// Browser check Opera
-		if (this.isOpera && this.settings.browsers.indexOf('opera') == -1)
-			return;
+			s = s || o;
 
-		// If not super absolute make it so
-		baseHREF = tinyMCE.settings.document_base_url;
-		h = document.location.href;
-		p = h.indexOf('://');
-		if (p > 0 && document.location.protocol != "file:") {
-			p = h.indexOf('/', p + 3);
-			h = h.substring(0, p);
+			if (o.length !== undefined) {
+				// Indexed arrays, needed for Safari
+				for (n=0, l = o.length; n < l; n++) {
+					if (cb.call(s, o[n], n, o) === false)
+						return 0;
+				}
+			} else {
+				// Hashtables
+				for (n in o) {
+					if (o.hasOwnProperty(n)) {
+						if (cb.call(s, o[n], n, o) === false)
+							return 0;
+					}
+				}
+			}
 
-			if (baseHREF.indexOf('://') == -1)
-				baseHREF = h + baseHREF;
+			return 1;
+		},
 
-			tinyMCE.settings.document_base_url = baseHREF;
-			tinyMCE.settings.document_base_prefix = h;
-		}
 
-		// Trim away query part
-		if (baseHREF.indexOf('?') != -1)
-			baseHREF = baseHREF.substring(0, baseHREF.indexOf('?'));
+		map : function(a, f) {
+			var o = [];
 
-		this.settings.base_href = baseHREF.substring(0, baseHREF.lastIndexOf('/')) + "/";
+			tinymce.each(a, function(v) {
+				o.push(f(v));
+			});
 
-		theme = this.settings.theme;
-		this.inlineStrict = 'A|BR|SPAN|BDO|MAP|OBJECT|IMG|TT|I|B|BIG|SMALL|EM|STRONG|DFN|CODE|Q|SAMP|KBD|VAR|CITE|ABBR|ACRONYM|SUB|SUP|#text|#comment';
-		this.inlineTransitional = 'A|BR|SPAN|BDO|OBJECT|APPLET|IMG|MAP|IFRAME|TT|I|B|U|S|STRIKE|BIG|SMALL|FONT|BASEFONT|EM|STRONG|DFN|CODE|Q|SAMP|KBD|VAR|CITE|ABBR|ACRONYM|SUB|SUP|INPUT|SELECT|TEXTAREA|LABEL|BUTTON|#text|#comment';
-		this.blockElms = 'H[1-6]|P|DIV|ADDRESS|PRE|FORM|TABLE|LI|OL|UL|TD|CAPTION|BLOCKQUOTE|CENTER|DL|DT|DD|DIR|FIELDSET|FORM|NOSCRIPT|NOFRAMES|MENU|ISINDEX|SAMP';
-		this.blockRegExp = new RegExp("^(" + this.blockElms + ")$", "i");
-		this.posKeyCodes = [13,45,36,35,33,34,37,38,39,40];
-		this.uniqueURL = 'javascript:void(091039730);'; // Make unique URL non real URL
-		this.uniqueTag = '<div id="mceTMPElement" style="display: none">TMP</div>';
-		this.callbacks = ['onInit', 'getInfo', 'getEditorTemplate', 'setupContent', 'onChange', 'onPageLoad', 'handleNodeChange', 'initInstance', 'execCommand', 'getControlHTML', 'handleEvent', 'cleanup', 'removeInstance'];
+			return o;
+		},
 
-		// Theme url
-		this.settings.theme_href = tinyMCE.baseURL + "/themes/" + theme;
+		grep : function(a, f) {
+			var o = [];
 
-		if (!tinyMCE.isIE || tinyMCE.isOpera)
-			this.settings.force_br_newlines = false;
+			tinymce.each(a, function(v) {
+				if (!f || f(v))
+					o.push(v);
+			});
 
-		if (tinyMCE.getParam("popups_css", false)) {
-			cssPath = tinyMCE.getParam("popups_css", "");
+			return o;
+		},
 
-			// Is relative
-			if (cssPath.indexOf('://') == -1 && cssPath.charAt(0) != '/')
-				this.settings.popups_css = this.documentBasePath + "/" + cssPath;
-			else
-				this.settings.popups_css = cssPath;
-		} else
-			this.settings.popups_css = tinyMCE.baseURL + "/themes/" + theme + "/css/editor_popup.css";
+		inArray : function(a, v) {
+			var i, l;
 
-		if (tinyMCE.getParam("editor_css", false)) {
-			cssPath = tinyMCE.getParam("editor_css", "");
+			if (a) {
+				for (i = 0, l = a.length; i < l; i++) {
+					if (a[i] === v)
+						return i;
+				}
+			}
 
-			// Is relative
-			if (cssPath.indexOf('://') == -1 && cssPath.charAt(0) != '/')
-				this.settings.editor_css = this.documentBasePath + "/" + cssPath;
-			else
-				this.settings.editor_css = cssPath;
-		} else {
-			if (this.settings.editor_css !== '')
-				this.settings.editor_css = tinyMCE.baseURL + "/themes/" + theme + "/css/editor_ui.css";
-		}
+			return -1;
+		},
 
-		// Only do this once
-		if (this.configs.length == 0) {
-			if (typeof(TinyMCECompressed) == "undefined") {
-				tinyMCE.addEvent(window, "DOMContentLoaded", TinyMCE_Engine.prototype.onLoad);
+		extend : function(o, e) {
+			var i, l, a = arguments;
 
-				if (tinyMCE.isRealIE) {
-					if (document.body)
-						tinyMCE.addEvent(document.body, "readystatechange", TinyMCE_Engine.prototype.onLoad);
-					else
-						tinyMCE.addEvent(document, "readystatechange", TinyMCE_Engine.prototype.onLoad);
+			for (i = 1, l = a.length; i < l; i++) {
+				e = a[i];
+
+				tinymce.each(e, function(v, n) {
+					if (v !== undefined)
+						o[n] = v;
+				});
+			}
+
+			return o;
+		},
+
+
+		trim : function(s) {
+			return (s ? '' + s : '').replace(whiteSpaceRe, '');
+		},
+
+		create : function(s, p) {
+			var t = this, sp, ns, cn, scn, c, de = 0;
+
+			// Parse : <prefix> <class>:<super class>
+			s = /^((static) )?([\w.]+)(:([\w.]+))?/.exec(s);
+			cn = s[3].match(/(^|\.)(\w+)$/i)[2]; // Class name
+
+			// Create namespace for new class
+			ns = t.createNS(s[3].replace(/\.\w+$/, ''));
+
+			// Class already exists
+			if (ns[cn])
+				return;
+
+			// Make pure static class
+			if (s[2] == 'static') {
+				ns[cn] = p;
+
+				if (this.onCreate)
+					this.onCreate(s[2], s[3], ns[cn]);
+
+				return;
+			}
+
+			// Create default constructor
+			if (!p[cn]) {
+				p[cn] = function() {};
+				de = 1;
+			}
+
+			// Add constructor and methods
+			ns[cn] = p[cn];
+			t.extend(ns[cn].prototype, p);
+
+			// Extend
+			if (s[5]) {
+				sp = t.resolve(s[5]).prototype;
+				scn = s[5].match(/\.(\w+)$/i)[1]; // Class name
+
+				// Extend constructor
+				c = ns[cn];
+				if (de) {
+					// Add passthrough constructor
+					ns[cn] = function() {
+						return sp[scn].apply(this, arguments);
+					};
+				} else {
+					// Add inherit constructor
+					ns[cn] = function() {
+						this.parent = sp[scn];
+						return c.apply(this, arguments);
+					};
 				}
+				ns[cn].prototype[cn] = ns[cn];
 
-				tinyMCE.addEvent(window, "load", TinyMCE_Engine.prototype.onLoad);
-				tinyMCE._addUnloadEvents();
+				// Add super methods
+				t.each(sp, function(f, n) {
+					ns[cn].prototype[n] = sp[n];
+				});
+
+				// Add overridden methods
+				t.each(p, function(f, n) {
+					// Extend methods if needed
+					if (sp[n]) {
+						ns[cn].prototype[n] = function() {
+							this.parent = sp[n];
+							return f.apply(this, arguments);
+						};
+					} else {
+						if (n != cn)
+							ns[cn].prototype[n] = f;
+					}
+				});
 			}
-		}
 
-		this.loadScript(tinyMCE.baseURL + '/themes/' + this.settings.theme + '/editor_template' + tinyMCE.srcMode + '.js');
-		this.loadScript(tinyMCE.baseURL + '/langs/' + this.settings.language +  '.js');
-		this.loadCSS(this.settings.editor_css);
+			// Add static methods
+			t.each(p['static'], function(f, n) {
+				ns[cn][n] = f;
+			});
 
-		// Add plugins
-		p = tinyMCE.getParam('plugins', '', true, ',');
-		if (p.length > 0) {
-			for (i=0; i<p.length; i++) {
-				if (p[i].charAt(0) != '-')
-					this.loadScript(tinyMCE.baseURL + '/plugins/' + p[i] + '/editor_plugin' + tinyMCE.srcMode + '.js');
+			if (this.onCreate)
+				this.onCreate(s[2], s[3], ns[cn].prototype);
+		},
+
+		walk : function(o, f, n, s) {
+			s = s || this;
+
+			if (o) {
+				if (n)
+					o = o[n];
+
+				tinymce.each(o, function(o, i) {
+					if (f.call(s, o, i, n) === false)
+						return false;
+
+					tinymce.walk(o, f, n, s);
+				});
 			}
-		}
+		},
 
-		// Setup entities
-		if (tinyMCE.getParam('entity_encoding') == 'named') {
-			settings.cleanup_entities = [];
-			entities = tinyMCE.getParam('entities', '', true, ',');
-			for (i=0; i<entities.length; i+=2)
-				settings.cleanup_entities['c' + entities[i]] = entities[i+1];
-		}
+		createNS : function(n, o) {
+			var i, v;
 
-		// Save away this config
-		settings.index = this.configs.length;
-		this.configs[this.configs.length] = settings;
+			o = o || win;
 
-		// Start loading first one in chain
-		this.loadNextScript();
+			n = n.split('.');
+			for (i=0; i<n.length; i++) {
+				v = n[i];
 
-		// Force flicker free CSS backgrounds in IE
-		if (this.isIE && !this.isOpera) {
-			try {
-				document.execCommand('BackgroundImageCache', false, true);
-			} catch (e) {
-				// Ignore
+				if (!o[v])
+					o[v] = {};
+
+				o = o[v];
 			}
-		}
 
-		// Setup XML encoding regexps
-		this.xmlEncodeRe = new RegExp('[<>&"]', 'g');
-	},
+			return o;
+		},
 
-	_addUnloadEvents : function() {
-		var st = tinyMCE.settings.add_unload_trigger;
+		resolve : function(n, o) {
+			var i, l;
 
-		if (tinyMCE.isIE) {
-			if (st) {
-				tinyMCE.addEvent(window, "unload", TinyMCE_Engine.prototype.unloadHandler);
-				tinyMCE.addEvent(window.document, "beforeunload", TinyMCE_Engine.prototype.unloadHandler);
+			o = o || win;
+
+			n = n.split('.');
+			for (i = 0, l = n.length; i < l; i++) {
+				o = o[n[i]];
+
+				if (!o)
+					break;
 			}
-		} else {
-			if (st)
-				tinyMCE.addEvent(window, "unload", function () {tinyMCE.triggerSave(true, true);});
-		}
-	},
 
-	_def : function(key, def_val, t) {
-		var v = tinyMCE.getParam(key, def_val);
+			return o;
+		},
 
-		v = t ? v.replace(/\s+/g, "") : v;
+		addUnload : function(f, s) {
+			var t = this;
 
-		this.settings[key] = v;
-	},
+			f = {func : f, scope : s || this};
 
-	hasPlugin : function(n) {
-		return typeof(this.plugins[n]) != "undefined" && this.plugins[n] != null;
-	},
+			if (!t.unloads) {
+				function unload() {
+					var li = t.unloads, o, n;
 
-	addPlugin : function(n, p) {
-		var op = this.plugins[n];
+					if (li) {
+						// Call unload handlers
+						for (n in li) {
+							o = li[n];
 
-		// Use the previous plugin object base URL used when loading external plugins
-		p.baseURL = op ? op.baseURL : tinyMCE.baseURL + "/plugins/" + n;
-		this.plugins[n] = p;
+							if (o && o.func)
+								o.func.call(o.scope, 1); // Send in one arg to distinct unload and user destroy
+						}
 
-		this.loadNextScript();
-	},
+						// Detach unload function
+						if (win.detachEvent) {
+							win.detachEvent('onbeforeunload', fakeUnload);
+							win.detachEvent('onunload', unload);
+						} else if (win.removeEventListener)
+							win.removeEventListener('unload', unload, false);
 
-	setPluginBaseURL : function(n, u) {
-		var op = this.plugins[n];
+						// Destroy references
+						t.unloads = o = li = w = unload = 0;
 
-		if (op)
-			op.baseURL = u;
-		else
-			this.plugins[n] = {baseURL : u};
-	},
+						// Run garbarge collector on IE
+						if (win.CollectGarbage)
+							CollectGarbage();
+					}
+				};
 
-	loadPlugin : function(n, u) {
-		u = u.indexOf('.js') != -1 ? u.substring(0, u.lastIndexOf('/')) : u;
-		u = u.charAt(u.length-1) == '/' ? u.substring(0, u.length-1) : u;
-		this.plugins[n] = {baseURL : u};
-		this.loadScript(u + "/editor_plugin" + (tinyMCE.srcMode ? '_src' : '') + ".js");
-	},
+				function fakeUnload() {
+					var d = document;
 
-	hasTheme : function(n) {
-		return typeof(this.themes[n]) != "undefined" && this.themes[n] != null;
+					// Is there things still loading, then do some magic
+					if (d.readyState == 'interactive') {
+						function stop() {
+							// Prevent memory leak
+							d.detachEvent('onstop', stop);
+
+							// Call unload handler
+							if (unload)
+								unload();
+
+							d = 0;
+						};
+
+						// Fire unload when the currently loading page is stopped
+						if (d)
+							d.attachEvent('onstop', stop);
+
+						// Remove onstop listener after a while to prevent the unload function
+						// to execute if the user presses cancel in an onbeforeunload
+						// confirm dialog and then presses the browser stop button
+						win.setTimeout(function() {
+							if (d)
+								d.detachEvent('onstop', stop);
+						}, 0);
+					}
+				};
+
+				// Attach unload handler
+				if (win.attachEvent) {
+					win.attachEvent('onunload', unload);
+					win.attachEvent('onbeforeunload', fakeUnload);
+				} else if (win.addEventListener)
+					win.addEventListener('unload', unload, false);
+
+				// Setup initial unload handler array
+				t.unloads = [f];
+			} else
+				t.unloads.push(f);
+
+			return f;
+		},
+
+		removeUnload : function(f) {
+			var u = this.unloads, r = null;
+
+			tinymce.each(u, function(o, i) {
+				if (o && o.func == f) {
+					u.splice(i, 1);
+					r = f;
+					return false;
+				}
+			});
+
+			return r;
+		},
+
+		explode : function(s, d) {
+			return s ? tinymce.map(s.split(d || ','), tinymce.trim) : s;
+		},
+
+		_addVer : function(u) {
+			var v;
+
+			if (!this.query)
+				return u;
+
+			v = (u.indexOf('?') == -1 ? '?' : '&') + this.query;
+
+			if (u.indexOf('#') == -1)
+				return u + v;
+
+			return u.replace('#', v + '#');
+		}
+
+		};
+
+	// Initialize the API
+	tinymce._init();
+
+	// Expose tinymce namespace to the global namespace (window)
+	win.tinymce = win.tinyMCE = tinymce;
+})(window);
+
+
+tinymce.create('tinymce.util.Dispatcher', {
+	scope : null,
+	listeners : null,
+
+	Dispatcher : function(s) {
+		this.scope = s || this;
+		this.listeners = [];
 	},
 
-	addTheme : function(n, t) {
-		this.themes[n] = t;
+	add : function(cb, s) {
+		this.listeners.push({cb : cb, scope : s || this.scope});
 
-		this.loadNextScript();
+		return cb;
 	},
 
-	addMenu : function(n, m) {
-		this.menus[n] = m;
+	addToTop : function(cb, s) {
+		this.listeners.unshift({cb : cb, scope : s || this.scope});
+
+		return cb;
 	},
 
-	hasMenu : function(n) {
-		return typeof(this.plugins[n]) != "undefined" && this.plugins[n] != null;
+	remove : function(cb) {
+		var l = this.listeners, o = null;
+
+		tinymce.each(l, function(c, i) {
+			if (cb == c.cb) {
+				o = cb;
+				l.splice(i, 1);
+				return false;
+			}
+		});
+
+		return o;
 	},
 
-	loadScript : function(url) {
-		var i;
+	dispatch : function() {
+		var s, a = arguments, i, li = this.listeners, c;
 
-		for (i=0; i<this.loadedFiles.length; i++) {
-			if (this.loadedFiles[i] == url)
-				return;
+		// Needs to be a real loop since the listener count might change while looping
+		// And this is also more efficient
+		for (i = 0; i<li.length; i++) {
+			c = li[i];
+			s = c.cb.apply(c.scope, a);
+
+			if (s === false)
+				break;
 		}
 
-		if (tinyMCE.settings.strict_loading_mode)
-			this.pendingFiles[this.pendingFiles.length] = url;
-		else
-			document.write('<sc'+'ript language="javascript" type="text/javascript" src="' + url + '"></script>');
+		return s;
+	}
 
-		this.loadedFiles[this.loadedFiles.length] = url;
-	},
+	});
 
-	loadNextScript : function() {
-		var d = document, se;
+(function() {
+	var each = tinymce.each;
 
-		if (!tinyMCE.settings.strict_loading_mode)
-			return;
+	tinymce.create('tinymce.util.URI', {
+		URI : function(u, s) {
+			var t = this, o, a, b;
 
-		if (this.loadingIndex < this.pendingFiles.length) {
-			se = d.createElementNS('http://www.w3.org/1999/xhtml', 'script');
-			se.setAttribute('language', 'javascript');
-			se.setAttribute('type', 'text/javascript');
-			se.setAttribute('src', this.pendingFiles[this.loadingIndex++]);
+			// Trim whitespace
+			u = tinymce.trim(u);
 
-			d.getElementsByTagName("head")[0].appendChild(se);
-		} else
-			this.loadingIndex = -1; // Done with loading
-	},
+			// Default settings
+			s = t.settings = s || {};
 
-	loadCSS : function(url) {
-		var ar = url.replace(/\s+/, '').split(',');
-		var lflen = 0, csslen = 0, skip = false;
-		var x = 0, i = 0, nl, le;
+			// Strange app protocol or local anchor
+			if (/^(mailto|tel|news|javascript|about|data):/i.test(u) || /^\s*#/.test(u)) {
+				t.source = u;
+				return;
+			}
 
-		for (x = 0,csslen = ar.length; x<csslen; x++) {
-			if (ar[x] != null && ar[x] != 'null' && ar[x].length > 0) {
-				/* Make sure it doesn't exist. */
-				for (i=0, lflen=this.loadedFiles.length; i<lflen; i++) {
-					if (this.loadedFiles[i] == ar[x]) {
-						skip = true;
+			// Absolute path with no host, fake host and protocol
+			if (u.indexOf('/') === 0 && u.indexOf('//') !== 0)
+				u = (s.base_uri ? s.base_uri.protocol || 'http' : 'http') + '://mce_host' + u;
+
+			// Relative path http:// or protocol relative //path
+			if (!/^\w*:?\/\//.test(u))
+				u = (s.base_uri.protocol || 'http') + '://mce_host' + t.toAbsPath(s.base_uri.path, u);
+
+			// Parse URL (Credits goes to Steave, http://blog.stevenlevithan.com/archives/parseuri)
+			u = u.replace(/@@/g, '(mce_at)'); // Zope 3 workaround, they use @@something
+			u = /^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/.exec(u);
+			each(["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"], function(v, i) {
+				var s = u[i];
+
+				// Zope 3 workaround, they use @@something
+				if (s)
+					s = s.replace(/\(mce_at\)/g, '@@');
+
+				t[v] = s;
+			});
+
+			if (b = s.base_uri) {
+				if (!t.protocol)
+					t.protocol = b.protocol;
+
+				if (!t.userInfo)
+					t.userInfo = b.userInfo;
+
+				if (!t.port && t.host == 'mce_host')
+					t.port = b.port;
+
+				if (!t.host || t.host == 'mce_host')
+					t.host = b.host;
+
+				t.source = '';
+			}
+
+			//t.path = t.path || '/';
+		},
+
+		setPath : function(p) {
+			var t = this;
+
+			p = /^(.*?)\/?(\w+)?$/.exec(p);
+
+			// Update path parts
+			t.path = p[0];
+			t.directory = p[1];
+			t.file = p[2];
+
+			// Rebuild source
+			t.source = '';
+			t.getURI();
+		},
+
+		toRelative : function(u) {
+			var t = this, o;
+
+			if (u === "./")
+				return u;
+
+			u = new tinymce.util.URI(u, {base_uri : t});
+
+			// Not on same domain/port or protocol
+			if ((u.host != 'mce_host' && t.host != u.host && u.host) || t.port != u.port || t.protocol != u.protocol)
+				return u.getURI();
+
+			o = t.toRelPath(t.path, u.path);
+
+			// Add query
+			if (u.query)
+				o += '?' + u.query;
+
+			// Add anchor
+			if (u.anchor)
+				o += '#' + u.anchor;
+
+			return o;
+		},
+	
+		toAbsolute : function(u, nh) {
+			var u = new tinymce.util.URI(u, {base_uri : this});
+
+			return u.getURI(this.host == u.host && this.protocol == u.protocol ? nh : 0);
+		},
+
+		toRelPath : function(base, path) {
+			var items, bp = 0, out = '', i, l;
+
+			// Split the paths
+			base = base.substring(0, base.lastIndexOf('/'));
+			base = base.split('/');
+			items = path.split('/');
+
+			if (base.length >= items.length) {
+				for (i = 0, l = base.length; i < l; i++) {
+					if (i >= items.length || base[i] != items[i]) {
+						bp = i + 1;
 						break;
 					}
 				}
+			}
 
-				if (!skip) {
-					if (tinyMCE.settings.strict_loading_mode) {
-						nl = document.getElementsByTagName("head");
+			if (base.length < items.length) {
+				for (i = 0, l = items.length; i < l; i++) {
+					if (i >= base.length || base[i] != items[i]) {
+						bp = i + 1;
+						break;
+					}
+				}
+			}
 
-						le = document.createElement('link');
-						le.setAttribute('href', ar[x]);
-						le.setAttribute('rel', 'stylesheet');
-						le.setAttribute('type', 'text/css');
+			if (bp == 1)
+				return path;
 
-						nl[0].appendChild(le);			
-					} else
-						document.write('<link href="' + ar[x] + '" rel="stylesheet" type="text/css" />');
+			for (i = 0, l = base.length - (bp - 1); i < l; i++)
+				out += "../";
 
-					this.loadedFiles[this.loadedFiles.length] = ar[x];
-				}
+			for (i = bp - 1, l = items.length; i < l; i++) {
+				if (i != bp - 1)
+					out += "/" + items[i];
+				else
+					out += items[i];
 			}
-		}
-	},
 
-	importCSS : function(doc, css) {
-		var css_ary = css.replace(/\s+/, '').split(',');
-		var csslen, elm, headArr, x, css_file;
+			return out;
+		},
 
-		for (x = 0, csslen = css_ary.length; x<csslen; x++) {
-			css_file = css_ary[x];
+		toAbsPath : function(base, path) {
+			var i, nb = 0, o = [], tr, outPath;
 
-			if (css_file != null && css_file != 'null' && css_file.length > 0) {
-				// Is relative, make absolute
-				if (css_file.indexOf('://') == -1 && css_file.charAt(0) != '/')
-					css_file = this.documentBasePath + "/" + css_file;
+			// Split paths
+			tr = /\/$/.test(path) ? '/' : '';
+			base = base.split('/');
+			path = path.split('/');
 
-				if (typeof(doc.createStyleSheet) == "undefined") {
-					elm = doc.createElement("link");
+			// Remove empty chunks
+			each(base, function(k) {
+				if (k)
+					o.push(k);
+			});
 
-					elm.rel = "stylesheet";
-					elm.href = css_file;
+			base = o;
 
-					if ((headArr = doc.getElementsByTagName("head")) != null && headArr.length > 0)
-						headArr[0].appendChild(elm);
-				} else
-					doc.createStyleSheet(css_file);
+			// Merge relURLParts chunks
+			for (i = path.length - 1, o = []; i >= 0; i--) {
+				// Ignore empty or .
+				if (path[i].length == 0 || path[i] == ".")
+					continue;
+
+				// Is parent
+				if (path[i] == '..') {
+					nb++;
+					continue;
+				}
+
+				// Move up
+				if (nb > 0) {
+					nb--;
+					continue;
+				}
+
+				o.push(path[i]);
 			}
-		}
-	},
 
-	confirmAdd : function(e, settings) {
-		var elm = tinyMCE.isIE ? event.srcElement : e.target;
-		var elementId = elm.name ? elm.name : elm.id;
+			i = base.length - nb;
 
-		tinyMCE.settings = settings;
+			// If /a/b/c or /
+			if (i <= 0)
+				outPath = o.reverse().join('/');
+			else
+				outPath = base.slice(0, i).join('/') + '/' + o.reverse().join('/');
 
-		if (tinyMCE.settings.convert_on_click || (!elm.getAttribute('mce_noask') && confirm(tinyMCELang.lang_edit_confirm)))
-			tinyMCE.addMCEControl(elm, elementId);
+			// Add front / if it's needed
+			if (outPath.indexOf('/') !== 0)
+				outPath = '/' + outPath;
 
-		elm.setAttribute('mce_noask', 'true');
-	},
+			// Add traling / if it's needed
+			if (tr && outPath.lastIndexOf('/') !== outPath.length - 1)
+				outPath += tr;
 
-	updateContent : function(form_element_name) {
-		var formElement, n, inst, doc;
+			return outPath;
+		},
 
-		// Find MCE instance linked to given form element and copy it's value
-		formElement = document.getElementById(form_element_name);
-		for (n in tinyMCE.instances) {
-			inst = tinyMCE.instances[n];
+		getURI : function(nh) {
+			var s, t = this;
 
-			if (!tinyMCE.isInstance(inst))
-				continue;
+			// Rebuild source
+			if (!t.source || nh) {
+				s = '';
 
-			inst.switchSettings();
+				if (!nh) {
+					if (t.protocol)
+						s += t.protocol + '://';
 
-			if (inst.formElement == formElement) {
-				doc = inst.getDoc();
+					if (t.userInfo)
+						s += t.userInfo + '@';
 
-				tinyMCE._setHTML(doc, inst.formElement.value);
+					if (t.host)
+						s += t.host;
 
-				if (!tinyMCE.isIE)
-					doc.body.innerHTML = tinyMCE._cleanupHTML(inst, doc, this.settings, doc.body, inst.visualAid);
+					if (t.port)
+						s += ':' + t.port;
+				}
+
+				if (t.path)
+					s += t.path;
+
+				if (t.query)
+					s += '?' + t.query;
+
+				if (t.anchor)
+					s += '#' + t.anchor;
+
+				t.source = s;
 			}
+
+			return t.source;
 		}
-	},
+	});
+})();
 
-	addMCEControl : function(replace_element, form_element_name, target_document) {
-		var id = "mce_editor_" + tinyMCE.idCounter++;
-		var inst = new TinyMCE_Control(tinyMCE.settings);
+(function() {
+	var each = tinymce.each;
 
-		inst.editorId = id;
-		this.instances[id] = inst;
+	tinymce.create('static tinymce.util.Cookie', {
+		getHash : function(n) {
+			var v = this.get(n), h;
 
-		inst._onAdd(replace_element, form_element_name, target_document);
-	},
+			if (v) {
+				each(v.split('&'), function(v) {
+					v = v.split('=');
+					h = h || {};
+					h[unescape(v[0])] = unescape(v[1]);
+				});
+			}
 
-	removeInstance : function(ti) {
-		var t = [], n, i;
+			return h;
+		},
 
-		// Remove from instances
-		for (n in tinyMCE.instances) {
-			i = tinyMCE.instances[n];
+		setHash : function(n, v, e, p, d, s) {
+			var o = '';
 
-			if (tinyMCE.isInstance(i) && ti != i)
-					t[n] = i;
-		}
+			each(v, function(v, k) {
+				o += (!o ? '' : '&') + escape(k) + '=' + escape(v);
+			});
 
-		tinyMCE.instances = t;
+			this.set(n, o, e, p, d, s);
+		},
 
-		// Remove from global undo/redo
-		n = [];
-		t = tinyMCE.undoLevels;
+		get : function(n) {
+			var c = document.cookie, e, p = n + "=", b;
 
-		for (i=0; i<t.length; i++) {
-			if (t[i] != ti)
-				n.push(t[i]);
+			// Strict mode
+			if (!c)
+				return;
+
+			b = c.indexOf("; " + p);
+
+			if (b == -1) {
+				b = c.indexOf(p);
+
+				if (b != 0)
+					return null;
+			} else
+				b += 2;
+
+			e = c.indexOf(";", b);
+
+			if (e == -1)
+				e = c.length;
+
+			return unescape(c.substring(b + p.length, e));
+		},
+
+		set : function(n, v, e, p, d, s) {
+			document.cookie = n + "=" + escape(v) +
+				((e) ? "; expires=" + e.toGMTString() : "") +
+				((p) ? "; path=" + escape(p) : "") +
+				((d) ? "; domain=" + d : "") +
+				((s) ? "; secure" : "");
+		},
+
+		remove : function(n, p) {
+			var d = new Date();
+
+			d.setTime(d.getTime() - 1000);
+
+			this.set(n, '', d, p, d);
 		}
+	});
+})();
 
-		tinyMCE.undoLevels = n;
-		tinyMCE.undoIndex = n.length;
+tinymce.create('static tinymce.util.JSON', {
+	serialize : function(o) {
+		var i, v, s = tinymce.util.JSON.serialize, t;
 
-		// Dispatch remove instance call
-		tinyMCE.dispatchCallback(ti, 'remove_instance_callback', 'removeInstance', ti);
+		if (o == null)
+			return 'null';
 
-		return ti;
-	},
+		t = typeof o;
 
-	removeMCEControl : function(editor_id) {
-		var inst = tinyMCE.getInstanceById(editor_id), h, re, ot, tn, n;
+		if (t == 'string') {
+			v = '\bb\tt\nn\ff\rr\""\'\'\\\\';
 
-		if (inst) {
-			inst.switchSettings();
+			return '"' + o.replace(/([\u0080-\uFFFF\x00-\x1f\"])/g, function(a, b) {
+				i = v.indexOf(b);
 
-			editor_id = inst.editorId;
-			h = tinyMCE.getContent(editor_id);
+				if (i + 1)
+					return '\\' + v.charAt(i + 1);
 
-			this.removeInstance(inst);
+				a = b.charCodeAt().toString(16);
 
-			tinyMCE.selectedElement = null;
-			tinyMCE.selectedInstance = null;
+				return '\\u' + '0000'.substring(a.length) + a;
+			}) + '"';
+		}
 
-			tinyMCE.selectedElement = null;
-			tinyMCE.selectedInstance = null;
+		if (t == 'object') {
+			if (o.hasOwnProperty && o instanceof Array) {
+					for (i=0, v = '['; i<o.length; i++)
+						v += (i > 0 ? ',' : '') + s(o[i]);
 
-			// Try finding an instance
-			for (n in tinyMCE.instances) {
-				if (!tinyMCE.isInstance(tinyMCE.instances[n]))
-					continue;
+					return v + ']';
+				}
 
-				tinyMCE.selectedInstance = tinyMCE.instances[n];
-				break;
-			}
+				v = '{';
 
-			// Remove element
-			re = document.getElementById(editor_id + "_parent");
-			ot = inst.oldTargetElement;
-			tn = ot.nodeName.toLowerCase();
+				for (i in o)
+					v += typeof o[i] != 'function' ? (v.length > 1 ? ',"' : '"') + i + '":' + s(o[i]) : '';
 
-			if (tn == "textarea" || tn == "input") {
-				re.parentNode.removeChild(re);
-				ot.style.display = "inline";
-				ot.value = h;
-			} else {
-				ot.innerHTML = h;
-				ot.style.display = 'block';
-				re.parentNode.insertBefore(ot, re);
-				re.parentNode.removeChild(re);
-			}
+				return v + '}';
 		}
+
+		return '' + o;
 	},
 
-	triggerSave : function(skip_cleanup, skip_callback) {
-		var inst, n;
+	parse : function(s) {
+		try {
+			return eval('(' + s + ')');
+		} catch (ex) {
+			// Ignore
+		}
+	}
 
-		// Default to false
-		if (typeof(skip_cleanup) == "undefined")
-			skip_cleanup = false;
+	});
 
-		// Default to false
-		if (typeof(skip_callback) == "undefined")
-			skip_callback = false;
+tinymce.create('static tinymce.util.XHR', {
+	send : function(o) {
+		var x, t, w = window, c = 0;
 
-		// Cleanup and set all form fields
-		for (n in tinyMCE.instances) {
-			inst = tinyMCE.instances[n];
+		// Default settings
+		o.scope = o.scope || this;
+		o.success_scope = o.success_scope || o.scope;
+		o.error_scope = o.error_scope || o.scope;
+		o.async = o.async === false ? false : true;
+		o.data = o.data || '';
 
-			if (!tinyMCE.isInstance(inst))
-				continue;
+		function get(s) {
+			x = 0;
 
-			inst.triggerSave(skip_cleanup, skip_callback);
+			try {
+				x = new ActiveXObject(s);
+			} catch (ex) {
+			}
+
+			return x;
+		};
+
+		x = w.XMLHttpRequest ? new XMLHttpRequest() : get('Microsoft.XMLHTTP') || get('Msxml2.XMLHTTP');
+
+		if (x) {
+			if (x.overrideMimeType)
+				x.overrideMimeType(o.content_type);
+
+			x.open(o.type || (o.data ? 'POST' : 'GET'), o.url, o.async);
+
+			if (o.content_type)
+				x.setRequestHeader('Content-Type', o.content_type);
+
+			x.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
+
+			x.send(o.data);
+
+			function ready() {
+				if (!o.async || x.readyState == 4 || c++ > 10000) {
+					if (o.success && c < 10000 && x.status == 200)
+						o.success.call(o.success_scope, '' + x.responseText, x, o);
+					else if (o.error)
+						o.error.call(o.error_scope, c > 10000 ? 'TIMED_OUT' : 'GENERAL', x, o);
+
+					x = null;
+				} else
+					w.setTimeout(ready, 10);
+			};
+
+			// Syncronous request
+			if (!o.async)
+				return ready();
+
+			// Wait for response, onReadyStateChange can not be used since it leaks memory in IE
+			t = w.setTimeout(ready, 10);
 		}
-	},
+	}
+});
 
-	resetForm : function(form_index) {
-		var i, inst, n, formObj = document.forms[form_index];
+(function() {
+	var extend = tinymce.extend, JSON = tinymce.util.JSON, XHR = tinymce.util.XHR;
 
-		for (n in tinyMCE.instances) {
-			inst = tinyMCE.instances[n];
+	tinymce.create('tinymce.util.JSONRequest', {
+		JSONRequest : function(s) {
+			this.settings = extend({
+			}, s);
+			this.count = 0;
+		},
 
-			if (!tinyMCE.isInstance(inst))
-				continue;
+		send : function(o) {
+			var ecb = o.error, scb = o.success;
 
-			inst.switchSettings();
+			o = extend(this.settings, o);
 
-			for (i=0; i<formObj.elements.length; i++) {
-				if (inst.formTargetElementId == formObj.elements[i].name)
-					inst.getBody().innerHTML = inst.startContent;
+			o.success = function(c, x) {
+				c = JSON.parse(c);
+
+				if (typeof(c) == 'undefined') {
+					c = {
+						error : 'JSON Parse error.'
+					};
+				}
+
+				if (c.error)
+					ecb.call(o.error_scope || o.scope, c.error, x);
+				else
+					scb.call(o.success_scope || o.scope, c.result);
+			};
+
+			o.error = function(ty, x) {
+				ecb.call(o.error_scope || o.scope, ty, x);
+			};
+
+			o.data = JSON.serialize({
+				id : o.id || 'c' + (this.count++),
+				method : o.method,
+				params : o.params
+			});
+
+			// JSON content type for Ruby on rails. Bug: #1883287
+			o.content_type = 'application/json';
+
+			XHR.send(o);
+		},
+
+		'static' : {
+			sendRPC : function(o) {
+				return new tinymce.util.JSONRequest().send(o);
 			}
 		}
-	},
+	});
+}());
+(function(tinymce) {
+	// Shorten names
+	var each = tinymce.each,
+		is = tinymce.is,
+		isWebKit = tinymce.isWebKit,
+		isIE = tinymce.isIE,
+		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)$/,
+		boolAttrs = makeMap('checked,compact,declare,defer,disabled,ismap,multiple,nohref,noresize,noshade,nowrap,readonly,selected'),
+		mceAttribs = makeMap('src,href,style,coords,shape'),
+		encodedChars = {'&' : '&amp;', '"' : '&quot;', '<' : '&lt;', '>' : '&gt;'},
+		encodeCharsRe = /[<>&\"]/g,
+		simpleSelectorRe = /^([a-z0-9],?)+$/i,
+		tagRegExp = /<(\w+)((?:\s+\w+(?:\s*=\s*(?:(?:"[^"]*")|(?:'[^']*')|[^>\s]+))?)*)(\s*\/?)>/g,
+		attrRegExp = /(\w+)(?:\s*=\s*(?:(?:"((?:\\.|[^"])*)")|(?:'((?:\\.|[^'])*)')|([^>\s]+)))?/g;
 
-	execInstanceCommand : function(editor_id, command, user_interface, value, focus) {
-		var inst = tinyMCE.getInstanceById(editor_id), r;
+	function makeMap(str) {
+		var map = {}, i;
 
-		if (inst) {
-			r = inst.selection.getRng();
+		str = str.split(',');
+		for (i = str.length; i >= 0; i--)
+			map[str[i]] = 1;
 
-			if (typeof(focus) == "undefined")
-				focus = true;
+		return map;
+	};
 
-			// IE bug lost focus on images in absolute divs Bug #1534575
-			if (focus && (!r || !r.item))
-				inst.contentWindow.focus();
+	tinymce.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"
+		},
 
-			// Reset design mode if lost
-			inst.autoResetDesignMode();
+		DOMUtils : function(d, s) {
+			var t = this, globalStyle;
 
-			this.selectedElement = inst.getFocusElement();
-			inst.select();
-			tinyMCE.execCommand(command, user_interface, value);
+			t.doc = d;
+			t.win = window;
+			t.files = {};
+			t.cssFlicker = false;
+			t.counter = 0;
+			t.boxModel = !tinymce.isIE || d.compatMode == "CSS1Compat"; 
+			t.stdMode = d.documentMode === 8;
 
-			// Cancel event so it doesn't call onbeforeonunlaod
-			if (tinyMCE.isIE && window.event != null)
-				tinyMCE.cancelEvent(window.event);
-		}
-	},
+			t.settings = s = tinymce.extend({
+				keep_values : false,
+				hex_colors : 1,
+				process_html : 1
+			}, s);
 
-	execCommand : function(command, user_interface, value) {
-		var inst = tinyMCE.selectedInstance, n, pe, te;
+			// Fix IE6SP2 flicker and check it failed for pre SP2
+			if (tinymce.isIE6) {
+				try {
+					d.execCommand('BackgroundImageCache', false, true);
+				} catch (e) {
+					t.cssFlicker = true;
+				}
+			}
 
-		// Default input
-		user_interface = user_interface ? user_interface : false;
-		value = value ? value : null;
+			// Build styles list
+			if (s.valid_styles) {
+				t._styles = {};
 
-		if (inst)
-			inst.switchSettings();
+				// Convert styles into a rule list
+				each(s.valid_styles, function(value, key) {
+					t._styles[key] = tinymce.explode(value);
+				});
+			}
 
-		switch (command) {
-			case "Undo":
-				if (this.getParam('custom_undo_redo_global')) {
-					if (this.undoIndex > 0) {
-						tinyMCE.nextUndoRedoAction = 'Undo';
-						inst = this.undoLevels[--this.undoIndex];
-						inst.select();
+			tinymce.addUnload(t.destroy, t);
+		},
 
-						if (!tinyMCE.nextUndoRedoInstanceId)
-							inst.execCommand('Undo');
-					}
-				} else
-					inst.execCommand('Undo');
-				return true;
+		getRoot : function() {
+			var t = this, s = t.settings;
 
-			case "Redo":
-				if (this.getParam('custom_undo_redo_global')) {
-					if (this.undoIndex <= this.undoLevels.length - 1) {
-						tinyMCE.nextUndoRedoAction = 'Redo';
-						inst = this.undoLevels[this.undoIndex++];
-						inst.select();
+			return (s && t.get(s.root_element)) || t.doc.body;
+		},
 
-						if (!tinyMCE.nextUndoRedoInstanceId)
-							inst.execCommand('Redo');
-					}
-				} else
-					inst.execCommand('Redo');
+		getViewPort : function(w) {
+			var d, b;
 
-				return true;
+			w = !w ? this.win : w;
+			d = w.document;
+			b = this.boxModel ? d.documentElement : d.body;
 
-			case 'mceFocus':
-				inst = tinyMCE.getInstanceById(value);
+			// Returns viewport size excluding scrollbars
+			return {
+				x : w.pageXOffset || b.scrollLeft,
+				y : w.pageYOffset || b.scrollTop,
+				w : w.innerWidth || b.clientWidth,
+				h : w.innerHeight || b.clientHeight
+			};
+		},
 
-				if (inst)
-					inst.getWin().focus();
-			return;
+		getRect : function(e) {
+			var p, t = this, sr;
 
-			case "mceAddControl":
-			case "mceAddEditor":
-				tinyMCE.addMCEControl(tinyMCE._getElementById(value), value);
-				return;
+			e = t.get(e);
+			p = t.getPos(e);
+			sr = t.getSize(e);
 
-			case "mceAddFrameControl":
-				tinyMCE.addMCEControl(tinyMCE._getElementById(value.element, value.document), value.element, value.document);
-				return;
+			return {
+				x : p.x,
+				y : p.y,
+				w : sr.w,
+				h : sr.h
+			};
+		},
 
-			case "mceRemoveControl":
-			case "mceRemoveEditor":
-				tinyMCE.removeMCEControl(value);
-				return;
+		getSize : function(e) {
+			var t = this, w, h;
 
-			case "mceToggleEditor":
-				inst = tinyMCE.getInstanceById(value);
+			e = t.get(e);
+			w = t.getStyle(e, 'width');
+			h = t.getStyle(e, 'height');
 
-				if (inst) {
-					pe = document.getElementById(inst.editorId + '_parent');
-					te = inst.oldTargetElement;
+			// Non pixel value, then force offset/clientWidth
+			if (w.indexOf('px') === -1)
+				w = 0;
 
-					if (typeof(inst.enabled) == 'undefined')
-						inst.enabled = true;
+			// Non pixel value, then force offset/clientWidth
+			if (h.indexOf('px') === -1)
+				h = 0;
 
-					inst.enabled = !inst.enabled;
+			return {
+				w : parseInt(w) || e.offsetWidth || e.clientWidth,
+				h : parseInt(h) || e.offsetHeight || e.clientHeight
+			};
+		},
 
-					if (!inst.enabled) {
-						pe.style.display = 'none';
+		getParent : function(n, f, r) {
+			return this.getParents(n, f, r, false);
+		},
 
-						if (te.nodeName == 'TEXTAREA' || te.nodeName == 'INPUT')
-							te.value = inst.getHTML();
-						else
-							te.innerHTML = inst.getHTML();
+		getParents : function(n, f, r, c) {
+			var t = this, na, se = t.settings, o = [];
 
-						te.style.display = inst.oldTargetDisplay;
-						tinyMCE.dispatchCallback(inst, 'hide_instance_callback', 'hideInstance', inst);
-					} else {
-						pe.style.display = 'block';
-						te.style.display = 'none';
+			n = t.get(n);
+			c = c === undefined;
 
-						if (te.nodeName == 'TEXTAREA' || te.nodeName == 'INPUT')
-							inst.setHTML(te.value);
-						else
-							inst.setHTML(te.innerHTML);
+			if (se.strict_root)
+				r = r || t.getRoot();
 
-						inst.useCSS = false;
-						tinyMCE.dispatchCallback(inst, 'show_instance_callback', 'showInstance', inst);
-					}
-				} else
-					tinyMCE.addMCEControl(tinyMCE._getElementById(value), value);
+			// Wrap node name as func
+			if (is(f, 'string')) {
+				na = f;
 
-				return;
+				if (f === '*') {
+					f = function(n) {return n.nodeType == 1;};
+				} else {
+					f = function(n) {
+						return t.is(n, na);
+					};
+				}
+			}
 
-			case "mceResetDesignMode":
-				// Resets the designmode state of the editors in Gecko
-				if (tinyMCE.isGecko) {
-					for (n in tinyMCE.instances) {
-						if (!tinyMCE.isInstance(tinyMCE.instances[n]))
-							continue;
+			while (n) {
+				if (n == r || !n.nodeType || n.nodeType === 9)
+					break;
 
-						try {
-							tinyMCE.instances[n].getDoc().designMode = "off";
-							tinyMCE.instances[n].getDoc().designMode = "on";
-							tinyMCE.instances[n].useCSS = false;
-						} catch (e) {
-							// Ignore any errors
-						}
-					}
+				if (!f || f(n)) {
+					if (c)
+						o.push(n);
+					else
+						return n;
 				}
 
-				return;
-		}
+				n = n.parentNode;
+			}
 
-		if (inst) {
-			inst.execCommand(command, user_interface, value);
-		} else if (tinyMCE.settings.focus_alert)
-			alert(tinyMCELang.lang_focus_alert);
-	},
+			return c ? o : null;
+		},
 
-	_createIFrame : function(replace_element, doc, win) {
-		var iframe, id = replace_element.getAttribute("id");
-		var aw, ah;
+		get : function(e) {
+			var n;
 
-		if (typeof(doc) == "undefined")
-			doc = document;
+			if (e && this.doc && typeof(e) == 'string') {
+				n = e;
+				e = this.doc.getElementById(e);
 
-		if (typeof(win) == "undefined")
-			win = window;
+				// IE and Opera returns meta elements when they match the specified input ID, but getElementsByName seems to do the trick
+				if (e && e.id !== n)
+					return this.doc.getElementsByName(n)[1];
+			}
 
-		iframe = doc.createElement("iframe");
+			return e;
+		},
 
-		aw = "" + tinyMCE.settings.area_width;
-		ah = "" + tinyMCE.settings.area_height;
+		getNext : function(node, selector) {
+			return this._findSib(node, selector, 'nextSibling');
+		},
 
-		if (aw.indexOf('%') == -1) {
-			aw = parseInt(aw);
-			aw = (isNaN(aw) || aw < 0) ? 300 : aw;
-			aw = aw + "px";
-		}
+		getPrev : function(node, selector) {
+			return this._findSib(node, selector, 'previousSibling');
+		},
 
-		if (ah.indexOf('%') == -1) {
-			ah = parseInt(ah);
-			ah = (isNaN(ah) || ah < 0) ? 240 : ah;
-			ah = ah + "px";
-		}
 
-		iframe.setAttribute("id", id);
-		iframe.setAttribute("name", id);
-		iframe.setAttribute("class", "mceEditorIframe");
-		iframe.setAttribute("border", "0");
-		iframe.setAttribute("frameBorder", "0");
-		iframe.setAttribute("marginWidth", "0");
-		iframe.setAttribute("marginHeight", "0");
-		iframe.setAttribute("leftMargin", "0");
-		iframe.setAttribute("topMargin", "0");
-		iframe.setAttribute("width", aw);
-		iframe.setAttribute("height", ah);
-		iframe.setAttribute("allowtransparency", "true");
-		iframe.className = 'mceEditorIframe';
+		select : function(pa, s) {
+			var t = this;
 
-		if (tinyMCE.settings.auto_resize)
-			iframe.setAttribute("scrolling", "no");
+			return tinymce.dom.Sizzle(pa, t.get(s) || t.get(t.settings.root_element) || t.doc, []);
+		},
 
-		// Must have a src element in MSIE HTTPs breaks aswell as absoute URLs
-		if (tinyMCE.isRealIE)
-			iframe.setAttribute("src", this.settings.default_document);
+		is : function(n, selector) {
+			var i;
 
-		iframe.style.width = aw;
-		iframe.style.height = ah;
+			// If it isn't an array then try to do some simple selectors instead of Sizzle for to boost performance
+			if (n.length === undefined) {
+				// Simple all selector
+				if (selector === '*')
+					return n.nodeType == 1;
 
-		// Ugly hack for Gecko problem in strict mode
-		if (tinyMCE.settings.strict_loading_mode)
-			iframe.style.marginBottom = '-5px';
+				// Simple selector just elements
+				if (simpleSelectorRe.test(selector)) {
+					selector = selector.toLowerCase().split(/,/);
+					n = n.nodeName.toLowerCase();
 
-		// MSIE 5.0 issue
-		if (tinyMCE.isRealIE)
-			replace_element.outerHTML = iframe.outerHTML;
-		else
-			replace_element.parentNode.replaceChild(iframe, replace_element);
+					for (i = selector.length - 1; i >= 0; i--) {
+						if (selector[i] == n)
+							return true;
+					}
 
-		if (tinyMCE.isRealIE)
-			return win.frames[id];
-		else
-			return iframe;
-	},
+					return false;
+				}
+			}
 
-	setupContent : function(editor_id) {
-		var inst = tinyMCE.instances[editor_id], i, doc = inst.getDoc(), head = doc.getElementsByTagName('head').item(0);
-		var content = inst.startContent, contentElement, body;
+			return tinymce.dom.Sizzle.matches(selector, n.nodeType ? [n] : n).length > 0;
+		},
 
-		// HTML values get XML encoded in strict mode
-		if (tinyMCE.settings.strict_loading_mode) {
-			content = content.replace(/&lt;/g, '<');
-			content = content.replace(/&gt;/g, '>');
-			content = content.replace(/&quot;/g, '"');
-			content = content.replace(/&amp;/g, '&');
-		}
 
-		tinyMCE.selectedInstance = inst;
-		inst.switchSettings();
+		add : function(p, n, a, h, c) {
+			var t = this;
 
-		// Not loaded correctly hit it again, Mozilla bug #997860
-		if (!tinyMCE.isIE && tinyMCE.getParam("setupcontent_reload", false) && doc.title != "blank_page") {
-			// This part will remove the designMode status
-			// Failes first time in Firefox 1.5b2 on Mac
-			try {doc.location.href = tinyMCE.baseURL + "/blank.htm";} catch (ex) {}
-			window.setTimeout("tinyMCE.setupContent('" + editor_id + "');", 1000);
-			return;
-		}
+			return this.run(p, function(p) {
+				var e, k;
 
-		// Wait for it to load
-		if (!head || !doc.body) {
-			window.setTimeout("tinyMCE.setupContent('" + editor_id + "');", 10);
-			return;
-		}
+				e = is(n, 'string') ? t.doc.createElement(n) : n;
+				t.setAttribs(e, a);
 
-		// Import theme specific content CSS the user specific
-		tinyMCE.importCSS(inst.getDoc(), tinyMCE.baseURL + "/themes/" + inst.settings.theme + "/css/editor_content.css");
-		tinyMCE.importCSS(inst.getDoc(), inst.settings.content_css);
-		tinyMCE.dispatchCallback(inst, 'init_instance_callback', 'initInstance', inst);
+				if (h) {
+					if (h.nodeType)
+						e.appendChild(h);
+					else
+						t.setHTML(e, h);
+				}
 
-		// Setup keyboard shortcuts
-		if (tinyMCE.getParam('custom_undo_redo_keyboard_shortcuts')) {
-			inst.addShortcut('ctrl', 'z', 'lang_undo_desc', 'Undo');
-			inst.addShortcut('ctrl', 'y', 'lang_redo_desc', 'Redo');
-		}
+				return !c ? p.appendChild(e) : e;
+			});
+		},
 
-		// BlockFormat shortcuts keys
-		for (i=1; i<=6; i++)
-			inst.addShortcut('ctrl', '' + i, '', 'FormatBlock', false, '<h' + i + '>');
+		create : function(n, a, h) {
+			return this.add(this.doc.createElement(n), n, a, h, 1);
+		},
 
-		inst.addShortcut('ctrl', '7', '', 'FormatBlock', false, '<p>');
-		inst.addShortcut('ctrl', '8', '', 'FormatBlock', false, '<div>');
-		inst.addShortcut('ctrl', '9', '', 'FormatBlock', false, '<address>');
+		createHTML : function(n, a, h) {
+			var o = '', t = this, k;
 
-		// Add default shortcuts for gecko
-		if (tinyMCE.isGecko) {
-			inst.addShortcut('ctrl', 'b', 'lang_bold_desc', 'Bold');
-			inst.addShortcut('ctrl', 'i', 'lang_italic_desc', 'Italic');
-			inst.addShortcut('ctrl', 'u', 'lang_underline_desc', 'Underline');
-		}
+			o += '<' + n;
 
-		// Setup span styles
-		if (tinyMCE.getParam("convert_fonts_to_spans"))
-			inst.getBody().setAttribute('id', 'mceSpanFonts');
+			for (k in a) {
+				if (a.hasOwnProperty(k))
+					o += ' ' + k + '="' + t.encode(a[k]) + '"';
+			}
 
-		if (tinyMCE.settings.nowrap)
-			doc.body.style.whiteSpace = "nowrap";
+			if (tinymce.is(h))
+				return o + '>' + h + '</' + n + '>';
 
-		doc.body.dir = this.settings.directionality;
-		doc.editorId = editor_id;
+			return o + ' />';
+		},
 
-		// Add on document element in Mozilla
-		if (!tinyMCE.isIE)
-			doc.documentElement.editorId = editor_id;
+		remove : function(node, keep_children) {
+			return this.run(node, function(node) {
+				var parent, child;
 
-		inst.setBaseHREF(tinyMCE.settings.base_href);
+				parent = node.parentNode;
 
-		// Replace new line characters to BRs
-		if (tinyMCE.settings.convert_newlines_to_brs) {
-			content = tinyMCE.regexpReplace(content, "\r\n", "<br />", "gi");
-			content = tinyMCE.regexpReplace(content, "\r", "<br />", "gi");
-			content = tinyMCE.regexpReplace(content, "\n", "<br />", "gi");
-		}
+				if (!parent)
+					return null;
 
-		// Open closed anchors
-	//	content = content.replace(new RegExp('<a(.*?)/>', 'gi'), '<a$1></a>');
+				if (keep_children) {
+					while (child = node.firstChild) {
+						// IE 8 will crash if you don't remove completely empty text nodes
+						if (!tinymce.isIE || child.nodeType !== 3 || child.nodeValue)
+							parent.insertBefore(child, node);
+						else
+							node.removeChild(child);
+					}
+				}
 
-		// Call custom cleanup code
-		content = tinyMCE.storeAwayURLs(content);
-		content = tinyMCE._customCleanup(inst, "insert_to_editor", content);
+				return parent.removeChild(node);
+			});
+		},
 
-		if (tinyMCE.isIE) {
-			// Ugly!!!
-			window.setInterval('try{tinyMCE.getCSSClasses(tinyMCE.instances["' + editor_id + '"].getDoc(), "' + editor_id + '");}catch(e){}', 500);
+		setStyle : function(n, na, v) {
+			var t = this;
 
-			if (tinyMCE.settings.force_br_newlines)
-				doc.styleSheets[0].addRule("p", "margin: 0;");
+			return t.run(n, function(e) {
+				var s, i;
 
-			body = inst.getBody();
-			body.editorId = editor_id;
-		}
+				s = e.style;
 
-		content = tinyMCE.cleanupHTMLCode(content);
+				// Camelcase it, if needed
+				na = na.replace(/-(\D)/g, function(a, b){
+					return b.toUpperCase();
+				});
 
-		// Fix for bug #958637
-		if (!tinyMCE.isIE) {
-			contentElement = inst.getDoc().createElement("body");
-			doc = inst.getDoc();
+				// Default px suffix on these
+				if (t.pixelStyles.test(na) && (tinymce.is(v, 'number') || /^[\-0-9\.]+$/.test(v)))
+					v += 'px';
 
-			contentElement.innerHTML = content;
+				switch (na) {
+					case 'opacity':
+						// IE specific opacity
+						if (isIE) {
+							s.filter = v === '' ? '' : "alpha(opacity=" + (v * 100) + ")";
 
-			if (tinyMCE.settings.cleanup_on_startup)
-				tinyMCE.setInnerHTML(inst.getBody(), tinyMCE._cleanupHTML(inst, doc, this.settings, contentElement));
-			else
-				tinyMCE.setInnerHTML(inst.getBody(), content);
+							if (!n.currentStyle || !n.currentStyle.hasLayout)
+								s.display = 'inline-block';
+						}
 
-			tinyMCE.convertAllRelativeURLs(inst.getBody());
-		} else {
-			if (tinyMCE.settings.cleanup_on_startup) {
-				tinyMCE._setHTML(inst.getDoc(), content);
+						// Fix for older browsers
+						s[na] = s['-moz-opacity'] = s['-khtml-opacity'] = v || '';
+						break;
 
-				// Produces permission denied error in MSIE 5.5
-				try {
-					tinyMCE.setInnerHTML(inst.getBody(), tinyMCE._cleanupHTML(inst, inst.contentDocument, this.settings, inst.getBody()));
-				} catch(e) {
-					// Ignore
+					case 'float':
+						isIE ? s.styleFloat = v : s.cssFloat = v;
+						break;
+					
+					default:
+						s[na] = v || '';
 				}
-			} else
-				tinyMCE._setHTML(inst.getDoc(), content);
-		}
 
-		// Fix for bug #957681
-		//inst.getDoc().designMode = inst.getDoc().designMode;
+				// Force update of the style data
+				if (t.settings.update_styles)
+					t.setAttrib(e, '_mce_style');
+			});
+		},
 
-		tinyMCE.handleVisualAid(inst.getBody(), true, tinyMCE.settings.visual, inst);
-		tinyMCE.dispatchCallback(inst, 'setupcontent_callback', 'setupContent', editor_id, inst.getBody(), inst.getDoc());
+		getStyle : function(n, na, c) {
+			n = this.get(n);
 
-		// Re-add design mode on mozilla
-		if (!tinyMCE.isIE)
-			tinyMCE.addEventHandlers(inst);
+			if (!n)
+				return false;
 
-		// Add blur handler
-		if (tinyMCE.isIE) {
-			tinyMCE.addEvent(inst.getBody(), "blur", TinyMCE_Engine.prototype._eventPatch);
-			tinyMCE.addEvent(inst.getBody(), "beforedeactivate", TinyMCE_Engine.prototype._eventPatch); // Bug #1439953
+			// Gecko
+			if (this.doc.defaultView && c) {
+				// Remove camelcase
+				na = na.replace(/[A-Z]/g, function(a){
+					return '-' + a;
+				});
 
-			// Workaround for drag drop/copy paste base href bug
-			if (!tinyMCE.isOpera) {
-				tinyMCE.addEvent(doc.body, "mousemove", TinyMCE_Engine.prototype.onMouseMove);
-				tinyMCE.addEvent(doc.body, "beforepaste", TinyMCE_Engine.prototype._eventPatch);
-				tinyMCE.addEvent(doc.body, "drop", TinyMCE_Engine.prototype._eventPatch);
+				try {
+					return this.doc.defaultView.getComputedStyle(n, null).getPropertyValue(na);
+				} catch (ex) {
+					// Old safari might fail
+					return null;
+				}
 			}
-		}
 
-		// Trigger node change, this call locks buttons for tables and so forth
-		inst.select();
-		tinyMCE.selectedElement = inst.contentWindow.document.body;
+			// Camelcase it, if needed
+			na = na.replace(/-(\D)/g, function(a, b){
+				return b.toUpperCase();
+			});
 
-		// Call custom DOM cleanup
-		tinyMCE._customCleanup(inst, "insert_to_editor_dom", inst.getBody());
-		tinyMCE._customCleanup(inst, "setup_content_dom", inst.getBody());
-		tinyMCE._setEventsEnabled(inst.getBody(), false);
-		tinyMCE.cleanupAnchors(inst.getDoc());
+			if (na == 'float')
+				na = isIE ? 'styleFloat' : 'cssFloat';
 
-		if (tinyMCE.getParam("convert_fonts_to_spans"))
-			tinyMCE.convertSpansToFonts(inst.getDoc());
+			// IE & Opera
+			if (n.currentStyle && c)
+				return n.currentStyle[na];
 
-		inst.startContent = tinyMCE.trim(inst.getBody().innerHTML);
-		inst.undoRedo.add({ content : inst.startContent });
+			return n.style[na];
+		},
 
-		// Cleanup any mess left from storyAwayURLs
-		if (tinyMCE.isGecko) {
-			// Remove mce_src from textnodes and comments
-			tinyMCE.selectNodes(inst.getBody(), function(n) {
-				if (n.nodeType == 3 || n.nodeType == 8)
-					n.nodeValue = n.nodeValue.replace(new RegExp('\\s(mce_src|mce_href)=\"[^\"]*\"', 'gi'), "");
+		setStyles : function(e, o) {
+			var t = this, s = t.settings, ol;
 
-				return false;
+			ol = s.update_styles;
+			s.update_styles = 0;
+
+			each(o, function(v, n) {
+				t.setStyle(e, n, v);
 			});
-		}
 
-		// Remove Gecko spellchecking
-		if (tinyMCE.isGecko)
-			inst.getBody().spellcheck = tinyMCE.getParam("gecko_spellcheck");
+			// Update style info
+			s.update_styles = ol;
+			if (s.update_styles)
+				t.setAttrib(e, s.cssText);
+		},
 
-		// Cleanup any mess left from storyAwayURLs
-		tinyMCE._removeInternal(inst.getBody());
+		setAttrib : function(e, n, v) {
+			var t = this;
 
-		inst.select();
-		tinyMCE.triggerNodeChange(false, true);
-	},
+			// Whats the point
+			if (!e || !n)
+				return;
 
-	storeAwayURLs : function(s) {
-		// Remove all mce_src, mce_href and replace them with new ones
-		// s = s.replace(new RegExp('mce_src\\s*=\\s*\"[^ >\"]*\"', 'gi'), '');
-		// s = s.replace(new RegExp('mce_href\\s*=\\s*\"[^ >\"]*\"', 'gi'), '');
+			// Strict XML mode
+			if (t.settings.strict)
+				n = n.toLowerCase();
 
-		if (!s.match(/(mce_src|mce_href)/gi, s)) {
-			s = s.replace(new RegExp('src\\s*=\\s*[\"\']([^ >\"]*)[\"\']', 'gi'), 'src="$1" mce_src="$1"');
-			s = s.replace(new RegExp('href\\s*=\\s*[\"\']([^ >\"]*)[\"\']', 'gi'), 'href="$1" mce_href="$1"');
-		}
+			return this.run(e, function(e) {
+				var s = t.settings;
 
-		return s;
-	},
+				switch (n) {
+					case "style":
+						if (!is(v, 'string')) {
+							each(v, function(v, n) {
+								t.setStyle(e, n, v);
+							});
 
-	_removeInternal : function(n) {
-		if (tinyMCE.isGecko) {
-			// Remove mce_src from textnodes and comments
-			tinyMCE.selectNodes(n, function(n) {
-				if (n.nodeType == 3 || n.nodeType == 8)
-					n.nodeValue = n.nodeValue.replace(new RegExp('\\s(mce_src|mce_href)=\"[^\"]*\"', 'gi'), "");
+							return;
+						}
 
-				return false;
+						// No mce_style for elements with these since they might get resized by the user
+						if (s.keep_values) {
+							if (v && !t._isRes(v))
+								e.setAttribute('_mce_style', v, 2);
+							else
+								e.removeAttribute('_mce_style', 2);
+						}
+
+						e.style.cssText = v;
+						break;
+
+					case "class":
+						e.className = v || ''; // Fix IE null bug
+						break;
+
+					case "src":
+					case "href":
+						if (s.keep_values) {
+							if (s.url_converter)
+								v = s.url_converter.call(s.url_converter_scope || t, v, n, e);
+
+							t.setAttrib(e, '_mce_' + n, v, 2);
+						}
+
+						break;
+					
+					case "shape":
+						e.setAttribute('_mce_style', v);
+						break;
+				}
+
+				if (is(v) && v !== null && v.length !== 0)
+					e.setAttribute(n, '' + v, 2);
+				else
+					e.removeAttribute(n, 2);
 			});
-		}
-	},
+		},
 
-	removeTinyMCEFormElements : function(form_obj) {
-		var i, elementId;
+		setAttribs : function(e, o) {
+			var t = this;
 
-		// Skip form element removal
-		if (!tinyMCE.getParam('hide_selects_on_submit'))
-			return;
+			return this.run(e, function(e) {
+				each(o, function(v, n) {
+					t.setAttrib(e, n, v);
+				});
+			});
+		},
 
-		// Check if form is valid
-		if (typeof(form_obj) == "undefined" || form_obj == null)
-			return;
+		getAttrib : function(e, n, dv) {
+			var v, t = this;
 
-		// If not a form, find the form
-		if (form_obj.nodeName != "FORM") {
-			if (form_obj.form)
-				form_obj = form_obj.form;
-			else
-				form_obj = tinyMCE.getParentElement(form_obj, "form");
-		}
+			e = t.get(e);
 
-		// Still nothing
-		if (form_obj == null)
-			return;
+			if (!e || e.nodeType !== 1)
+				return false;
 
-		// Disable all UI form elements that TinyMCE created
-		for (i=0; i<form_obj.elements.length; i++) {
-			elementId = form_obj.elements[i].name ? form_obj.elements[i].name : form_obj.elements[i].id;
+			if (!is(dv))
+				dv = '';
 
-			if (elementId.indexOf('mce_editor_') == 0)
-				form_obj.elements[i].disabled = true;
-		}
-	},
+			// Try the mce variant for these
+			if (/^(src|href|style|coords|shape)$/.test(n)) {
+				v = e.getAttribute("_mce_" + n);
 
-	handleEvent : function(e) {
-		var inst = tinyMCE.selectedInstance, i, elm, keys;
+				if (v)
+					return v;
+			}
 
-		// Remove odd, error
-		if (typeof(tinyMCE) == "undefined")
-			return true;
+			if (isIE && t.props[n]) {
+				v = e[t.props[n]];
+				v = v && v.nodeValue ? v.nodeValue : v;
+			}
 
-		//tinyMCE.debug(e.type + " " + e.target.nodeName + " " + (e.relatedTarget ? e.relatedTarget.nodeName : ""));
+			if (!v)
+				v = e.getAttribute(n, 2);
 
-		if (tinyMCE.executeCallback(tinyMCE.selectedInstance, 'handle_event_callback', 'handleEvent', e))
-			return false;
+			// Check boolean attribs
+			if (/^(checked|compact|declare|defer|disabled|ismap|multiple|nohref|noshade|nowrap|readonly|selected)$/.test(n)) {
+				if (e[t.props[n]] === true && v === '')
+					return n;
 
-		switch (e.type) {
-			case "beforedeactivate": // Was added due to bug #1439953
-			case "blur":
-				if (tinyMCE.selectedInstance)
-					tinyMCE.selectedInstance.execCommand('mceEndTyping');
+				return v ? n : '';
+			}
 
-				tinyMCE.hideMenus();
+			// Inner input elements will override attributes on form elements
+			if (e.nodeName === "FORM" && e.getAttributeNode(n))
+				return e.getAttributeNode(n).nodeValue;
 
-				return;
+			if (n === 'style') {
+				v = v || e.style.cssText;
 
-			// Workaround for drag drop/copy paste base href bug
-			case "drop":
-			case "beforepaste":
-/*				if (tinyMCE.selectedInstance)
-					tinyMCE.selectedInstance.setBaseHREF(null);
+				if (v) {
+					v = t.serializeStyle(t.parseStyle(v), e.nodeName);
 
-				// Fixes odd MSIE bug where drag/droping elements in a iframe with height 100% breaks
-				// This logic forces the width/height to be in pixels while the user is drag/dropping
-				// NOTE: This has been disabled for now since it messes up copy/paste that is far more important than image drag
-				if (tinyMCE.isRealIE) {
-					var ife = tinyMCE.selectedInstance.iframeElement;
-
-					if (ife.style.height.indexOf('%') != -1) {
-						ife._oldHeight = ife.style.height;
-						ife.style.height = ife.clientHeight;
-					}
+					if (t.settings.keep_values && !t._isRes(v))
+						e.setAttribute('_mce_style', v);
 				}
+			}
 
-				window.setTimeout("tinyMCE.selectedInstance.setBaseHREF(tinyMCE.settings.base_href);tinyMCE._resetIframeHeight();", 1);
-				*/
-				return;
+			// Remove Apple and WebKit stuff
+			if (isWebKit && n === "class" && v)
+				v = v.replace(/(apple|webkit)\-[a-z\-]+/gi, '');
 
-			case "submit":
-				tinyMCE.formSubmit(tinyMCE.isMSIE ? window.event.srcElement : e.target);
-				return;
+			// Handle IE issues
+			if (isIE) {
+				switch (n) {
+					case 'rowspan':
+					case 'colspan':
+						// IE returns 1 as default value
+						if (v === 1)
+							v = '';
 
-			case "reset":
-				var formObj = tinyMCE.isIE ? window.event.srcElement : e.target;
+						break;
 
-				for (i=0; i<document.forms.length; i++) {
-					if (document.forms[i] == formObj)
-						window.setTimeout('tinyMCE.resetForm(' + i + ');', 10);
+					case 'size':
+						// IE returns +0 as default value for size
+						if (v === '+0' || v === 20 || v === 0)
+							v = '';
+
+						break;
+
+					case 'width':
+					case 'height':
+					case 'vspace':
+					case 'checked':
+					case 'disabled':
+					case 'readonly':
+						if (v === 0)
+							v = '';
+
+						break;
+
+					case 'hspace':
+						// IE returns -1 as default value
+						if (v === -1)
+							v = '';
+
+						break;
+
+					case 'maxlength':
+					case 'tabindex':
+						// IE returns default value
+						if (v === 32768 || v === 2147483647 || v === '32768')
+							v = '';
+
+						break;
+
+					case 'multiple':
+					case 'compact':
+					case 'noshade':
+					case 'nowrap':
+						if (v === 65535)
+							return n;
+
+						return dv;
+
+					case 'shape':
+						v = v.toLowerCase();
+						break;
+
+					default:
+						// IE has odd anonymous function for event attributes
+						if (n.indexOf('on') === 0 && v)
+							v = ('' + v).replace(/^function\s+\w+\(\)\s+\{\s+(.*)\s+\}$/, '$1');
 				}
+			}
 
-				return;
+			return (v !== undefined && v !== null && v !== '') ? '' + v : dv;
+		},
 
-			case "keypress":
-				if (inst && inst.handleShortcut(e))
-					return false;
+		getPos : function(n, ro) {
+			var t = this, x = 0, y = 0, e, d = t.doc, r;
 
-				if (e.target.editorId) {
-					tinyMCE.instances[e.target.editorId].select();
-				} else {
-					if (e.target.ownerDocument.editorId)
-						tinyMCE.instances[e.target.ownerDocument.editorId].select();
+			n = t.get(n);
+			ro = ro || d.body;
+
+			if (n) {
+				// Use getBoundingClientRect on IE, Opera has it but it's not perfect
+				if (isIE && !t.stdMode) {
+					n = n.getBoundingClientRect();
+					e = t.boxModel ? d.documentElement : d.body;
+					x = t.getStyle(t.select('html')[0], 'borderWidth'); // Remove border
+					x = (x == 'medium' || t.boxModel && !t.isIE6) && 2 || x;
+
+					return {x : n.left + e.scrollLeft - x, y : n.top + e.scrollTop - x};
 				}
 
-				if (tinyMCE.selectedInstance)
-					tinyMCE.selectedInstance.switchSettings();
+				r = n;
+				while (r && r != ro && r.nodeType) {
+					x += r.offsetLeft || 0;
+					y += r.offsetTop || 0;
+					r = r.offsetParent;
+				}
 
-				// Insert P element
-				if ((tinyMCE.isGecko || tinyMCE.isOpera || tinyMCE.isSafari) && tinyMCE.settings.force_p_newlines && e.keyCode == 13 && !e.shiftKey) {
-					// Insert P element instead of BR
-					if (TinyMCE_ForceParagraphs._insertPara(tinyMCE.selectedInstance, e)) {
-						// Cancel event
-						tinyMCE.execCommand("mceAddUndoLevel");
-						return tinyMCE.cancelEvent(e);
-					}
+				r = n.parentNode;
+				while (r && r != ro && r.nodeType) {
+					x -= r.scrollLeft || 0;
+					y -= r.scrollTop || 0;
+					r = r.parentNode;
 				}
+			}
 
-				// Handle backspace
-				if ((tinyMCE.isGecko && !tinyMCE.isSafari) && tinyMCE.settings.force_p_newlines && (e.keyCode == 8 || e.keyCode == 46) && !e.shiftKey) {
-					// Insert P element instead of BR
-					if (TinyMCE_ForceParagraphs._handleBackSpace(tinyMCE.selectedInstance, e.type)) {
-						// Cancel event
-						tinyMCE.execCommand("mceAddUndoLevel");
-						return tinyMCE.cancelEvent(e);
+			return {x : x, y : y};
+		},
+
+		parseStyle : function(st) {
+			var t = this, s = t.settings, o = {};
+
+			if (!st)
+				return o;
+
+			function compress(p, s, ot) {
+				var t, r, b, l;
+
+				// Get values and check it it needs compressing
+				t = o[p + '-top' + s];
+				if (!t)
+					return;
+
+				r = o[p + '-right' + s];
+				if (t != r)
+					return;
+
+				b = o[p + '-bottom' + s];
+				if (r != b)
+					return;
+
+				l = o[p + '-left' + s];
+				if (b != l)
+					return;
+
+				// Compress
+				o[ot] = l;
+				delete o[p + '-top' + s];
+				delete o[p + '-right' + s];
+				delete o[p + '-bottom' + s];
+				delete o[p + '-left' + s];
+			};
+
+			function compress2(ta, a, b, c) {
+				var t;
+
+				t = o[a];
+				if (!t)
+					return;
+
+				t = o[b];
+				if (!t)
+					return;
+
+				t = o[c];
+				if (!t)
+					return;
+
+				// Compress
+				o[ta] = o[a] + ' ' + o[b] + ' ' + o[c];
+				delete o[a];
+				delete o[b];
+				delete o[c];
+			};
+
+			st = st.replace(/&(#?[a-z0-9]+);/g, '&$1_MCE_SEMI_'); // Protect entities
+
+			each(st.split(';'), function(v) {
+				var sv, ur = [];
+
+				if (v) {
+					v = v.replace(/_MCE_SEMI_/g, ';'); // Restore entities
+					v = v.replace(/url\([^\)]+\)/g, function(v) {ur.push(v);return 'url(' + ur.length + ')';});
+					v = v.split(':');
+					sv = tinymce.trim(v[1]);
+					sv = sv.replace(/url\(([^\)]+)\)/g, function(a, b) {return ur[parseInt(b) - 1];});
+
+					sv = sv.replace(/rgb\([^\)]+\)/g, function(v) {
+						return t.toHex(v);
+					});
+
+					if (s.url_converter) {
+						sv = sv.replace(/url\([\'\"]?([^\)\'\"]+)[\'\"]?\)/g, function(x, c) {
+							return 'url(' + s.url_converter.call(s.url_converter_scope || t, t.decode(c), 'style', null) + ')';
+						});
 					}
+
+					o[tinymce.trim(v[0]).toLowerCase()] = sv;
 				}
+			});
 
-				// Return key pressed
-				if (tinyMCE.isIE && tinyMCE.settings.force_br_newlines && e.keyCode == 13) {
-					if (e.target.editorId)
-						tinyMCE.instances[e.target.editorId].select();
+			compress("border", "", "border");
+			compress("border", "-width", "border-width");
+			compress("border", "-color", "border-color");
+			compress("border", "-style", "border-style");
+			compress("padding", "", "padding");
+			compress("margin", "", "margin");
+			compress2('border', 'border-width', 'border-style', 'border-color');
 
-					if (tinyMCE.selectedInstance) {
-						var sel = tinyMCE.selectedInstance.getDoc().selection;
-						var rng = sel.createRange();
+			if (isIE) {
+				// Remove pointless border
+				if (o.border == 'medium none')
+					o.border = '';
+			}
 
-						if (tinyMCE.getParentElement(rng.parentElement(), "li") != null)
-							return false;
+			return o;
+		},
 
-						// Cancel event
-						e.returnValue = false;
-						e.cancelBubble = true;
+		serializeStyle : function(o, name) {
+			var t = this, s = '';
 
-						// Insert BR element
-						rng.pasteHTML("<br />");
-						rng.collapse(false);
-						rng.select();
+			function add(v, k) {
+				if (k && v) {
+					// Remove browser specific styles like -moz- or -webkit-
+					if (k.indexOf('-') === 0)
+						return;
 
-						tinyMCE.execCommand("mceAddUndoLevel");
-						tinyMCE.triggerNodeChange(false);
-						return false;
+					switch (k) {
+						case 'font-weight':
+							// Opera will output bold as 700
+							if (v == 700)
+								v = 'bold';
+
+							break;
+
+						case 'color':
+						case 'background-color':
+							v = v.toLowerCase();
+							break;
 					}
+
+					s += (s ? ' ' : '') + k + ': ' + v + ';';
 				}
+			};
 
-				// Backspace or delete
-				if (e.keyCode == 8 || e.keyCode == 46) {
-					tinyMCE.selectedElement = e.target;
-					tinyMCE.linkElement = tinyMCE.getParentElement(e.target, "a");
-					tinyMCE.imgElement = tinyMCE.getParentElement(e.target, "img");
-					tinyMCE.triggerNodeChange(false);
+			// Validate style output
+			if (name && t._styles) {
+				each(t._styles['*'], function(name) {
+					add(o[name], name);
+				});
+
+				each(t._styles[name.toLowerCase()], function(name) {
+					add(o[name], name);
+				});
+			} else
+				each(o, add);
+
+			return s;
+		},
+
+		loadCSS : function(u) {
+			var t = this, d = t.doc, head;
+
+			if (!u)
+				u = '';
+
+			head = t.select('head')[0];
+
+			each(u.split(','), function(u) {
+				var link;
+
+				if (t.files[u])
+					return;
+
+				t.files[u] = true;
+				link = t.create('link', {rel : 'stylesheet', href : tinymce._addVer(u)});
+
+				// IE 8 has a bug where dynamically loading stylesheets would produce a 1 item remaining bug
+				// This fix seems to resolve that issue by realcing the document ones a stylesheet finishes loading
+				// It's ugly but it seems to work fine.
+				if (isIE && d.documentMode) {
+					link.onload = function() {
+						d.recalc();
+						link.onload = null;
+					};
 				}
 
-				return false;
+				head.appendChild(link);
+			});
+		},
 
-			case "keyup":
-			case "keydown":
-				tinyMCE.hideMenus();
-				tinyMCE.hasMouseMoved = false;
+		addClass : function(e, c) {
+			return this.run(e, function(e) {
+				var o;
 
-				if (inst && inst.handleShortcut(e))
-					return false;
+				if (!c)
+					return 0;
 
-				inst._fixRootBlocks();
+				if (this.hasClass(e, c))
+					return e.className;
 
-				if (inst.settings.remove_trailing_nbsp)
-					inst._fixTrailingNbsp();
+				o = this.removeClass(e, c);
 
-				if (e.target.editorId)
-					tinyMCE.instances[e.target.editorId].select();
+				return e.className = (o != '' ? (o + ' ') : '') + c;
+			});
+		},
 
-				if (tinyMCE.selectedInstance)
-					tinyMCE.selectedInstance.switchSettings();
+		removeClass : function(e, c) {
+			var t = this, re;
 
-				inst = tinyMCE.selectedInstance;
+			return t.run(e, function(e) {
+				var v;
 
-				// Handle backspace
-				if (tinyMCE.isGecko && tinyMCE.settings.force_p_newlines && (e.keyCode == 8 || e.keyCode == 46) && !e.shiftKey) {
-					// Insert P element instead of BR
-					if (TinyMCE_ForceParagraphs._handleBackSpace(tinyMCE.selectedInstance, e.type)) {
-						// Cancel event
-						tinyMCE.execCommand("mceAddUndoLevel");
-						e.preventDefault();
-						return false;
+				if (t.hasClass(e, c)) {
+					if (!re)
+						re = new RegExp("(^|\\s+)" + c + "(\\s+|$)", "g");
+
+					v = e.className.replace(re, ' ');
+					v = tinymce.trim(v != ' ' ? v : '');
+
+					e.className = v;
+
+					// Empty class attr
+					if (!v) {
+						e.removeAttribute('class');
+						e.removeAttribute('className');
 					}
+
+					return v;
 				}
 
-				tinyMCE.selectedElement = null;
-				tinyMCE.selectedNode = null;
-				elm = tinyMCE.selectedInstance.getFocusElement();
-				tinyMCE.linkElement = tinyMCE.getParentElement(elm, "a");
-				tinyMCE.imgElement = tinyMCE.getParentElement(elm, "img");
-				tinyMCE.selectedElement = elm;
+				return e.className;
+			});
+		},
 
-				// Update visualaids on tabs
-				if (tinyMCE.isGecko && e.type == "keyup" && e.keyCode == 9)
-					tinyMCE.handleVisualAid(tinyMCE.selectedInstance.getBody(), true, tinyMCE.settings.visual, tinyMCE.selectedInstance);
+		hasClass : function(n, c) {
+			n = this.get(n);
 
-				// Fix empty elements on return/enter, check where enter occured
-				if (tinyMCE.isIE && e.type == "keydown" && e.keyCode == 13)
-					tinyMCE.enterKeyElement = tinyMCE.selectedInstance.getFocusElement();
+			if (!n || !c)
+				return false;
 
-				// Fix empty elements on return/enter
-				if (tinyMCE.isIE && e.type == "keyup" && e.keyCode == 13) {
-					elm = tinyMCE.enterKeyElement;
-					if (elm) {
-						var re = new RegExp('^HR|IMG|BR$','g'); // Skip these
-						var dre = new RegExp('^H[1-6]$','g'); // Add double on these
+			return (' ' + n.className + ' ').indexOf(' ' + c + ' ') !== -1;
+		},
 
-						if (!elm.hasChildNodes() && !re.test(elm.nodeName)) {
-							if (dre.test(elm.nodeName))
-								elm.innerHTML = "&nbsp;&nbsp;";
-							else
-								elm.innerHTML = "&nbsp;";
+		show : function(e) {
+			return this.setStyle(e, 'display', 'block');
+		},
+
+		hide : function(e) {
+			return this.setStyle(e, 'display', 'none');
+		},
+
+		isHidden : function(e) {
+			e = this.get(e);
+
+			return !e || e.style.display == 'none' || this.getStyle(e, 'display') == 'none';
+		},
+
+		uniqueId : function(p) {
+			return (!p ? 'mce_' : p) + (this.counter++);
+		},
+
+		setHTML : function(e, h) {
+			var t = this;
+
+			return this.run(e, function(e) {
+				var x, i, nl, n, p, x;
+
+				h = t.processHTML(h);
+
+				if (isIE) {
+					function set() {
+						// Remove all child nodes
+						while (e.firstChild)
+							e.firstChild.removeNode();
+
+						try {
+							// IE will remove comments from the beginning
+							// unless you padd the contents with something
+							e.innerHTML = '<br />' + h;
+							e.removeChild(e.firstChild);
+						} catch (ex) {
+							// 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
+							// This seems to fix this problem
+
+							// Create new div with HTML contents and a BR infront to keep comments
+							x = t.create('div');
+							x.innerHTML = '<br />' + h;
+
+							// Add all children from div to target
+							each (x.childNodes, function(n, i) {
+								// Skip br element
+								if (i)
+									e.appendChild(n);
+							});
 						}
+					};
+
+					// IE has a serious bug when it comes to paragraphs it can produce an invalid
+					// DOM tree if contents like this <p><ul><li>Item 1</li></ul></p> is inserted
+					// It seems to be that IE doesn't like a root block element placed inside another root block element
+					if (t.settings.fix_ie_paragraphs)
+						h = h.replace(/<p><\/p>|<p([^>]+)><\/p>|<p[^\/+]\/>/gi, '<p$1 _mce_keep="true">&nbsp;</p>');
+
+					set();
+
+					if (t.settings.fix_ie_paragraphs) {
+						// Check for odd paragraphs this is a sign of a broken DOM
+						nl = e.getElementsByTagName("p");
+						for (i = nl.length - 1, x = 0; i >= 0; i--) {
+							n = nl[i];
+
+							if (!n.hasChildNodes()) {
+								if (!n._mce_keep) {
+									x = 1; // Is broken
+									break;
+								}
+
+								n.removeAttribute('_mce_keep');
+							}
+						}
 					}
-				}
 
-				// Check if it's a position key
-				keys = tinyMCE.posKeyCodes;
-				var posKey = false;
-				for (i=0; i<keys.length; i++) {
-					if (keys[i] == e.keyCode) {
-						posKey = true;
-						break;
+					// Time to fix the madness IE left us
+					if (x) {
+						// So if we replace the p elements with divs and mark them and then replace them back to paragraphs
+						// after we use innerHTML we can fix the DOM tree
+						h = h.replace(/<p ([^>]+)>|<p>/ig, '<div $1 _mce_tmp="1">');
+						h = h.replace(/<\/p>/gi, '</div>');
+
+						// Set the new HTML with DIVs
+						set();
+
+						// Replace all DIV elements with the _mce_tmp attibute back to paragraphs
+						// This is needed since IE has a annoying bug see above for details
+						// This is a slow process but it has to be done. :(
+						if (t.settings.fix_ie_paragraphs) {
+							nl = e.getElementsByTagName("DIV");
+							for (i = nl.length - 1; i >= 0; i--) {
+								n = nl[i];
+
+								// Is it a temp div
+								if (n._mce_tmp) {
+									// Create new paragraph
+									p = t.doc.createElement('p');
+
+									// Copy all attributes
+									n.cloneNode(false).outerHTML.replace(/([a-z0-9\-_]+)=/gi, function(a, b) {
+										var v;
+
+										if (b !== '_mce_tmp') {
+											v = n.getAttribute(b);
+
+											if (!v && b === 'class')
+												v = n.className;
+
+											p.setAttribute(b, v);
+										}
+									});
+
+									// Append all children to new paragraph
+									for (x = 0; x<n.childNodes.length; x++)
+										p.appendChild(n.childNodes[x].cloneNode(true));
+
+									// Replace div with new paragraph
+									n.swapNode(p);
+								}
+							}
+						}
 					}
+				} else
+					e.innerHTML = h;
+
+				return h;
+			});
+		},
+
+		processHTML : function(h) {
+			var t = this, s = t.settings, codeBlocks = [];
+
+			if (!s.process_html)
+				return h;
+
+			if (isIE) {
+				h = h.replace(/&apos;/g, '&#39;'); // IE can't handle apos
+				h = h.replace(/\s+(disabled|checked|readonly|selected)\s*=\s*[\"\']?(false|0)[\"\']?/gi, ''); // IE doesn't handle default values correct
+			}
+
+			// Fix some issues
+			h = h.replace(/<a( )([^>]+)\/>|<a\/>/gi, '<a$1$2></a>'); // Force open
+
+			// Store away src and href in _mce_src and mce_href since browsers mess them up
+			if (s.keep_values) {
+				// Wrap scripts and styles in comments for serialization purposes
+				if (/<script|noscript|style/i.test(h)) {
+					function trim(s) {
+						// Remove prefix and suffix code for element
+						s = s.replace(/(<!--\[CDATA\[|\]\]-->)/g, '\n');
+						s = s.replace(/^[\r\n]*|[\r\n]*$/g, '');
+						s = s.replace(/^\s*(\/\/\s*<!--|\/\/\s*<!\[CDATA\[|<!--|<!\[CDATA\[)[\r\n]*/g, '');
+						s = s.replace(/\s*(\/\/\s*\]\]>|\/\/\s*-->|\]\]>|-->|\]\]-->)\s*$/g, '');
+
+						return s;
+					};
+
+					// Wrap the script contents in CDATA and keep them from executing
+					h = h.replace(/<script([^>]+|)>([\s\S]*?)<\/script>/gi, function(v, attribs, text) {
+						// Force type attribute
+						if (!attribs)
+							attribs = ' type="text/javascript"';
+
+						// Convert the src attribute of the scripts
+						attribs = attribs.replace(/src=\"([^\"]+)\"?/i, function(a, url) {
+							if (s.url_converter)
+								url = t.encode(s.url_converter.call(s.url_converter_scope || t, t.decode(url), 'src', 'script'));
+
+							return '_mce_src="' + url + '"';
+						});
+
+						// Wrap text contents
+						if (tinymce.trim(text)) {
+							codeBlocks.push(trim(text));
+							text = '<!--\nMCE_SCRIPT:' + (codeBlocks.length - 1) + '\n// -->';
+						}
+
+						return '<mce:script' + attribs + '>' + text + '</mce:script>';
+					});
+
+					// Wrap style elements
+					h = h.replace(/<style([^>]+|)>([\s\S]*?)<\/style>/gi, function(v, attribs, text) {
+						// Wrap text contents
+						if (text) {
+							codeBlocks.push(trim(text));
+							text = '<!--\nMCE_SCRIPT:' + (codeBlocks.length - 1) + '\n-->';
+						}
+
+						return '<mce:style' + attribs + '>' + text + '</mce:style><style ' + attribs + ' _mce_bogus="1">' + text + '</style>';
+					});
+
+					// Wrap noscript elements
+					h = h.replace(/<noscript([^>]+|)>([\s\S]*?)<\/noscript>/g, function(v, attribs, text) {
+						return '<mce:noscript' + attribs + '><!--' + t.encode(text).replace(/--/g, '&#45;&#45;') + '--></mce:noscript>';
+					});
 				}
 
-				// MSIE custom key handling
-				if (tinyMCE.isIE && tinyMCE.settings.custom_undo_redo) {
-					keys = [8, 46]; // Backspace,Delete
+				h = h.replace(/<!\[CDATA\[([\s\S]+)\]\]>/g, '<!--[CDATA[$1]]-->');
 
-					for (i=0; i<keys.length; i++) {
-						if (keys[i] == e.keyCode) {
-							if (e.type == "keyup")
-								tinyMCE.triggerNodeChange(false);
+				// This function processes the attributes in the HTML string to force boolean
+				// attributes to the attr="attr" format and convert style, src and href to _mce_ versions
+				function processTags(html) {
+					return html.replace(tagRegExp, function(match, elm_name, attrs, end) {
+						return '<' + elm_name + attrs.replace(attrRegExp, function(match, name, value, val2, val3) {
+							var mceValue;
+
+							name = name.toLowerCase();
+							value = value || val2 || val3 || "";
+
+							// Treat boolean attributes
+							if (boolAttrs[name]) {
+								// false or 0 is treated as a missing attribute
+								if (value === 'false' || value === '0')
+									return;
+
+								return name + '="' + name + '"';
+							}
+
+							// Is attribute one that needs special treatment
+							if (mceAttribs[name] && attrs.indexOf('_mce_' + name) == -1) {
+								mceValue = t.decode(value);
+
+								// Convert URLs to relative/absolute ones
+								if (s.url_converter && (name == "src" || name == "href"))
+									mceValue = s.url_converter.call(s.url_converter_scope || t, mceValue, name, elm_name);
+
+								// Process styles lowercases them and compresses them
+								if (name == 'style')
+									mceValue = t.serializeStyle(t.parseStyle(mceValue), name);
+
+								return name + '="' + value + '"' + ' _mce_' + name + '="' + t.encode(mceValue) + '"';
+							}
+
+							return match;
+						}) + end + '>';
+					});
+				};
+
+				h = processTags(h);
+
+				// Restore script blocks
+				h = h.replace(/MCE_SCRIPT:([0-9]+)/g, function(val, idx) {
+					return codeBlocks[idx];
+				});
+			}
+
+			return h;
+		},
+
+		getOuterHTML : function(e) {
+			var d;
+
+			e = this.get(e);
+
+			if (!e)
+				return null;
+
+			if (e.outerHTML !== undefined)
+				return e.outerHTML;
+
+			d = (e.ownerDocument || this.doc).createElement("body");
+			d.appendChild(e.cloneNode(true));
+
+			return d.innerHTML;
+		},
+
+		setOuterHTML : function(e, h, d) {
+			var t = this;
+
+			function setHTML(e, h, d) {
+				var n, tp;
+
+				tp = d.createElement("body");
+				tp.innerHTML = h;
+
+				n = tp.lastChild;
+				while (n) {
+					t.insertAfter(n.cloneNode(true), e);
+					n = n.previousSibling;
+				}
+
+				t.remove(e);
+			};
+
+			return this.run(e, function(e) {
+				e = t.get(e);
+
+				// Only set HTML on elements
+				if (e.nodeType == 1) {
+					d = d || e.ownerDocument || t.doc;
+
+					if (isIE) {
+						try {
+							// Try outerHTML for IE it sometimes produces an unknown runtime error
+							if (isIE && e.nodeType == 1)
+								e.outerHTML = h;
+							else
+								setHTML(e, h, d);
+						} catch (ex) {
+							// Fix for unknown runtime error
+							setHTML(e, h, d);
 						}
-					}
+					} else
+						setHTML(e, h, d);
 				}
+			});
+		},
 
-				// If Ctrl key
-				if (e.keyCode == 17)
-					return true;
+		decode : function(s) {
+			var e, n, v;
 
-				// Handle Undo/Redo when typing content
+			// Look for entities to decode
+			if (/&[\w#]+;/.test(s)) {
+				// Decode the entities using a div element not super efficient but less code
+				e = this.doc.createElement("div");
+				e.innerHTML = s;
+				n = e.firstChild;
+				v = '';
 
-				if (tinyMCE.isGecko) {
-					// Start typing (not a position key or ctrl key, but ctrl+x and ctrl+p is ok)
-					if (!posKey && e.type == "keyup" && !e.ctrlKey || (e.ctrlKey && (e.keyCode == 86 || e.keyCode == 88)))
-						tinyMCE.execCommand("mceStartTyping");
-				} else {
-					// IE seems to be working better with this setting
-					if (!posKey && e.type == "keyup")
-						tinyMCE.execCommand("mceStartTyping");
+				if (n) {
+					do {
+						v += n.nodeValue;
+					} while (n = n.nextSibling);
 				}
 
-				// Store undo bookmark
-				if (e.type == "keydown" && (posKey || e.ctrlKey) && inst)
-					inst.undoBookmark = inst.selection.getBookmark();
+				return v || s;
+			}
 
-				// End typing (position key) or some Ctrl event
-				if (e.type == "keyup" && (posKey || e.ctrlKey))
-					tinyMCE.execCommand("mceEndTyping");
+			return s;
+		},
 
-				if (posKey && e.type == "keyup")
-					tinyMCE.triggerNodeChange(false);
+		encode : function(str) {
+			return ('' + str).replace(encodeCharsRe, function(chr) {
+				return encodedChars[chr];
+			});
+		},
 
-				if (tinyMCE.isIE && e.ctrlKey)
-					window.setTimeout('tinyMCE.triggerNodeChange(false);', 1);
-			break;
+		insertAfter : function(node, reference_node) {
+			reference_node = this.get(reference_node);
 
-			case "mousedown":
-			case "mouseup":
-			case "click":
-			case "dblclick":
-			case "focus":
-				tinyMCE.hideMenus();
+			return this.run(node, function(node) {
+				var parent, nextSibling;
 
-				if (tinyMCE.selectedInstance) {
-					tinyMCE.selectedInstance.switchSettings();
-					tinyMCE.selectedInstance.isFocused = true;
+				parent = reference_node.parentNode;
+				nextSibling = reference_node.nextSibling;
+
+				if (nextSibling)
+					parent.insertBefore(node, nextSibling);
+				else
+					parent.appendChild(node);
+
+				return node;
+			});
+		},
+
+		isBlock : function(n) {
+			if (n.nodeType && n.nodeType !== 1)
+				return false;
+
+			n = n.nodeName || n;
+
+			return blockRe.test(n);
+		},
+
+		replace : function(n, o, k) {
+			var t = this;
+
+			if (is(o, 'array'))
+				n = n.cloneNode(true);
+
+			return t.run(o, function(o) {
+				if (k) {
+					each(tinymce.grep(o.childNodes), function(c) {
+						n.appendChild(c);
+					});
 				}
 
-				// Check instance event trigged on
-				var targetBody = tinyMCE.getParentElement(e.target, "html");
-				for (var instanceName in tinyMCE.instances) {
-					if (!tinyMCE.isInstance(tinyMCE.instances[instanceName]))
-						continue;
+				return o.parentNode.replaceChild(n, o);
+			});
+		},
 
-					inst = tinyMCE.instances[instanceName];
+		rename : function(elm, name) {
+			var t = this, newElm;
 
-					// Reset design mode if lost (on everything just in case)
-					inst.autoResetDesignMode();
+			if (elm.nodeName != name.toUpperCase()) {
+				// Rename block element
+				newElm = t.create(name);
 
-					// Use HTML element since users might click outside of body element
-					if (inst.getBody().parentNode == targetBody) {
-						inst.select();
-						tinyMCE.selectedElement = e.target;
-						tinyMCE.linkElement = tinyMCE.getParentElement(tinyMCE.selectedElement, "a");
-						tinyMCE.imgElement = tinyMCE.getParentElement(tinyMCE.selectedElement, "img");
-						break;
+				// Copy attribs to new block
+				each(t.getAttribs(elm), function(attr_node) {
+					t.setAttrib(newElm, attr_node.nodeName, t.getAttrib(elm, attr_node.nodeName));
+				});
+
+				// Replace block
+				t.replace(newElm, elm, 1);
+			}
+
+			return newElm || elm;
+		},
+
+		findCommonAncestor : function(a, b) {
+			var ps = a, pe;
+
+			while (ps) {
+				pe = b;
+
+				while (pe && ps != pe)
+					pe = pe.parentNode;
+
+				if (ps == pe)
+					break;
+
+				ps = ps.parentNode;
+			}
+
+			if (!ps && a.ownerDocument)
+				return a.ownerDocument.documentElement;
+
+			return ps;
+		},
+
+		toHex : function(s) {
+			var c = /^\s*rgb\s*?\(\s*?([0-9]+)\s*?,\s*?([0-9]+)\s*?,\s*?([0-9]+)\s*?\)\s*$/i.exec(s);
+
+			function hex(s) {
+				s = parseInt(s).toString(16);
+
+				return s.length > 1 ? s : '0' + s; // 0 -> 00
+			};
+
+			if (c) {
+				s = '#' + hex(c[1]) + hex(c[2]) + hex(c[3]);
+
+				return s;
+			}
+
+			return s;
+		},
+
+		getClasses : function() {
+			var t = this, cl = [], i, lo = {}, f = t.settings.class_filter, ov;
+
+			if (t.classes)
+				return t.classes;
+
+			function addClasses(s) {
+				// IE style imports
+				each(s.imports, function(r) {
+					addClasses(r);
+				});
+
+				each(s.cssRules || s.rules, function(r) {
+					// Real type or fake it on IE
+					switch (r.type || 1) {
+						// Rule
+						case 1:
+							if (r.selectorText) {
+								each(r.selectorText.split(','), function(v) {
+									v = v.replace(/^\s*|\s*$|^\s\./g, "");
+
+									// Is internal or it doesn't contain a class
+									if (/\.mce/.test(v) || !/\.[\w\-]+$/.test(v))
+										return;
+
+									// Remove everything but class name
+									ov = v;
+									v = v.replace(/.*\.([a-z0-9_\-]+).*/i, '$1');
+
+									// Filter classes
+									if (f && !(v = f(v, ov)))
+										return;
+
+									if (!lo[v]) {
+										cl.push({'class' : v});
+										lo[v] = 1;
+									}
+								});
+							}
+							break;
+
+						// Import
+						case 3:
+							addClasses(r.styleSheet);
+							break;
 					}
-				}
+				});
+			};
 
-				// Add first bookmark location
-				if (!tinyMCE.selectedInstance.undoRedo.undoLevels[0].bookmark && (e.type == "mouseup" || e.type == "dblclick"))
-					tinyMCE.selectedInstance.undoRedo.undoLevels[0].bookmark = tinyMCE.selectedInstance.selection.getBookmark();
+			try {
+				each(t.doc.styleSheets, addClasses);
+			} catch (ex) {
+				// Ignore
+			}
 
-				// Reset selected node
-				if (e.type != "focus")
-					tinyMCE.selectedNode = null;
+			if (cl.length > 0)
+				t.classes = cl;
 
-				tinyMCE.triggerNodeChange(false);
-				tinyMCE.execCommand("mceEndTyping");
+			return cl;
+		},
 
-				if (e.type == "mouseup")
-					tinyMCE.execCommand("mceAddUndoLevel");
+		run : function(e, f, s) {
+			var t = this, o;
 
-				// Just in case
-				if (!tinyMCE.selectedInstance && e.target.editorId)
-					tinyMCE.instances[e.target.editorId].select();
+			if (t.doc && typeof(e) === 'string')
+				e = t.get(e);
 
+			if (!e)
 				return false;
-		}
-	},
 
-	getButtonHTML : function(id, lang, img, cmd, ui, val) {
-		var h = '', m, x, io = '';
+			s = s || this;
+			if (!e.nodeType && (e.length || e.length === 0)) {
+				o = [];
 
-		cmd = 'tinyMCE.execInstanceCommand(\'{$editor_id}\',\'' + cmd + '\'';
+				each(e, function(e, i) {
+					if (e) {
+						if (typeof(e) == 'string')
+							e = t.doc.getElementById(e);
 
-		if (typeof(ui) != "undefined" && ui != null)
-			cmd += ',' + ui;
+						o.push(f.call(s, e, i));
+					}
+				});
 
-		if (typeof(val) != "undefined" && val != null)
-			cmd += ",'" + val + "'";
+				return o;
+			}
 
-		cmd += ');';
+			return f.call(s, e);
+		},
 
-		// Patch for IE7 bug with hover out not restoring correctly
-		if (tinyMCE.isRealIE)
-			io = 'onmouseover="tinyMCE.lastHover = this;"';
+		getAttribs : function(n) {
+			var o;
 
-		// Use tilemaps when enabled and found and never in MSIE since it loads the tile each time from cache if cahce is disabled
-		if (tinyMCE.getParam('button_tile_map') && (!tinyMCE.isIE || tinyMCE.isOpera) && (m = this.buttonMap[id]) != null && (tinyMCE.getParam("language") == "en" || img.indexOf('$lang') == -1)) {
-			// Tiled button
-			x = 0 - (m * 20) == 0 ? '0' : 0 - (m * 20);
-			h += '<a id="{$editor_id}_' + id + '" href="javascript:' + cmd + '" onclick="' + cmd + 'return false;" onmousedown="return false;" ' + io + ' class="mceTiledButton mceButtonNormal" target="_self">';
-			h += '<img src="{$themeurl}/images/spacer.gif" style="background-position: ' + x + 'px 0" alt="{$'+lang+'}" title="{$' + lang + '}" />';
-			h += '</a>';
-		} else {
-			// Normal button
-			h += '<a id="{$editor_id}_' + id + '" href="javascript:' + cmd + '" onclick="' + cmd + 'return false;" onmousedown="return false;" ' + io + ' class="mceButtonNormal" target="_self">';
-			h += '<img src="' + img + '" alt="{$'+lang+'}" title="{$' + lang + '}" />';
-			h += '</a>';
-		}
+			n = this.get(n);
 
-		return h;
-	},
+			if (!n)
+				return [];
 
-	getMenuButtonHTML : function(id, lang, img, mcmd, cmd, ui, val) {
-		var h = '', m, x;
+			if (isIE) {
+				o = [];
 
-		mcmd = 'tinyMCE.execInstanceCommand(\'{$editor_id}\',\'' + mcmd + '\');';
-		cmd = 'tinyMCE.execInstanceCommand(\'{$editor_id}\',\'' + cmd + '\'';
+				// Object will throw exception in IE
+				if (n.nodeName == 'OBJECT')
+					return n.attributes;
 
-		if (typeof(ui) != "undefined" && ui != null)
-			cmd += ',' + ui;
+				// IE doesn't keep the selected attribute if you clone option elements
+				if (n.nodeName === 'OPTION' && this.getAttrib(n, 'selected'))
+					o.push({specified : 1, nodeName : 'selected'});
 
-		if (typeof(val) != "undefined" && val != null)
-			cmd += ",'" + val + "'";
+				// It's crazy that this is faster in IE but it's because it returns all attributes all the time
+				n.cloneNode(false).outerHTML.replace(/<\/?[\w:\-]+ ?|=[\"][^\"]+\"|=\'[^\']+\'|=[\w\-]+|>/gi, '').replace(/[\w:\-]+/gi, function(a) {
+					o.push({specified : 1, nodeName : a});
+				});
 
-		cmd += ');';
+				return o;
+			}
 
-		// Use tilemaps when enabled and found and never in MSIE since it loads the tile each time from cache if cahce is disabled
-		if (tinyMCE.getParam('button_tile_map') && (!tinyMCE.isIE || tinyMCE.isOpera) && (m = tinyMCE.buttonMap[id]) != null && (tinyMCE.getParam("language") == "en" || img.indexOf('$lang') == -1)) {
-			x = 0 - (m * 20) == 0 ? '0' : 0 - (m * 20);
+			return n.attributes;
+		},
 
-			if (tinyMCE.isRealIE)
-				h += '<span id="{$editor_id}_' + id + '" class="mceMenuButton" onmouseover="tinyMCE._menuButtonEvent(\'over\',this);tinyMCE.lastHover = this;" onmouseout="tinyMCE._menuButtonEvent(\'out\',this);">';
-			else
-				h += '<span id="{$editor_id}_' + id + '" class="mceMenuButton">';
+		destroy : function(s) {
+			var t = this;
 
-			h += '<a href="javascript:' + cmd + '" onclick="' + cmd + 'return false;" onmousedown="return false;" class="mceTiledButton mceMenuButtonNormal" target="_self">';
-			h += '<img src="{$themeurl}/images/spacer.gif" style="width: 20px; height: 20px; background-position: ' + x + 'px 0" title="{$' + lang + '}" /></a>';
-			h += '<a href="javascript:' + mcmd + '" onclick="' + mcmd + 'return false;" onmousedown="return false;"><img src="{$themeurl}/images/button_menu.gif" title="{$' + lang + '}" class="mceMenuButton" />';
-			h += '</a></span>';
-		} else {
-			if (tinyMCE.isRealIE)
-				h += '<span id="{$editor_id}_' + id + '" dir="ltr" class="mceMenuButton" onmouseover="tinyMCE._menuButtonEvent(\'over\',this);tinyMCE.lastHover = this;" onmouseout="tinyMCE._menuButtonEvent(\'out\',this);">';
-			else
-				h += '<span id="{$editor_id}_' + id + '" dir="ltr" class="mceMenuButton">';
+			if (t.events)
+				t.events.destroy();
 
-			h += '<a href="javascript:' + cmd + '" onclick="' + cmd + 'return false;" onmousedown="return false;" class="mceMenuButtonNormal" target="_self">';
-			h += '<img src="' + img + '" title="{$' + lang + '}" /></a>';
-			h += '<a href="javascript:' + mcmd + '" onclick="' + mcmd + 'return false;" onmousedown="return false;"><img src="{$themeurl}/images/button_menu.gif" title="{$' + lang + '}" class="mceMenuButton" />';
-			h += '</a></span>';
-		}
+			t.win = t.doc = t.root = t.events = null;
 
-		return h;
-	},
+			// Manual destroy then remove unload handler
+			if (!s)
+				tinymce.removeUnload(t.destroy);
+		},
 
-	_menuButtonEvent : function(e, o) {
-		if (o.className == 'mceMenuButtonFocus')
-			return;
+		createRng : function() {
+			var d = this.doc;
 
-		if (e == 'over')
-			o.className = o.className + ' mceMenuHover';
-		else
-			o.className = o.className.replace(/\s.*$/, '');
-	},
+			return d.createRange ? d.createRange() : new tinymce.dom.Range(this);
+		},
 
-	addButtonMap : function(m) {
-		var i, a = m.replace(/\s+/, '').split(',');
+		nodeIndex : function(node, normalized) {
+			var idx = 0, lastNodeType, lastNode, nodeType;
 
-		for (i=0; i<a.length; i++)
-			this.buttonMap[a[i]] = i;
-	},
+			if (node) {
+				for (lastNodeType = node.nodeType, node = node.previousSibling, lastNode = node; node; node = node.previousSibling) {
+					nodeType = node.nodeType;
 
-	formSubmit : function(f, p) {
-		var n, inst, found = false;
+					// Normalize text nodes
+					if (normalized && nodeType == 3) {
+						if (nodeType == lastNodeType || !node.nodeValue.length)
+							continue;
+					}
 
-		if (f.form)
-			f = f.form;
+					idx++;
+					lastNodeType = nodeType;
+				}
+			}
 
-		// Is it a form that has a TinyMCE instance
-		if (tinyMCE.getParam('save_on_tinymce_forms')) {
-			for (n in tinyMCE.instances) {
-				inst = tinyMCE.instances[n];
+			return idx;
+		},
 
-				if (!tinyMCE.isInstance(inst))
-					continue;
+		split : function(pe, e, re) {
+			var t = this, r = t.createRng(), bef, aft, pa;
 
-				if (inst.formElement) {
-					if (f == inst.formElement.form) {
-						found = true;
-						inst.isNotDirty = true;
+			// W3C valid browsers tend to leave empty nodes to the left/right side of the contents, this makes sense
+			// but we don't want that in our code since it serves no purpose for the end user
+			// For example if this is chopped:
+			//   <p>text 1<span><b>CHOP</b></span>text 2</p>
+			// would produce:
+			//   <p>text 1<span></span></p><b>CHOP</b><p><span></span>text 2</p>
+			// this function will then trim of empty edges and produce:
+			//   <p>text 1</p><b>CHOP</b><p>text 2</p>
+			function trim(node) {
+				var i, children = node.childNodes;
+
+				if (node.nodeType == 1 && node.getAttribute('_mce_type') == 'bookmark')
+					return;
+
+				for (i = children.length - 1; i >= 0; i--)
+					trim(children[i]);
+
+				if (node.nodeType != 9) {
+					// Keep non whitespace text nodes
+					if (node.nodeType == 3 && node.nodeValue.length > 0)
+						return;
+
+					if (node.nodeType == 1) {
+						// If the only child is a bookmark then move it up
+						children = node.childNodes;
+						if (children.length == 1 && children[0] && children[0].nodeType == 1 && children[0].getAttribute('_mce_type') == 'bookmark')
+							node.parentNode.insertBefore(children[0], node);
+
+						// Keep non empty elements or img, hr etc
+						if (children.length || /^(br|hr|input|img)$/i.test(node.nodeName))
+							return;
 					}
+
+					t.remove(node);
 				}
+
+				return node;
+			};
+
+			if (pe && e) {
+				// Get before chunk
+				r.setStart(pe.parentNode, t.nodeIndex(pe));
+				r.setEnd(e.parentNode, t.nodeIndex(e));
+				bef = r.extractContents();
+
+				// Get after chunk
+				r = t.createRng();
+				r.setStart(e.parentNode, t.nodeIndex(e) + 1);
+				r.setEnd(pe.parentNode, t.nodeIndex(pe) + 1);
+				aft = r.extractContents();
+
+				// Insert before chunk
+				pa = pe.parentNode;
+				pa.insertBefore(trim(bef), pe);
+
+				// Insert middle chunk
+				if (re)
+					pa.replaceChild(re, e);
+				else
+					pa.insertBefore(e, pe);
+
+				// Insert after chunk
+				pa.insertBefore(trim(aft), pe);
+				t.remove(pe);
+
+				return re || e;
 			}
-		} else
-			found  = true;
+		},
 
-		// Is valid
-		if (found) {
-			tinyMCE.removeTinyMCEFormElements(f);
-			tinyMCE.triggerSave();
-		}
+		bind : function(target, name, func, scope) {
+			var t = this;
 
-		// Is it patched
-		if (f.mceOldSubmit && p)
-			f.mceOldSubmit();
-	},
+			if (!t.events)
+				t.events = new tinymce.dom.EventUtils();
 
-	submitPatch : function() {
-		tinyMCE.formSubmit(this, true);
-	},
+			return t.events.add(target, name, func, scope || this);
+		},
 
-	onLoad : function() {
-		var r, i, c, mode, trigger, elements, element, settings, elementId, elm;
-		var selector, deselector, elementRefAr, form;
+		unbind : function(target, name, func) {
+			var t = this;
 
-		// Wait for everything to be loaded first
-		if (tinyMCE.settings.strict_loading_mode && this.loadingIndex != -1) {
-			window.setTimeout('tinyMCE.onLoad();', 1);
-			return;
+			if (!t.events)
+				t.events = new tinymce.dom.EventUtils();
+
+			return t.events.remove(target, name, func);
+		},
+
+
+		_findSib : function(node, selector, name) {
+			var t = this, f = selector;
+
+			if (node) {
+				// If expression make a function of it using is
+				if (is(f, 'string')) {
+					f = function(node) {
+						return t.is(node, selector);
+					};
+				}
+
+				// Loop all siblings
+				for (node = node[name]; node; node = node[name]) {
+					if (f(node))
+						return node;
+				}
+			}
+
+			return null;
+		},
+
+		_isRes : function(c) {
+			// Is live resizble element
+			return /^(top|left|bottom|right|width|height)/i.test(c) || /;\s*(top|left|bottom|right|width|height)/i.test(c);
 		}
 
-		if (tinyMCE.isRealIE && window.event.type == "readystatechange" && document.readyState != "complete")
-			return true;
+		/*
+		walk : function(n, f, s) {
+			var d = this.doc, w;
 
-		if (tinyMCE.isLoaded)
-			return true;
+			if (d.createTreeWalker) {
+				w = d.createTreeWalker(n, NodeFilter.SHOW_TEXT, null, false);
 
-		tinyMCE.isLoaded = true;
+				while ((n = w.nextNode()) != null)
+					f.call(s || this, n);
+			} else
+				tinymce.walk(n, f, 'childNodes', s);
+		}
+		*/
 
-		// IE produces JS error if TinyMCE is placed in a frame
-		// It seems to have something to do with the selection not beeing
-		// correctly initialized in IE so this hack solves the problem
-		if (tinyMCE.isRealIE && document.body && window.location.href != window.top.location.href) {
-			r = document.body.createTextRange();
-			r.collapse(true);
-			r.select();
+		/*
+		toRGB : function(s) {
+			var c = /^\s*?#([0-9A-F]{2})([0-9A-F]{1,2})([0-9A-F]{2})?\s*?$/.exec(s);
+
+			if (c) {
+				// #FFF -> #FFFFFF
+				if (!is(c[3]))
+					c[3] = c[2] = c[1];
+
+				return "rgb(" + parseInt(c[1], 16) + "," + parseInt(c[2], 16) + "," + parseInt(c[3], 16) + ")";
+			}
+
+			return s;
 		}
+		*/
+	});
 
-		tinyMCE.dispatchCallback(null, 'onpageload', 'onPageLoad');
+	tinymce.DOM = new tinymce.dom.DOMUtils(document, {process_html : 0});
+})(tinymce);
 
-		for (c=0; c<tinyMCE.configs.length; c++) {
-			tinyMCE.settings = tinyMCE.configs[c];
+(function(ns) {
+	// Range constructor
+	function Range(dom) {
+		var t = this,
+			doc = dom.doc,
+			EXTRACT = 0,
+			CLONE = 1,
+			DELETE = 2,
+			TRUE = true,
+			FALSE = false,
+			START_OFFSET = 'startOffset',
+			START_CONTAINER = 'startContainer',
+			END_CONTAINER = 'endContainer',
+			END_OFFSET = 'endOffset',
+			extend = tinymce.extend,
+			nodeIndex = dom.nodeIndex;
 
-			selector = tinyMCE.getParam("editor_selector");
-			deselector = tinyMCE.getParam("editor_deselector");
-			elementRefAr = [];
+		extend(t, {
+			// Inital states
+			startContainer : doc,
+			startOffset : 0,
+			endContainer : doc,
+			endOffset : 0,
+			collapsed : TRUE,
+			commonAncestorContainer : doc,
 
-			// Add submit triggers
-			if (document.forms && tinyMCE.settings.add_form_submit_trigger && !tinyMCE.submitTriggers) {
-				for (i=0; i<document.forms.length; i++) {
-					form = document.forms[i];
+			// Range constants
+			START_TO_START : 0,
+			START_TO_END : 1,
+			END_TO_END : 2,
+			END_TO_START : 3,
 
-					tinyMCE.addEvent(form, "submit", TinyMCE_Engine.prototype.handleEvent);
-					tinyMCE.addEvent(form, "reset", TinyMCE_Engine.prototype.handleEvent);
-					tinyMCE.submitTriggers = true; // Do it only once
+			// Public methods
+			setStart : setStart,
+			setEnd : setEnd,
+			setStartBefore : setStartBefore,
+			setStartAfter : setStartAfter,
+			setEndBefore : setEndBefore,
+			setEndAfter : setEndAfter,
+			collapse : collapse,
+			selectNode : selectNode,
+			selectNodeContents : selectNodeContents,
+			compareBoundaryPoints : compareBoundaryPoints,
+			deleteContents : deleteContents,
+			extractContents : extractContents,
+			cloneContents : cloneContents,
+			insertNode : insertNode,
+			surroundContents : surroundContents,
+			cloneRange : cloneRange
+		});
 
-					// Patch the form.submit function
-					if (tinyMCE.settings.submit_patch) {
-						try {
-							form.mceOldSubmit = form.submit;
-							form.submit = TinyMCE_Engine.prototype.submitPatch;
-						} catch (e) {
-							// Do nothing
-						}
-					}
+		function setStart(n, o) {
+			_setEndPoint(TRUE, n, o);
+		};
+
+		function setEnd(n, o) {
+			_setEndPoint(FALSE, n, o);
+		};
+
+		function setStartBefore(n) {
+			setStart(n.parentNode, nodeIndex(n));
+		};
+
+		function setStartAfter(n) {
+			setStart(n.parentNode, nodeIndex(n) + 1);
+		};
+
+		function setEndBefore(n) {
+			setEnd(n.parentNode, nodeIndex(n));
+		};
+
+		function setEndAfter(n) {
+			setEnd(n.parentNode, nodeIndex(n) + 1);
+		};
+
+		function collapse(ts) {
+			if (ts) {
+				t[END_CONTAINER] = t[START_CONTAINER];
+				t[END_OFFSET] = t[START_OFFSET];
+			} else {
+				t[START_CONTAINER] = t[END_CONTAINER];
+				t[START_OFFSET] = t[END_OFFSET];
+			}
+
+			t.collapsed = TRUE;
+		};
+
+		function selectNode(n) {
+			setStartBefore(n);
+			setEndAfter(n);
+		};
+
+		function selectNodeContents(n) {
+			setStart(n, 0);
+			setEnd(n, n.nodeType === 1 ? n.childNodes.length : n.nodeValue.length);
+		};
+
+		function compareBoundaryPoints(h, r) {
+			var sc = t[START_CONTAINER], so = t[START_OFFSET], ec = t[END_CONTAINER], eo = t[END_OFFSET];
+
+			// Check START_TO_START
+			if (h === 0)
+				return _compareBoundaryPoints(sc, so, sc, so);
+
+			// Check START_TO_END
+			if (h === 1)
+				return _compareBoundaryPoints(sc, so, ec, eo);
+
+			// Check END_TO_END
+			if (h === 2)
+				return _compareBoundaryPoints(ec, eo, ec, eo);
+
+			// Check END_TO_START
+			if (h === 3)
+				return _compareBoundaryPoints(ec, eo, sc, so);
+		};
+
+		function deleteContents() {
+			_traverse(DELETE);
+		};
+
+		function extractContents() {
+			return _traverse(EXTRACT);
+		};
+
+		function cloneContents() {
+			return _traverse(CLONE);
+		};
+
+		function insertNode(n) {
+			var startContainer = this[START_CONTAINER],
+				startOffset = this[START_OFFSET], nn, o;
+
+			// Node is TEXT_NODE or CDATA
+			if ((startContainer.nodeType === 3 || startContainer.nodeType === 4) && startContainer.nodeValue) {
+				if (!startOffset) {
+					// At the start of text
+					startContainer.parentNode.insertBefore(n, startContainer);
+				} else if (startOffset >= startContainer.nodeValue.length) {
+					// At the end of text
+					dom.insertAfter(n, startContainer);
+				} else {
+					// Middle, need to split
+					nn = startContainer.splitText(startOffset);
+					startContainer.parentNode.insertBefore(n, nn);
 				}
+			} else {
+				// Insert element node
+				if (startContainer.childNodes.length > 0)
+					o = startContainer.childNodes[startOffset];
+
+				if (o)
+					startContainer.insertBefore(n, o);
+				else
+					startContainer.appendChild(n);
 			}
+		};
 
-			// Add editor instances based on mode
-			mode = tinyMCE.settings.mode;
-			switch (mode) {
-				case "exact":
-					elements = tinyMCE.getParam('elements', '', true, ',');
+		function surroundContents(n) {
+			var f = t.extractContents();
 
-					for (i=0; i<elements.length; i++) {
-						element = tinyMCE._getElementById(elements[i]);
-						trigger = element ? element.getAttribute(tinyMCE.settings.textarea_trigger) : "";
+			t.insertNode(n);
+			n.appendChild(f);
+			t.selectNode(n);
+		};
 
-						if (new RegExp('\\b' + deselector + '\\b').test(tinyMCE.getAttrib(element, "class")))
-							continue;
+		function cloneRange() {
+			return extend(new Range(dom), {
+				startContainer : t[START_CONTAINER],
+				startOffset : t[START_OFFSET],
+				endContainer : t[END_CONTAINER],
+				endOffset : t[END_OFFSET],
+				collapsed : t.collapsed,
+				commonAncestorContainer : t.commonAncestorContainer
+			});
+		};
 
-						if (trigger == "false")
-							continue;
+		// Private methods
 
-						if ((tinyMCE.settings.ask || tinyMCE.settings.convert_on_click) && element) {
-							elementRefAr[elementRefAr.length] = element;
-							continue;
-						}
+		function _getSelectedNode(container, offset) {
+			var child;
 
-						if (element)
-							tinyMCE.addMCEControl(element, elements[i]);
-					}
-				break;
+			if (container.nodeType == 3 /* TEXT_NODE */)
+				return container;
 
-				case "specific_textareas":
-				case "textareas":
-					elements = document.getElementsByTagName("textarea");
+			if (offset < 0)
+				return container;
 
-					for (i=0; i<elements.length; i++) {
-						elm = elements.item(i);
-						trigger = elm.getAttribute(tinyMCE.settings.textarea_trigger);
+			child = container.firstChild;
+			while (child && offset > 0) {
+				--offset;
+				child = child.nextSibling;
+			}
 
-						if (selector !== '' && !new RegExp('\\b' + selector + '\\b').test(tinyMCE.getAttrib(elm, "class")))
-							continue;
+			if (child)
+				return child;
 
-						if (selector !== '')
-							trigger = selector !== '' ? "true" : "";
+			return container;
+		};
 
-						if (new RegExp('\\b' + deselector + '\\b').test(tinyMCE.getAttrib(elm, "class")))
-							continue;
+		function _isCollapsed() {
+			return (t[START_CONTAINER] == t[END_CONTAINER] && t[START_OFFSET] == t[END_OFFSET]);
+		};
 
-						if ((mode == "specific_textareas" && trigger == "true") || (mode == "textareas" && trigger != "false"))
-							elementRefAr[elementRefAr.length] = elm;
-					}
-				break;
+		function _compareBoundaryPoints(containerA, offsetA, containerB, offsetB) {
+			var c, offsetC, n, cmnRoot, childA, childB;
+
+			// In the first case the boundary-points have the same container. A is before B
+			// if its offset is less than the offset of B, A is equal to B if its offset is
+			// equal to the offset of B, and A is after B if its offset is greater than the
+			// offset of B.
+			if (containerA == containerB) {
+				if (offsetA == offsetB)
+					return 0; // equal
+
+				if (offsetA < offsetB)
+					return -1; // before
+
+				return 1; // after
 			}
 
-			for (i=0; i<elementRefAr.length; i++) {
-				element = elementRefAr[i];
-				elementId = element.name ? element.name : element.id;
+			// In the second case a child node C of the container of A is an ancestor
+			// container of B. In this case, A is before B if the offset of A is less than or
+			// equal to the index of the child node C and A is after B otherwise.
+			c = containerB;
+			while (c && c.parentNode != containerA)
+				c = c.parentNode;
 
-				if (tinyMCE.settings.ask || tinyMCE.settings.convert_on_click) {
-					// Focus breaks in Mozilla
-					if (tinyMCE.isGecko) {
-						settings = tinyMCE.settings;
+			if (c) {
+				offsetC = 0;
+				n = containerA.firstChild;
 
-						tinyMCE.addEvent(element, "focus", function (e) {window.setTimeout(function() {TinyMCE_Engine.prototype.confirmAdd(e, settings);}, 10);});
+				while (n != c && offsetC < offsetA) {
+					offsetC++;
+					n = n.nextSibling;
+				}
 
-						if (element.nodeName != "TEXTAREA" && element.nodeName != "INPUT")
-							tinyMCE.addEvent(element, "click", function (e) {window.setTimeout(function() {TinyMCE_Engine.prototype.confirmAdd(e, settings);}, 10);});
-						// tinyMCE.addEvent(element, "mouseover", function (e) {window.setTimeout(function() {TinyMCE_Engine.prototype.confirmAdd(e, settings);}, 10);});
-					} else {
-						settings = tinyMCE.settings;
+				if (offsetA <= offsetC)
+					return -1; // before
 
-						tinyMCE.addEvent(element, "focus", function () { TinyMCE_Engine.prototype.confirmAdd(null, settings); });
-						tinyMCE.addEvent(element, "click", function () { TinyMCE_Engine.prototype.confirmAdd(null, settings); });
-						// tinyMCE.addEvent(element, "mouseenter", function () { TinyMCE_Engine.prototype.confirmAdd(null, settings); });
-					}
-				} else
-					tinyMCE.addMCEControl(element, elementId);
+				return 1; // after
 			}
 
-			// Handle auto focus
-			if (tinyMCE.settings.auto_focus) {
-				window.setTimeout(function () {
-					var inst = tinyMCE.getInstanceById(tinyMCE.settings.auto_focus);
-					inst.selection.selectNode(inst.getBody(), true, true);
-					inst.contentWindow.focus();
-				}, 100);
+			// In the third case a child node C of the container of B is an ancestor container
+			// of A. In this case, A is before B if the index of the child node C is less than
+			// the offset of B and A is after B otherwise.
+			c = containerA;
+			while (c && c.parentNode != containerB) {
+				c = c.parentNode;
 			}
 
-			tinyMCE.dispatchCallback(null, 'oninit', 'onInit');
-		}
-	},
+			if (c) {
+				offsetC = 0;
+				n = containerB.firstChild;
 
-	isInstance : function(o) {
-		return o != null && typeof(o) == "object" && o.isTinyMCE_Control;
-	},
+				while (n != c && offsetC < offsetB) {
+					offsetC++;
+					n = n.nextSibling;
+				}
 
-	getParam : function(name, default_value, strip_whitespace, split_chr) {
-		var i, outArray, value = (typeof(this.settings[name]) == "undefined") ? default_value : this.settings[name];
+				if (offsetC < offsetB)
+					return -1; // before
 
-		// Fix bool values
-		if (value == "true" || value == "false")
-			return (value == "true");
+				return 1; // after
+			}
 
-		if (strip_whitespace)
-			value = tinyMCE.regexpReplace(value, "[ \t\r\n]", "");
+			// In the fourth case, none of three other cases hold: the containers of A and B
+			// are siblings or descendants of sibling nodes. In this case, A is before B if
+			// the container of A is before the container of B in a pre-order traversal of the
+			// Ranges' context tree and A is after B otherwise.
+			cmnRoot = dom.findCommonAncestor(containerA, containerB);
+			childA = containerA;
 
-		if (typeof(split_chr) != "undefined" && split_chr != null) {
-			value = value.split(split_chr);
-			outArray = [];
+			while (childA && childA.parentNode != cmnRoot)
+				childA = childA.parentNode;
 
-			for (i=0; i<value.length; i++) {
-				if (value[i] && value[i] !== '')
-					outArray[outArray.length] = value[i];
+			if (!childA)
+				childA = cmnRoot;
+
+			childB = containerB;
+			while (childB && childB.parentNode != cmnRoot)
+				childB = childB.parentNode;
+
+			if (!childB)
+				childB = cmnRoot;
+
+			if (childA == childB)
+				return 0; // equal
+
+			n = cmnRoot.firstChild;
+			while (n) {
+				if (n == childA)
+					return -1; // before
+
+				if (n == childB)
+					return 1; // after
+
+				n = n.nextSibling;
 			}
+		};
 
-			value = outArray;
-		}
+		function _setEndPoint(st, n, o) {
+			var ec, sc;
 
-		return value;
-	},
+			if (st) {
+				t[START_CONTAINER] = n;
+				t[START_OFFSET] = o;
+			} else {
+				t[END_CONTAINER] = n;
+				t[END_OFFSET] = o;
+			}
 
-	getLang : function(name, default_value, parse_entities, va) {
-		var v = (typeof(tinyMCELang[name]) == "undefined") ? default_value : tinyMCELang[name], n;
+			// If one boundary-point of a Range is set to have a root container
+			// other than the current one for the Range, the Range is collapsed to
+			// the new position. This enforces the restriction that both boundary-
+			// points of a Range must have the same root container.
+			ec = t[END_CONTAINER];
+			while (ec.parentNode)
+				ec = ec.parentNode;
 
-		if (parse_entities)
-			v = tinyMCE.entityDecode(v);
+			sc = t[START_CONTAINER];
+			while (sc.parentNode)
+				sc = sc.parentNode;
 
-		if (va) {
-			for (n in va)
-				v = this.replaceVar(v, n, va[n]);
-		}
+			if (sc == ec) {
+				// The start position of a Range is guaranteed to never be after the
+				// end position. To enforce this restriction, if the start is set to
+				// be at a position after the end, the Range is collapsed to that
+				// position.
+				if (_compareBoundaryPoints(t[START_CONTAINER], t[START_OFFSET], t[END_CONTAINER], t[END_OFFSET]) > 0)
+					t.collapse(st);
+			} else
+				t.collapse(st);
 
-		return v;
-	},
+			t.collapsed = _isCollapsed();
+			t.commonAncestorContainer = dom.findCommonAncestor(t[START_CONTAINER], t[END_CONTAINER]);
+		};
 
-	entityDecode : function(s) {
-		var e = document.createElement("div");
+		function _traverse(how) {
+			var c, endContainerDepth = 0, startContainerDepth = 0, p, depthDiff, startNode, endNode, sp, ep;
 
-		e.innerHTML = s;
+			if (t[START_CONTAINER] == t[END_CONTAINER])
+				return _traverseSameContainer(how);
 
-		return !e.firstChild ? s : e.firstChild.nodeValue;
-	},
+			for (c = t[END_CONTAINER], p = c.parentNode; p; c = p, p = p.parentNode) {
+				if (p == t[START_CONTAINER])
+					return _traverseCommonStartContainer(c, how);
 
-	addToLang : function(prefix, ar) {
-		var k;
+				++endContainerDepth;
+			}
 
-		for (k in ar) {
-			if (typeof(ar[k]) == 'function')
-				continue;
+			for (c = t[START_CONTAINER], p = c.parentNode; p; c = p, p = p.parentNode) {
+				if (p == t[END_CONTAINER])
+					return _traverseCommonEndContainer(c, how);
 
-			tinyMCELang[(k.indexOf('lang_') == -1 ? 'lang_' : '') + (prefix !== '' ? (prefix + "_") : '') + k] = ar[k];
-		}
+				++startContainerDepth;
+			}
 
-		this.loadNextScript();
-	},
+			depthDiff = startContainerDepth - endContainerDepth;
 
-	triggerNodeChange : function(focus, setup_content) {
-		var elm, inst, editorId, undoIndex = -1, undoLevels = -1, doc, anySelection, st;
+			startNode = t[START_CONTAINER];
+			while (depthDiff > 0) {
+				startNode = startNode.parentNode;
+				depthDiff--;
+			}
 
-		if (tinyMCE.selectedInstance) {
-			inst = tinyMCE.selectedInstance;
-			elm = (typeof(setup_content) != "undefined" && setup_content) ? tinyMCE.selectedElement : inst.getFocusElement();
+			endNode = t[END_CONTAINER];
+			while (depthDiff < 0) {
+				endNode = endNode.parentNode;
+				depthDiff++;
+			}
 
-/*			if (elm == inst.lastTriggerEl)
-				return;
+			// ascend the ancestor hierarchy until we have a common parent.
+			for (sp = startNode.parentNode, ep = endNode.parentNode; sp != ep; sp = sp.parentNode, ep = ep.parentNode) {
+				startNode = sp;
+				endNode = ep;
+			}
 
-			inst.lastTriggerEl = elm;*/
+			return _traverseCommonAncestors(startNode, endNode, how);
+		};
 
-			editorId = inst.editorId;
-			st = inst.selection.getSelectedText();
+		 function _traverseSameContainer(how) {
+			var frag, s, sub, n, cnt, sibling, xferNode;
 
-			if (tinyMCE.settings.auto_resize)
-				inst.resizeToContent();
+			if (how != DELETE)
+				frag = doc.createDocumentFragment();
 
-			if (setup_content && tinyMCE.isGecko && inst.isHidden())
-				elm = inst.getBody();
+			// If selection is empty, just return the fragment
+			if (t[START_OFFSET] == t[END_OFFSET])
+				return frag;
 
-			inst.switchSettings();
-			anySelection = !inst.selection.isCollapsed();
+			// Text node needs special case handling
+			if (t[START_CONTAINER].nodeType == 3 /* TEXT_NODE */) {
+				// get the substring
+				s = t[START_CONTAINER].nodeValue;
+				sub = s.substring(t[START_OFFSET], t[END_OFFSET]);
 
-			if (tinyMCE.settings.custom_undo_redo) {
-				undoIndex = inst.undoRedo.undoIndex;
-				undoLevels = inst.undoRedo.undoLevels.length;
+				// set the original text node to its new value
+				if (how != CLONE) {
+					t[START_CONTAINER].deleteData(t[START_OFFSET], t[END_OFFSET] - t[START_OFFSET]);
+
+					// Nothing is partially selected, so collapse to start point
+					t.collapse(TRUE);
+				}
+
+				if (how == DELETE)
+					return;
+
+				frag.appendChild(doc.createTextNode(sub));
+				return frag;
 			}
 
-			tinyMCE.dispatchCallback(inst, 'handle_node_change_callback', 'handleNodeChange', editorId, elm, undoIndex, undoLevels, inst.visualAid, anySelection, setup_content);
-		}
+			// Copy nodes between the start/end offsets.
+			n = _getSelectedNode(t[START_CONTAINER], t[START_OFFSET]);
+			cnt = t[END_OFFSET] - t[START_OFFSET];
 
-		if (this.selectedInstance && (typeof(focus) == "undefined" || focus))
-			this.selectedInstance.contentWindow.focus();
-	},
+			while (cnt > 0) {
+				sibling = n.nextSibling;
+				xferNode = _traverseFullySelected(n, how);
 
-	_customCleanup : function(inst, type, content) {
-		var pl, po, i, customCleanup;
+				if (frag)
+					frag.appendChild( xferNode );
 
-		// Call custom cleanup
-		customCleanup = tinyMCE.settings.cleanup_callback;
-		if (customCleanup != '')
-			content = tinyMCE.resolveDots(tinyMCE.settings.cleanup_callback, window)(type, content, inst);
+				--cnt;
+				n = sibling;
+			}
 
-		// Trigger theme cleanup
-		po = tinyMCE.themes[tinyMCE.settings.theme];
-		if (po && po.cleanup)
-			content = po.cleanup(type, content, inst);
+			// Nothing is partially selected, so collapse to start point
+			if (how != CLONE)
+				t.collapse(TRUE);
 
-		// Trigger plugin cleanups
-		pl = inst.plugins;
-		for (i=0; i<pl.length; i++) {
-			po = tinyMCE.plugins[pl[i]];
+			return frag;
+		};
 
-			if (po && po.cleanup)
-				content = po.cleanup(type, content, inst);
-		}
+		function _traverseCommonStartContainer(endAncestor, how) {
+			var frag, n, endIdx, cnt, sibling, xferNode;
 
-		return content;
-	},
+			if (how != DELETE)
+				frag = doc.createDocumentFragment();
 
-	setContent : function(h) {
-		if (tinyMCE.selectedInstance) {
-			tinyMCE.selectedInstance.execCommand('mceSetContent', false, h);
-			tinyMCE.selectedInstance.repaint();
-		}
-	},
+			n = _traverseRightBoundary(endAncestor, how);
 
-	importThemeLanguagePack : function(name) {
-		if (typeof(name) == "undefined")
-			name = tinyMCE.settings.theme;
+			if (frag)
+				frag.appendChild(n);
 
-		tinyMCE.loadScript(tinyMCE.baseURL + '/themes/' + name + '/langs/' + tinyMCE.settings.language + '.js');
-	},
+			endIdx = nodeIndex(endAncestor);
+			cnt = endIdx - t[START_OFFSET];
 
-	importPluginLanguagePack : function(name) {
-		var b = tinyMCE.baseURL + '/plugins/' + name;
+			if (cnt <= 0) {
+				// Collapse to just before the endAncestor, which
+				// is partially selected.
+				if (how != CLONE) {
+					t.setEndBefore(endAncestor);
+					t.collapse(FALSE);
+				}
 
-		if (this.plugins[name])
-			b = this.plugins[name].baseURL;
+				return frag;
+			}
 
-		tinyMCE.loadScript(b + '/langs/' + tinyMCE.settings.language +  '.js');
-	},
+			n = endAncestor.previousSibling;
+			while (cnt > 0) {
+				sibling = n.previousSibling;
+				xferNode = _traverseFullySelected(n, how);
 
-	applyTemplate : function(h, ag) {
-		return h.replace(new RegExp('\\{\\$([a-z0-9_]+)\\}', 'gi'), function(m, s) {
-			if (s.indexOf('lang_') == 0 && tinyMCELang[s])
-				return tinyMCELang[s];
+				if (frag)
+					frag.insertBefore(xferNode, frag.firstChild);
 
-			if (ag && ag[s])
-				return ag[s];
+				--cnt;
+				n = sibling;
+			}
 
-			if (tinyMCE.settings[s])
-				return tinyMCE.settings[s];
+			// Collapse to just before the endAncestor, which
+			// is partially selected.
+			if (how != CLONE) {
+				t.setEndBefore(endAncestor);
+				t.collapse(FALSE);
+			}
 
-			if (m == 'themeurl')
-				return tinyMCE.themeURL;
+			return frag;
+		};
 
-			return m;
-		});
-	},
+		function _traverseCommonEndContainer(startAncestor, how) {
+			var frag, startIdx, n, cnt, sibling, xferNode;
 
-	replaceVar : function(h, r, v) {
-		return h.replace(new RegExp('{\\\$' + r + '}', 'g'), v);
-	},
+			if (how != DELETE)
+				frag = doc.createDocumentFragment();
 
-	openWindow : function(template, args) {
-		var html, width, height, x, y, resizable, scrollbars, url, name, win, modal, features;
+			n = _traverseLeftBoundary(startAncestor, how);
+			if (frag)
+				frag.appendChild(n);
 
-		args = !args ? {} : args;
+			startIdx = nodeIndex(startAncestor);
+			++startIdx;  // Because we already traversed it....
 
-		args.mce_template_file = template.file;
-		args.mce_width = template.width;
-		args.mce_height = template.height;
-		tinyMCE.windowArgs = args;
+			cnt = t[END_OFFSET] - startIdx;
+			n = startAncestor.nextSibling;
+			while (cnt > 0) {
+				sibling = n.nextSibling;
+				xferNode = _traverseFullySelected(n, how);
 
-		html = template.html;
-		if (!(width = parseInt(template.width)))
-			width = 320;
+				if (frag)
+					frag.appendChild(xferNode);
 
-		if (!(height = parseInt(template.height)))
-			height = 200;
+				--cnt;
+				n = sibling;
+			}
 
-		// Add to height in M$ due to SP2 WHY DON'T YOU GUYS IMPLEMENT innerWidth of windows!!
-		if (tinyMCE.isIE)
-			height += 40;
-		else
-			height += 20;
+			if (how != CLONE) {
+				t.setStartAfter(startAncestor);
+				t.collapse(TRUE);
+			}
 
-		x = parseInt(screen.width / 2.0) - (width / 2.0);
-		y = parseInt(screen.height / 2.0) - (height / 2.0);
+			return frag;
+		};
 
-		resizable = (args && args.resizable) ? args.resizable : "no";
-		scrollbars = (args && args.scrollbars) ? args.scrollbars : "no";
+		function _traverseCommonAncestors(startAncestor, endAncestor, how) {
+			var n, frag, commonParent, startOffset, endOffset, cnt, sibling, nextSibling;
 
-		if (template.file.charAt(0) != '/' && template.file.indexOf('://') == -1)
-			url = tinyMCE.baseURL + "/themes/" + tinyMCE.getParam("theme") + "/" + template.file;
-		else
-			url = template.file;
+			if (how != DELETE)
+				frag = doc.createDocumentFragment();
 
-		// Replace all args as variables in URL
-		for (name in args) {
-			if (typeof(args[name]) == 'function')
-				continue;
+			n = _traverseLeftBoundary(startAncestor, how);
+			if (frag)
+				frag.appendChild(n);
 
-			url = tinyMCE.replaceVar(url, name, escape(args[name]));
-		}
+			commonParent = startAncestor.parentNode;
+			startOffset = nodeIndex(startAncestor);
+			endOffset = nodeIndex(endAncestor);
+			++startOffset;
 
-		if (html) {
-			html = tinyMCE.replaceVar(html, "css", this.settings.popups_css);
-			html = tinyMCE.applyTemplate(html, args);
+			cnt = endOffset - startOffset;
+			sibling = startAncestor.nextSibling;
 
-			win = window.open("", "mcePopup" + new Date().getTime(), "top=" + y + ",left=" + x + ",scrollbars=" + scrollbars + ",dialog=yes,minimizable=" + resizable + ",modal=yes,width=" + width + ",height=" + height + ",resizable=" + resizable);
-			if (win == null) {
-				alert(tinyMCELang.lang_popup_blocked);
-				return;
+			while (cnt > 0) {
+				nextSibling = sibling.nextSibling;
+				n = _traverseFullySelected(sibling, how);
+
+				if (frag)
+					frag.appendChild(n);
+
+				sibling = nextSibling;
+				--cnt;
 			}
 
-			win.document.write(html);
-			win.document.close();
-			win.resizeTo(width, height);
-			win.focus();
-		} else {
-			if ((tinyMCE.isRealIE) && resizable != 'yes' && tinyMCE.settings.dialog_type == "modal") {
-				height += 10;
+			n = _traverseRightBoundary(endAncestor, how);
 
-				features = "resizable:" + resizable + ";scroll:" + scrollbars + ";status:yes;center:yes;help:no;dialogWidth:" + width + "px;dialogHeight:" + height + "px;";
+			if (frag)
+				frag.appendChild(n);
 
-				window.showModalDialog(url, window, features);
-			} else {
-				modal = (resizable == "yes") ? "no" : "yes";
+			if (how != CLONE) {
+				t.setStartAfter(startAncestor);
+				t.collapse(TRUE);
+			}
 
-				if (tinyMCE.isGecko && tinyMCE.isMac)
-					modal = "no";
+			return frag;
+		};
 
-				if (template.close_previous != "no")
-					try {tinyMCE.lastWindow.close();} catch (ex) {}
+		function _traverseRightBoundary(root, how) {
+			var next = _getSelectedNode(t[END_CONTAINER], t[END_OFFSET] - 1), parent, clonedParent, prevSibling, clonedChild, clonedGrandParent, isFullySelected = next != t[END_CONTAINER];
 
-				win = window.open(url, "mcePopup" + new Date().getTime(), "top=" + y + ",left=" + x + ",scrollbars=" + scrollbars + ",dialog=" + modal + ",minimizable=" + resizable + ",modal=" + modal + ",width=" + width + ",height=" + height + ",resizable=" + resizable);
-				if (win == null) {
-					alert(tinyMCELang.lang_popup_blocked);
-					return;
+			if (next == root)
+				return _traverseNode(next, isFullySelected, FALSE, how);
+
+			parent = next.parentNode;
+			clonedParent = _traverseNode(parent, FALSE, FALSE, how);
+
+			while (parent) {
+				while (next) {
+					prevSibling = next.previousSibling;
+					clonedChild = _traverseNode(next, isFullySelected, FALSE, how);
+
+					if (how != DELETE)
+						clonedParent.insertBefore(clonedChild, clonedParent.firstChild);
+
+					isFullySelected = TRUE;
+					next = prevSibling;
 				}
 
-				if (template.close_previous != "no")
-					tinyMCE.lastWindow = win;
+				if (parent == root)
+					return clonedParent;
 
-				try {
-					win.resizeTo(width, height);
-				} catch(e) {
-					// Ignore
+				next = parent.previousSibling;
+				parent = parent.parentNode;
+
+				clonedGrandParent = _traverseNode(parent, FALSE, FALSE, how);
+
+				if (how != DELETE)
+					clonedGrandParent.appendChild(clonedParent);
+
+				clonedParent = clonedGrandParent;
+			}
+		};
+
+		function _traverseLeftBoundary(root, how) {
+			var next = _getSelectedNode(t[START_CONTAINER], t[START_OFFSET]), isFullySelected = next != t[START_CONTAINER], parent, clonedParent, nextSibling, clonedChild, clonedGrandParent;
+
+			if (next == root)
+				return _traverseNode(next, isFullySelected, TRUE, how);
+
+			parent = next.parentNode;
+			clonedParent = _traverseNode(parent, FALSE, TRUE, how);
+
+			while (parent) {
+				while (next) {
+					nextSibling = next.nextSibling;
+					clonedChild = _traverseNode(next, isFullySelected, TRUE, how);
+
+					if (how != DELETE)
+						clonedParent.appendChild(clonedChild);
+
+					isFullySelected = TRUE;
+					next = nextSibling;
 				}
 
-				// Make it bigger if statusbar is forced
-				if (tinyMCE.isGecko && win.document) {
-					if (win.document.defaultView.statusbar.visible)
-						win.resizeBy(0, tinyMCE.isMac ? 10 : 24);
+				if (parent == root)
+					return clonedParent;
+
+				next = parent.nextSibling;
+				parent = parent.parentNode;
+
+				clonedGrandParent = _traverseNode(parent, FALSE, TRUE, how);
+
+				if (how != DELETE)
+					clonedGrandParent.appendChild(clonedParent);
+
+				clonedParent = clonedGrandParent;
+			}
+		};
+
+		function _traverseNode(n, isFullySelected, isLeft, how) {
+			var txtValue, newNodeValue, oldNodeValue, offset, newNode;
+
+			if (isFullySelected)
+				return _traverseFullySelected(n, how);
+
+			if (n.nodeType == 3 /* TEXT_NODE */) {
+				txtValue = n.nodeValue;
+
+				if (isLeft) {
+					offset = t[START_OFFSET];
+					newNodeValue = txtValue.substring(offset);
+					oldNodeValue = txtValue.substring(0, offset);
+				} else {
+					offset = t[END_OFFSET];
+					newNodeValue = txtValue.substring(0, offset);
+					oldNodeValue = txtValue.substring(offset);
 				}
 
-				win.focus();
+				if (how != CLONE)
+					n.nodeValue = oldNodeValue;
+
+				if (how == DELETE)
+					return;
+
+				newNode = n.cloneNode(FALSE);
+				newNode.nodeValue = newNodeValue;
+
+				return newNode;
 			}
-		}
-	},
 
-	closeWindow : function(win) {
-		win.close();
-	},
+			if (how == DELETE)
+				return;
 
-	getVisualAidClass : function(class_name, state) {
-		var i, classNames, ar, className, aidClass = tinyMCE.settings.visual_table_class;
+			return n.cloneNode(FALSE);
+		};
 
-		if (typeof(state) == "undefined")
-			state = tinyMCE.settings.visual;
+		function _traverseFullySelected(n, how) {
+			if (how != DELETE)
+				return how == CLONE ? n.cloneNode(TRUE) : n;
 
-		// Split
-		classNames = [];
-		ar = class_name.split(' ');
-		for (i=0; i<ar.length; i++) {
-			if (ar[i] == aidClass)
-				ar[i] = "";
+			n.parentNode.removeChild(n);
+		};
+	};
 
-			if (ar[i] !== '')
-				classNames[classNames.length] = ar[i];
-		}
+	ns.Range = Range;
+})(tinymce.dom);
 
-		if (state)
-			classNames[classNames.length] = aidClass;
+(function() {
+	function Selection(selection) {
+		var t = this, invisibleChar = '\uFEFF', range, lastIERng, dom = selection.dom, TRUE = true, FALSE = false;
 
-		// Glue
-		className = "";
-		for (i=0; i<classNames.length; i++) {
-			if (i > 0)
-				className += " ";
+		// Returns a W3C DOM compatible range object by using the IE Range API
+		function getRange() {
+			var ieRange = selection.getRng(), domRange = dom.createRng(), element, collapsed;
 
-			className += classNames[i];
-		}
+			// If selection is outside the current document just return an empty range
+			element = ieRange.item ? ieRange.item(0) : ieRange.parentElement();
+			if (element.ownerDocument != dom.doc)
+				return domRange;
 
-		return className;
-	},
+			// Handle control selection or text selection of a image
+			if (ieRange.item || !element.hasChildNodes()) {
+				domRange.setStart(element.parentNode, dom.nodeIndex(element));
+				domRange.setEnd(domRange.startContainer, domRange.startOffset + 1);
 
-	handleVisualAid : function(el, deep, state, inst, skip_dispatch) {
-		var i, x, y, tableElement, anchorName, oldW, oldH, bo, cn;
+				return domRange;
+			}
 
-		if (!el)
-			return;
+			collapsed = selection.isCollapsed();
 
-		if (!skip_dispatch)
-			tinyMCE.dispatchCallback(inst, 'handle_visual_aid_callback', 'handleVisualAid', el, deep, state, inst);
+			function findEndPoint(start) {
+				var marker, container, offset, nodes, startIndex = 0, endIndex, index, parent, checkRng, position;
 
-		tableElement = null;
+				// Setup temp range and collapse it
+				checkRng = ieRange.duplicate();
+				checkRng.collapse(start);
 
-		switch (el.nodeName) {
-			case "TABLE":
-				oldW = el.style.width;
-				oldH = el.style.height;
-				bo = tinyMCE.getAttrib(el, "border");
+				// Create marker and insert it at the end of the endpoints parent
+				marker = dom.create('a');
+				parent = checkRng.parentElement();
 
-				bo = bo == '' || bo == "0" ? true : false;
+				// If parent doesn't have any children then set the container to that parent and the index to 0
+				if (!parent.hasChildNodes()) {
+					domRange[start ? 'setStart' : 'setEnd'](parent, 0);
+					return;
+				}
 
-				tinyMCE.setAttrib(el, "class", tinyMCE.getVisualAidClass(tinyMCE.getAttrib(el, "class"), state && bo));
+				parent.appendChild(marker);
+				checkRng.moveToElementText(marker);
+				position = ieRange.compareEndPoints(start ? 'StartToStart' : 'EndToEnd', checkRng);
+				if (position > 0) {
+					// The position is after the end of the parent element.
+					// This is the case where IE puts the caret to the left edge of a table.
+					domRange[start ? 'setStartAfter' : 'setEndAfter'](parent);
+					dom.remove(marker);
+					return;
+				}
 
-				el.style.width = oldW;
-				el.style.height = oldH;
+				// Setup node list and endIndex
+				nodes = tinymce.grep(parent.childNodes);
+				endIndex = nodes.length - 1;
+				// Perform a binary search for the position
+				while (startIndex <= endIndex) {
+					index = Math.floor((startIndex + endIndex) / 2);
 
-				for (y=0; y<el.rows.length; y++) {
-					for (x=0; x<el.rows[y].cells.length; x++) {
-						cn = tinyMCE.getVisualAidClass(tinyMCE.getAttrib(el.rows[y].cells[x], "class"), state && bo);
-						tinyMCE.setAttrib(el.rows[y].cells[x], "class", cn);
+					// Insert marker and check it's position relative to the selection
+					parent.insertBefore(marker, nodes[index]);
+					checkRng.moveToElementText(marker);
+					position = ieRange.compareEndPoints(start ? 'StartToStart' : 'EndToEnd', checkRng);
+					if (position > 0) {
+						// Marker is to the right
+						startIndex = index + 1;
+					} else if (position < 0) {
+						// Marker is to the left
+						endIndex = index - 1;
+					} else {
+						// Maker is where we are
+						found = true;
+						break;
 					}
 				}
 
-				break;
+				// Setup container
+				container = position > 0 || index == 0 ? marker.nextSibling : marker.previousSibling;
 
-			case "A":
-				anchorName = tinyMCE.getAttrib(el, "name");
+				// Handle element selection
+				if (container.nodeType == 1) {
+					dom.remove(marker);
 
-				if (anchorName !== '' && state) {
-					el.title = anchorName;
-					tinyMCE.addCSSClass(el, 'mceItemAnchor');
-				} else if (anchorName !== '' && !state)
-					el.className = '';
+					// Find offset and container
+					offset = dom.nodeIndex(container);
+					container = container.parentNode;
 
-				break;
-		}
+					// Move the offset if we are setting the end or the position is after an element
+					if (!start || index > 0)
+						offset++;
+				} else {
+					// Calculate offset within text node
+					if (position > 0 || index == 0) {
+						checkRng.setEndPoint(start ? 'StartToStart' : 'EndToEnd', ieRange);
+						offset = checkRng.text.length;
+					} else {
+						checkRng.setEndPoint(start ? 'StartToStart' : 'EndToEnd', ieRange);
+						offset = container.nodeValue.length - checkRng.text.length;
+					}
 
-		if (deep && el.hasChildNodes()) {
-			for (i=0; i<el.childNodes.length; i++)
-				tinyMCE.handleVisualAid(el.childNodes[i], deep, state, inst, true);
-		}
-	},
+					dom.remove(marker);
+				}
 
-	fixGeckoBaseHREFBug : function(m, e, h) {
-		var xsrc, xhref;
+				domRange[start ? 'setStart' : 'setEnd'](container, offset);
+			};
 
-		if (tinyMCE.isGecko) {
-			if (m == 1) {
-				h = h.replace(/\ssrc=/gi, " mce_tsrc=");
-				h = h.replace(/\shref=/gi, " mce_thref=");
+			// Find start point
+			findEndPoint(true);
 
-				return h;
-			} else {
-				// Why bother if there is no src or href broken
-				if (!new RegExp('(src|href)=', 'g').test(h))
-					return h;
+			// Find end point if needed
+			if (!collapsed)
+				findEndPoint();
 
-				// Restore src and href that gets messed up by Gecko
-				tinyMCE.selectElements(e, 'A,IMG,SELECT,AREA,IFRAME,BASE,INPUT,SCRIPT,EMBED,OBJECT,LINK', function (n) {
-					xsrc = tinyMCE.getAttrib(n, "mce_tsrc");
-					xhref = tinyMCE.getAttrib(n, "mce_thref");
+			return domRange;
+		};
 
-					if (xsrc !== '') {
-						try {
-							n.src = tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings.base_href, xsrc);
-						} catch (e) {
-							// Ignore, Firefox cast exception if local file wasn't found
-						}
+		this.addRange = function(rng) {
+			var ieRng, ctrlRng, startContainer, startOffset, endContainer, endOffset, doc = selection.dom.doc, body = doc.body;
 
-						n.removeAttribute("mce_tsrc");
-					}
+			function setEndPoint(start) {
+				var container, offset, marker, tmpRng, nodes;
 
-					if (xhref !== '') {
-						try {
-							n.href = tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings.base_href, xhref);
-						} catch (e) {
-							// Ignore, Firefox cast exception if local file wasn't found
+				marker = dom.create('a');
+				container = start ? startContainer : endContainer;
+				offset = start ? startOffset : endOffset;
+				tmpRng = ieRng.duplicate();
+
+				if (container == doc) {
+					container = body;
+					offset = 0;
+				}
+
+				if (container.nodeType == 3) {
+					container.parentNode.insertBefore(marker, container);
+					tmpRng.moveToElementText(marker);
+					tmpRng.moveStart('character', offset);
+					dom.remove(marker);
+					ieRng.setEndPoint(start ? 'StartToStart' : 'EndToEnd', tmpRng);
+				} else {
+					nodes = container.childNodes;
+
+					if (nodes.length) {
+						if (offset >= nodes.length) {
+							dom.insertAfter(marker, nodes[nodes.length - 1]);
+						} else {
+							container.insertBefore(marker, nodes[offset]);
 						}
 
-						n.removeAttribute("mce_thref");
+						tmpRng.moveToElementText(marker);
+					} else {
+						// Empty node selection for example <div>|</div>
+						marker = doc.createTextNode(invisibleChar);
+						container.appendChild(marker);
+						tmpRng.moveToElementText(marker.parentNode);
+						tmpRng.collapse(TRUE);
 					}
 
-					return false;
-				});
+					ieRng.setEndPoint(start ? 'StartToStart' : 'EndToEnd', tmpRng);
+					dom.remove(marker);
+				}
+			}
 
-				// Restore text/comment nodes
-				tinyMCE.selectNodes(e, function(n) {
-					if (n.nodeType == 3 || n.nodeType == 8) {
-						n.nodeValue = n.nodeValue.replace(/\smce_tsrc=/gi, " src=");
-						n.nodeValue = n.nodeValue.replace(/\smce_thref=/gi, " href=");
+			// Destroy cached range
+			this.destroy();
+
+			// Setup some shorter versions
+			startContainer = rng.startContainer;
+			startOffset = rng.startOffset;
+			endContainer = rng.endContainer;
+			endOffset = rng.endOffset;
+			ieRng = body.createTextRange();
+
+			// If single element selection then try making a control selection out of it
+			if (startContainer == endContainer && startContainer.nodeType == 1 && startOffset == endOffset - 1) {
+				if (startOffset == endOffset - 1) {
+					try {
+						ctrlRng = body.createControlRange();
+						ctrlRng.addElement(startContainer.childNodes[startOffset]);
+						ctrlRng.select();
+						ctrlRng.scrollIntoView();
+						return;
+					} catch (ex) {
+						// Ignore
 					}
+				}
+			}
 
-					return false;
-				});
+			// Set start/end point of selection
+			setEndPoint(true);
+			setEndPoint();
+
+			// Select the new range and scroll it into view
+			ieRng.select();
+			ieRng.scrollIntoView();
+		};
+
+		this.getRangeAt = function() {
+			// Setup new range if the cache is empty
+			if (!range || !tinymce.dom.RangeUtils.compareRanges(lastIERng, selection.getRng())) {
+				range = getRange();
+
+				// Store away text range for next call
+				lastIERng = selection.getRng();
 			}
-		}
 
-		return h;
-	},
+			// IE will say that the range is equal then produce an invalid argument exception
+			// if you perform specific operations in a keyup event. For example Ctrl+Del.
+			// This hack will invalidate the range cache if the exception occurs
+			try {
+				range.startContainer.nextSibling;
+			} catch (ex) {
+				range = getRange();
+				lastIERng = null;
+			}
 
-	_setHTML : function(doc, html_content) {
-		var i, html, paras, node;
+			// Return cached range
+			return range;
+		};
 
-		// Force closed anchors open
-		//html_content = html_content.replace(new RegExp('<a(.*?)/>', 'gi'), '<a$1></a>');
+		this.destroy = function() {
+			// Destroy cached range and last IE range to avoid memory leaks
+			lastIERng = range = null;
+		};
 
-		html_content = tinyMCE.cleanupHTMLCode(html_content);
+		// IE has an issue where you can't select/move the caret by clicking outside the body if the document is in standards mode
+		if (selection.dom.boxModel) {
+			(function() {
+				var doc = dom.doc, body = doc.body, started, startRng;
 
-		// Try innerHTML if it fails use pasteHTML in MSIE
-		try {
-			tinyMCE.setInnerHTML(doc.body, html_content);
-		} catch (e) {
-			if (this.isMSIE)
-				doc.body.createTextRange().pasteHTML(html_content);
-		}
+				// Make HTML element unselectable since we are going to handle selection by hand
+				doc.documentElement.unselectable = TRUE;
 
-		// Content duplication bug fix
-		if (tinyMCE.isIE && tinyMCE.settings.fix_content_duplication) {
-			// Remove P elements in P elements
-			paras = doc.getElementsByTagName("P");
-			for (i=0; i<paras.length; i++) {
-				node = paras[i];
+				// Return range from point or null if it failed
+				function rngFromPoint(x, y) {
+					var rng = body.createTextRange();
 
-				while ((node = node.parentNode) != null) {
-					if (node.nodeName == "P")
-						node.outerHTML = node.innerHTML;
+					try {
+						rng.moveToPoint(x, y);
+					} catch (ex) {
+						// IE sometimes throws and exception, so lets just ignore it
+						rng = null;
+					}
+
+					return rng;
+				};
+
+				// Fires while the selection is changing
+				function selectionChange(e) {
+					var pointRng;
+
+					// Check if the button is down or not
+					if (e.button) {
+						// Create range from mouse position
+						pointRng = rngFromPoint(e.x, e.y);
+
+						if (pointRng) {
+							// Check if pointRange is before/after selection then change the endPoint
+							if (pointRng.compareEndPoints('StartToStart', startRng) > 0)
+								pointRng.setEndPoint('StartToStart', startRng);
+							else
+								pointRng.setEndPoint('EndToEnd', startRng);
+
+							pointRng.select();
+						}
+					} else
+						endSelection();
 				}
-			}
 
-			// Content duplication bug fix (Seems to be word crap)
-			html = doc.body.innerHTML;
+				// Removes listeners
+				function endSelection() {
+					dom.unbind(doc, 'mouseup', endSelection);
+					dom.unbind(doc, 'mousemove', selectionChange);
+					started = 0;
+				};
 
-			// Always set the htmlText output
-			tinyMCE.setInnerHTML(doc.body, html);
+				// Detect when user selects outside BODY
+				dom.bind(doc, 'mousedown', function(e) {
+					if (e.target.nodeName === 'HTML') {
+						if (started)
+							endSelection();
+
+						started = 1;
+
+						// Setup start position
+						startRng = rngFromPoint(e.x, e.y);
+						if (startRng) {
+							// Listen for selection change events
+							dom.bind(doc, 'mouseup', endSelection);
+							dom.bind(doc, 'mousemove', selectionChange);
+
+							startRng.select();
+						}
+					}
+				});
+			})();
 		}
+	};
 
-		tinyMCE.cleanupAnchors(doc);
+	// Expose the selection object
+	tinymce.dom.TridentSelection = Selection;
+})();
 
-		if (tinyMCE.getParam("convert_fonts_to_spans"))
-			tinyMCE.convertSpansToFonts(doc);
-	},
 
-	getEditorId : function(form_element) {
-		var inst = this.getInstanceById(form_element);
+/*
+ * Sizzle CSS Selector Engine - v1.0
+ *  Copyright 2009, The Dojo Foundation
+ *  Released under the MIT, BSD, and GPL Licenses.
+ *  More information: http://sizzlejs.com/
+ */
+(function(){
 
-		if (!inst)
-			return null;
+var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,
+	done = 0,
+	toString = Object.prototype.toString,
+	hasDuplicate = false,
+	baseHasDuplicate = true;
 
-		return inst.editorId;
-	},
+// Here we check if the JavaScript engine is using some sort of
+// optimization where it does not always call our comparision
+// function. If that is the case, discard the hasDuplicate value.
+//   Thus far that includes Google Chrome.
+[0, 0].sort(function(){
+	baseHasDuplicate = false;
+	return 0;
+});
 
-	getInstanceById : function(editor_id) {
-		var inst = this.instances[editor_id], n;
+var Sizzle = function(selector, context, results, seed) {
+	results = results || [];
+	context = context || document;
 
-		if (!inst) {
-			for (n in tinyMCE.instances) {
-				inst = tinyMCE.instances[n];
+	var origContext = context;
 
-				if (!tinyMCE.isInstance(inst))
-					continue;
+	if ( context.nodeType !== 1 && context.nodeType !== 9 ) {
+		return [];
+	}
+	
+	if ( !selector || typeof selector !== "string" ) {
+		return results;
+	}
 
-				if (inst.formTargetElementId == editor_id)
-					return inst;
+	var parts = [], m, set, checkSet, extra, prune = true, contextXML = Sizzle.isXML(context),
+		soFar = selector, ret, cur, pop, i;
+	
+	// Reset the position of the chunker regexp (start from head)
+	do {
+		chunker.exec("");
+		m = chunker.exec(soFar);
+
+		if ( m ) {
+			soFar = m[3];
+		
+			parts.push( m[1] );
+		
+			if ( m[2] ) {
+				extra = m[3];
+				break;
 			}
-		} else
-			return inst;
+		}
+	} while ( m );
 
-		return null;
-	},
+	if ( parts.length > 1 && origPOS.exec( selector ) ) {
+		if ( parts.length === 2 && Expr.relative[ parts[0] ] ) {
+			set = posProcess( parts[0] + parts[1], context );
+		} else {
+			set = Expr.relative[ parts[0] ] ?
+				[ context ] :
+				Sizzle( parts.shift(), context );
 
-	queryInstanceCommandValue : function(editor_id, command) {
-		var inst = tinyMCE.getInstanceById(editor_id);
+			while ( parts.length ) {
+				selector = parts.shift();
 
-		if (inst)
-			return inst.queryCommandValue(command);
+				if ( Expr.relative[ selector ] ) {
+					selector += parts.shift();
+				}
+				
+				set = posProcess( selector, set );
+			}
+		}
+	} else {
+		// Take a shortcut and set the context if the root selector is an ID
+		// (but not if it'll be faster if the inner selector is an ID)
+		if ( !seed && parts.length > 1 && context.nodeType === 9 && !contextXML &&
+				Expr.match.ID.test(parts[0]) && !Expr.match.ID.test(parts[parts.length - 1]) ) {
+			ret = Sizzle.find( parts.shift(), context, contextXML );
+			context = ret.expr ? Sizzle.filter( ret.expr, ret.set )[0] : ret.set[0];
+		}
 
-		return false;
-	},
+		if ( context ) {
+			ret = seed ?
+				{ expr: parts.pop(), set: makeArray(seed) } :
+				Sizzle.find( parts.pop(), parts.length === 1 && (parts[0] === "~" || parts[0] === "+") && context.parentNode ? context.parentNode : context, contextXML );
+			set = ret.expr ? Sizzle.filter( ret.expr, ret.set ) : ret.set;
 
-	queryInstanceCommandState : function(editor_id, command) {
-		var inst = tinyMCE.getInstanceById(editor_id);
+			if ( parts.length > 0 ) {
+				checkSet = makeArray(set);
+			} else {
+				prune = false;
+			}
 
-		if (inst)
-			return inst.queryCommandState(command);
+			while ( parts.length ) {
+				cur = parts.pop();
+				pop = cur;
 
-		return null;
-	},
+				if ( !Expr.relative[ cur ] ) {
+					cur = "";
+				} else {
+					pop = parts.pop();
+				}
 
-	setWindowArg : function(n, v) {
-		this.windowArgs[n] = v;
-	},
+				if ( pop == null ) {
+					pop = context;
+				}
 
-	getWindowArg : function(n, d) {
-		return (typeof(this.windowArgs[n]) == "undefined") ? d : this.windowArgs[n];
-	},
+				Expr.relative[ cur ]( checkSet, pop, contextXML );
+			}
+		} else {
+			checkSet = parts = [];
+		}
+	}
 
-	getCSSClasses : function(editor_id, doc) {
-		var i, c, x, rule, styles, rules, csses, selectorText, inst = tinyMCE.getInstanceById(editor_id);
-		var cssClass, addClass, p;
+	if ( !checkSet ) {
+		checkSet = set;
+	}
 
-		if (!inst)
-			inst = tinyMCE.selectedInstance;
+	if ( !checkSet ) {
+		Sizzle.error( cur || selector );
+	}
 
-		if (!inst)
-			return [];
+	if ( toString.call(checkSet) === "[object Array]" ) {
+		if ( !prune ) {
+			results.push.apply( results, checkSet );
+		} else if ( context && context.nodeType === 1 ) {
+			for ( i = 0; checkSet[i] != null; i++ ) {
+				if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && Sizzle.contains(context, checkSet[i])) ) {
+					results.push( set[i] );
+				}
+			}
+		} else {
+			for ( i = 0; checkSet[i] != null; i++ ) {
+				if ( checkSet[i] && checkSet[i].nodeType === 1 ) {
+					results.push( set[i] );
+				}
+			}
+		}
+	} else {
+		makeArray( checkSet, results );
+	}
 
-		if (!doc)
-			doc = inst.getDoc();
+	if ( extra ) {
+		Sizzle( extra, origContext, results, seed );
+		Sizzle.uniqueSort( results );
+	}
 
-		// Is cached, use that
-		if (inst && inst.cssClasses.length > 0)
-			return inst.cssClasses;
+	return results;
+};
 
-		if (!doc)
-			return;
+Sizzle.uniqueSort = function(results){
+	if ( sortOrder ) {
+		hasDuplicate = baseHasDuplicate;
+		results.sort(sortOrder);
 
-		styles = doc.styleSheets;
+		if ( hasDuplicate ) {
+			for ( var i = 1; i < results.length; i++ ) {
+				if ( results[i] === results[i-1] ) {
+					results.splice(i--, 1);
+				}
+			}
+		}
+	}
 
-		if (styles && styles.length > 0) {
-			for (x=0; x<styles.length; x++) {
-				csses = null;
+	return results;
+};
 
-				try {
-					csses = tinyMCE.isIE ? doc.styleSheets(x).rules : styles[x].cssRules;
-				} catch(e) {
-					// Just ignore any errors I know this is ugly!!
+Sizzle.matches = function(expr, set){
+	return Sizzle(expr, null, null, set);
+};
+
+Sizzle.find = function(expr, context, isXML){
+	var set;
+
+	if ( !expr ) {
+		return [];
+	}
+
+	for ( var i = 0, l = Expr.order.length; i < l; i++ ) {
+		var type = Expr.order[i], match;
+		
+		if ( (match = Expr.leftMatch[ type ].exec( expr )) ) {
+			var left = match[1];
+			match.splice(1,1);
+
+			if ( left.substr( left.length - 1 ) !== "\\" ) {
+				match[1] = (match[1] || "").replace(/\\/g, "");
+				set = Expr.find[ type ]( match, context, isXML );
+				if ( set != null ) {
+					expr = expr.replace( Expr.match[ type ], "" );
+					break;
 				}
-	
-				if (!csses)
-					return [];
+			}
+		}
+	}
 
-				for (i=0; i<csses.length; i++) {
-					selectorText = csses[i].selectorText;
+	if ( !set ) {
+		set = context.getElementsByTagName("*");
+	}
 
-					// Can be multiple rules per selector
-					if (selectorText) {
-						rules = selectorText.split(',');
-						for (c=0; c<rules.length; c++) {
-							rule = rules[c];
+	return {set: set, expr: expr};
+};
 
-							// Strip spaces between selectors
-							while (rule.indexOf(' ') == 0)
-								rule = rule.substring(1);
+Sizzle.filter = function(expr, set, inplace, not){
+	var old = expr, result = [], curLoop = set, match, anyFound,
+		isXMLFilter = set && set[0] && Sizzle.isXML(set[0]);
 
-							// Invalid rule
-							if (rule.indexOf(' ') != -1 || rule.indexOf(':') != -1 || rule.indexOf('mceItem') != -1)
-								continue;
+	while ( expr && set.length ) {
+		for ( var type in Expr.filter ) {
+			if ( (match = Expr.leftMatch[ type ].exec( expr )) != null && match[2] ) {
+				var filter = Expr.filter[ type ], found, item, left = match[1];
+				anyFound = false;
 
-							if (rule.indexOf(tinyMCE.settings.visual_table_class) != -1 || rule.indexOf('mceEditable') != -1 || rule.indexOf('mceNonEditable') != -1)
-								continue;
+				match.splice(1,1);
 
-							// Is class rule
-							if (rule.indexOf('.') != -1) {
-								cssClass = rule.substring(rule.indexOf('.') + 1);
-								addClass = true;
+				if ( left.substr( left.length - 1 ) === "\\" ) {
+					continue;
+				}
 
-								for (p=0; p<inst.cssClasses.length && addClass; p++) {
-									if (inst.cssClasses[p] == cssClass)
-										addClass = false;
+				if ( curLoop === result ) {
+					result = [];
+				}
+
+				if ( Expr.preFilter[ type ] ) {
+					match = Expr.preFilter[ type ]( match, curLoop, inplace, result, not, isXMLFilter );
+
+					if ( !match ) {
+						anyFound = found = true;
+					} else if ( match === true ) {
+						continue;
+					}
+				}
+
+				if ( match ) {
+					for ( var i = 0; (item = curLoop[i]) != null; i++ ) {
+						if ( item ) {
+							found = filter( item, match, i, curLoop );
+							var pass = not ^ !!found;
+
+							if ( inplace && found != null ) {
+								if ( pass ) {
+									anyFound = true;
+								} else {
+									curLoop[i] = false;
 								}
-
-								if (addClass)
-									inst.cssClasses[inst.cssClasses.length] = cssClass;
+							} else if ( pass ) {
+								result.push( item );
+								anyFound = true;
 							}
 						}
 					}
 				}
-			}
-		}
 
-		return inst.cssClasses;
-	},
+				if ( found !== undefined ) {
+					if ( !inplace ) {
+						curLoop = result;
+					}
 
-	regexpReplace : function(in_str, reg_exp, replace_str, opts) {
-		var re;
+					expr = expr.replace( Expr.match[ type ], "" );
 
-		if (in_str == null)
-			return in_str;
+					if ( !anyFound ) {
+						return [];
+					}
 
-		if (typeof(opts) == "undefined")
-			opts = 'g';
+					break;
+				}
+			}
+		}
 
-		re = new RegExp(reg_exp, opts);
+		// Improper expression
+		if ( expr === old ) {
+			if ( anyFound == null ) {
+				Sizzle.error( expr );
+			} else {
+				break;
+			}
+		}
 
-		return in_str.replace(re, replace_str);
-	},
+		old = expr;
+	}
 
-	trim : function(s) {
-		return s.replace(/^\s*|\s*$/g, "");
-	},
+	return curLoop;
+};
 
-	cleanupEventStr : function(s) {
-		s = "" + s;
-		s = s.replace('function anonymous()\n{\n', '');
-		s = s.replace('\n}', '');
-		s = s.replace(/^return true;/gi, ''); // Remove event blocker
+Sizzle.error = function( msg ) {
+	throw "Syntax error, unrecognized expression: " + msg;
+};
 
-		return s;
+var Expr = Sizzle.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(elem){
+			return elem.getAttribute("href");
+		}
+	},
+	relative: {
+		"+": function(checkSet, part){
+			var isPartStr = typeof part === "string",
+				isTag = isPartStr && !/\W/.test(part),
+				isPartStrNotTag = isPartStr && !isTag;
 
-	getControlHTML : function(c) {
-		var i, l, n, o, v, rtl = tinyMCE.getLang('lang_dir') == 'rtl';
+			if ( isTag ) {
+				part = part.toLowerCase();
+			}
 
-		l = tinyMCE.plugins;
-		for (n in l) {
-			o = l[n];
+			for ( var i = 0, l = checkSet.length, elem; i < l; i++ ) {
+				if ( (elem = checkSet[i]) ) {
+					while ( (elem = elem.previousSibling) && elem.nodeType !== 1 ) {}
 
-			if (o.getControlHTML && (v = o.getControlHTML(c)) !== '') {
-				if (rtl)
-					return '<span dir="rtl">' + tinyMCE.replaceVar(v, "pluginurl", o.baseURL) + '</span>';
+					checkSet[i] = isPartStrNotTag || elem && elem.nodeName.toLowerCase() === part ?
+						elem || false :
+						elem === part;
+				}
+			}
 
-				return tinyMCE.replaceVar(v, "pluginurl", o.baseURL);
+			if ( isPartStrNotTag ) {
+				Sizzle.filter( part, checkSet, true );
 			}
-		}
+		},
+		">": function(checkSet, part){
+			var isPartStr = typeof part === "string",
+				elem, i = 0, l = checkSet.length;
 
-		o = tinyMCE.themes[tinyMCE.settings.theme];
-		if (o.getControlHTML && (v = o.getControlHTML(c)) !== '') {
-			if (rtl)
-				return '<span dir="rtl">' + v + '</span>';
+			if ( isPartStr && !/\W/.test(part) ) {
+				part = part.toLowerCase();
 
-			return v;
-		}
+				for ( ; i < l; i++ ) {
+					elem = checkSet[i];
+					if ( elem ) {
+						var parent = elem.parentNode;
+						checkSet[i] = parent.nodeName.toLowerCase() === part ? parent : false;
+					}
+				}
+			} else {
+				for ( ; i < l; i++ ) {
+					elem = checkSet[i];
+					if ( elem ) {
+						checkSet[i] = isPartStr ?
+							elem.parentNode :
+							elem.parentNode === part;
+					}
+				}
 
-		return '';
-	},
+				if ( isPartStr ) {
+					Sizzle.filter( part, checkSet, true );
+				}
+			}
+		},
+		"": function(checkSet, part, isXML){
+			var doneName = done++, checkFn = dirCheck, nodeCheck;
 
-	evalFunc : function(f, idx, a, o) {
-		o = !o ? window : o;
-		f = typeof(f) == 'function' ? f : o[f];
+			if ( typeof part === "string" && !/\W/.test(part) ) {
+				part = part.toLowerCase();
+				nodeCheck = part;
+				checkFn = dirNodeCheck;
+			}
 
-		return f.apply(o, Array.prototype.slice.call(a, idx));
-	},
+			checkFn("parentNode", part, doneName, checkSet, nodeCheck, isXML);
+		},
+		"~": function(checkSet, part, isXML){
+			var doneName = done++, checkFn = dirCheck, nodeCheck;
 
-	dispatchCallback : function(i, p, n) {
-		return this.callFunc(i, p, n, 0, this.dispatchCallback.arguments);
-	},
+			if ( typeof part === "string" && !/\W/.test(part) ) {
+				part = part.toLowerCase();
+				nodeCheck = part;
+				checkFn = dirNodeCheck;
+			}
 
-	executeCallback : function(i, p, n) {
-		return this.callFunc(i, p, n, 1, this.executeCallback.arguments);
+			checkFn("previousSibling", part, doneName, checkSet, nodeCheck, isXML);
+		}
 	},
+	find: {
+		ID: function(match, context, isXML){
+			if ( typeof context.getElementById !== "undefined" && !isXML ) {
+				var m = context.getElementById(match[1]);
+				return m ? [m] : [];
+			}
+		},
+		NAME: function(match, context){
+			if ( typeof context.getElementsByName !== "undefined" ) {
+				var ret = [], results = context.getElementsByName(match[1]);
 
-	execCommandCallback : function(i, p, n) {
-		return this.callFunc(i, p, n, 2, this.execCommandCallback.arguments);
+				for ( var i = 0, l = results.length; i < l; i++ ) {
+					if ( results[i].getAttribute("name") === match[1] ) {
+						ret.push( results[i] );
+					}
+				}
+
+				return ret.length === 0 ? null : ret;
+			}
+		},
+		TAG: function(match, context){
+			return context.getElementsByTagName(match[1]);
+		}
 	},
+	preFilter: {
+		CLASS: function(match, curLoop, inplace, result, not, isXML){
+			match = " " + match[1].replace(/\\/g, "") + " ";
 
-	callFunc : function(ins, p, n, m, a) {
-		var l, i, on, o, s, v;
+			if ( isXML ) {
+				return match;
+			}
 
-		s = m == 2;
+			for ( var i = 0, elem; (elem = curLoop[i]) != null; i++ ) {
+				if ( elem ) {
+					if ( not ^ (elem.className && (" " + elem.className + " ").replace(/[\t\n]/g, " ").indexOf(match) >= 0) ) {
+						if ( !inplace ) {
+							result.push( elem );
+						}
+					} else if ( inplace ) {
+						curLoop[i] = false;
+					}
+				}
+			}
 
-		l = tinyMCE.getParam(p, '');
+			return false;
+		},
+		ID: function(match){
+			return match[1].replace(/\\/g, "");
+		},
+		TAG: function(match, curLoop){
+			return match[1].toLowerCase();
+		},
+		CHILD: function(match){
+			if ( match[1] === "nth" ) {
+				// parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6'
+				var test = /(-?)(\d*)n((?:\+|-)?\d*)/.exec(
+					match[2] === "even" && "2n" || match[2] === "odd" && "2n+1" ||
+					!/\D/.test( match[2] ) && "0n+" + match[2] || match[2]);
 
-		if (l !== '' && (v = tinyMCE.evalFunc(l, 3, a)) == s && m > 0)
-			return true;
+				// calculate the numbers (first)n+(last) including if they are negative
+				match[2] = (test[1] + (test[2] || 1)) - 0;
+				match[3] = test[3] - 0;
+			}
 
-		if (ins != null) {
-			for (i=0, l = ins.plugins; i<l.length; i++) {
-				o = tinyMCE.plugins[l[i]];
+			// TODO: Move to normal caching system
+			match[0] = done++;
 
-				if (o[n] && (v = tinyMCE.evalFunc(n, 3, a, o)) == s && m > 0)
-					return true;
+			return match;
+		},
+		ATTR: function(match, curLoop, inplace, result, not, isXML){
+			var name = match[1].replace(/\\/g, "");
+			
+			if ( !isXML && Expr.attrMap[name] ) {
+				match[1] = Expr.attrMap[name];
 			}
-		}
 
-		l = tinyMCE.themes;
-		for (on in l) {
-			o = l[on];
+			if ( match[2] === "~=" ) {
+				match[4] = " " + match[4] + " ";
+			}
 
-			if (o[n] && (v = tinyMCE.evalFunc(n, 3, a, o)) == s && m > 0)
+			return match;
+		},
+		PSEUDO: function(match, curLoop, inplace, result, not){
+			if ( match[1] === "not" ) {
+				// If we're dealing with a complex expression, or a simple one
+				if ( ( chunker.exec(match[3]) || "" ).length > 1 || /^\w/.test(match[3]) ) {
+					match[3] = Sizzle(match[3], null, null, curLoop);
+				} else {
+					var ret = Sizzle.filter(match[3], curLoop, inplace, true ^ not);
+					if ( !inplace ) {
+						result.push.apply( result, ret );
+					}
+					return false;
+				}
+			} else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) {
 				return true;
+			}
+			
+			return match;
+		},
+		POS: function(match){
+			match.unshift( true );
+			return match;
 		}
-
-		return false;
 	},
+	filters: {
+		enabled: function(elem){
+			return elem.disabled === false && elem.type !== "hidden";
+		},
+		disabled: function(elem){
+			return elem.disabled === true;
+		},
+		checked: function(elem){
+			return elem.checked === true;
+		},
+		selected: function(elem){
+			// Accessing this property makes selected-by-default
+			// options in Safari work properly
+			elem.parentNode.selectedIndex;
+			return elem.selected === true;
+		},
+		parent: function(elem){
+			return !!elem.firstChild;
+		},
+		empty: function(elem){
+			return !elem.firstChild;
+		},
+		has: function(elem, i, match){
+			return !!Sizzle( match[3], elem ).length;
+		},
+		header: function(elem){
+			return (/h\d/i).test( elem.nodeName );
+		},
+		text: function(elem){
+			return "text" === elem.type;
+		},
+		radio: function(elem){
+			return "radio" === elem.type;
+		},
+		checkbox: function(elem){
+			return "checkbox" === elem.type;
+		},
+		file: function(elem){
+			return "file" === elem.type;
+		},
+		password: function(elem){
+			return "password" === elem.type;
+		},
+		submit: function(elem){
+			return "submit" === elem.type;
+		},
+		image: function(elem){
+			return "image" === elem.type;
+		},
+		reset: function(elem){
+			return "reset" === elem.type;
+		},
+		button: function(elem){
+			return "button" === elem.type || elem.nodeName.toLowerCase() === "button";
+		},
+		input: function(elem){
+			return (/input|select|textarea|button/i).test(elem.nodeName);
+		}
+	},
+	setFilters: {
+		first: function(elem, i){
+			return i === 0;
+		},
+		last: function(elem, i, match, array){
+			return i === array.length - 1;
+		},
+		even: function(elem, i){
+			return i % 2 === 0;
+		},
+		odd: function(elem, i){
+			return i % 2 === 1;
+		},
+		lt: function(elem, i, match){
+			return i < match[3] - 0;
+		},
+		gt: function(elem, i, match){
+			return i > match[3] - 0;
+		},
+		nth: function(elem, i, match){
+			return match[3] - 0 === i;
+		},
+		eq: function(elem, i, match){
+			return match[3] - 0 === i;
+		}
+	},
+	filter: {
+		PSEUDO: function(elem, match, i, array){
+			var name = match[1], filter = Expr.filters[ name ];
 
-	resolveDots : function(s, o) {
-		var i;
+			if ( filter ) {
+				return filter( elem, i, match, array );
+			} else if ( name === "contains" ) {
+				return (elem.textContent || elem.innerText || Sizzle.getText([ elem ]) || "").indexOf(match[3]) >= 0;
+			} else if ( name === "not" ) {
+				var not = match[3];
 
-		if (typeof(s) == 'string') {
-			for (i=0, s=s.split('.'); i<s.length; i++)
-				o = o[s[i]];
-		} else
-			o = s;
+				for ( var j = 0, l = not.length; j < l; j++ ) {
+					if ( not[j] === elem ) {
+						return false;
+					}
+				}
 
-		return o;
-	},
+				return true;
+			} else {
+				Sizzle.error( "Syntax error, unrecognized expression: " + name );
+			}
+		},
+		CHILD: function(elem, match){
+			var type = match[1], node = elem;
+			switch (type) {
+				case 'only':
+				case 'first':
+					while ( (node = node.previousSibling) )	 {
+						if ( node.nodeType === 1 ) { 
+							return false; 
+						}
+					}
+					if ( type === "first" ) { 
+						return true; 
+					}
+					node = elem;
+				case 'last':
+					while ( (node = node.nextSibling) )	 {
+						if ( node.nodeType === 1 ) { 
+							return false; 
+						}
+					}
+					return true;
+				case 'nth':
+					var first = match[2], last = match[3];
 
-	xmlEncode : function(s) {
-		return s ? ('' + s).replace(this.xmlEncodeRe, function (c, b) {
-			switch (c) {
-				case '&':
-					return '&amp;';
+					if ( first === 1 && last === 0 ) {
+						return true;
+					}
+					
+					var doneName = match[0],
+						parent = elem.parentNode;
+	
+					if ( parent && (parent.sizcache !== doneName || !elem.nodeIndex) ) {
+						var count = 0;
+						for ( node = parent.firstChild; node; node = node.nextSibling ) {
+							if ( node.nodeType === 1 ) {
+								node.nodeIndex = ++count;
+							}
+						} 
+						parent.sizcache = doneName;
+					}
+					
+					var diff = elem.nodeIndex - last;
+					if ( first === 0 ) {
+						return diff === 0;
+					} else {
+						return ( diff % first === 0 && diff / first >= 0 );
+					}
+			}
+		},
+		ID: function(elem, match){
+			return elem.nodeType === 1 && elem.getAttribute("id") === match;
+		},
+		TAG: function(elem, match){
+			return (match === "*" && elem.nodeType === 1) || elem.nodeName.toLowerCase() === match;
+		},
+		CLASS: function(elem, match){
+			return (" " + (elem.className || elem.getAttribute("class")) + " ")
+				.indexOf( match ) > -1;
+		},
+		ATTR: function(elem, match){
+			var name = match[1],
+				result = Expr.attrHandle[ name ] ?
+					Expr.attrHandle[ name ]( elem ) :
+					elem[ name ] != null ?
+						elem[ name ] :
+						elem.getAttribute( name ),
+				value = result + "",
+				type = match[2],
+				check = match[4];
 
-				case '"':
-					return '&quot;';
+			return result == null ?
+				type === "!=" :
+				type === "=" ?
+				value === check :
+				type === "*=" ?
+				value.indexOf(check) >= 0 :
+				type === "~=" ?
+				(" " + value + " ").indexOf(check) >= 0 :
+				!check ?
+				value && result !== false :
+				type === "!=" ?
+				value !== check :
+				type === "^=" ?
+				value.indexOf(check) === 0 :
+				type === "$=" ?
+				value.substr(value.length - check.length) === check :
+				type === "|=" ?
+				value === check || value.substr(0, check.length + 1) === check + "-" :
+				false;
+		},
+		POS: function(elem, match, i, array){
+			var name = match[2], filter = Expr.setFilters[ name ];
 
-				case '<':
-					return '&lt;';
-
-				case '>':
-					return '&gt;';
+			if ( filter ) {
+				return filter( elem, i, match, array );
 			}
+		}
+	}
+};
 
-			return c;
-		}) : s;
-	},
+var origPOS = Expr.match.POS,
+	fescape = function(all, num){
+		return "\\" + (num - 0 + 1);
+	};
 
-	add : function(c, m) {
-		var n;
+for ( var type in Expr.match ) {
+	Expr.match[ type ] = new RegExp( Expr.match[ type ].source + (/(?![^\[]*\])(?![^\(]*\))/.source) );
+	Expr.leftMatch[ type ] = new RegExp( /(^(?:.|\r|\n)*?)/.source + Expr.match[ type ].source.replace(/\\(\d+)/g, fescape) );
+}
 
-		for (n in m) {
-			if (m.hasOwnProperty(n))
-				c.prototype[n] = m[n];
-		}
-	},
+var makeArray = function(array, results) {
+	array = Array.prototype.slice.call( array, 0 );
 
-	extend : function(p, np) {
-		var o = {}, n;
+	if ( results ) {
+		results.push.apply( results, array );
+		return results;
+	}
+	
+	return array;
+};
 
-		o.parent = p;
+// Perform a simple check to determine if the browser is capable of
+// converting a NodeList to an array using builtin methods.
+// Also verifies that the returned array holds DOM nodes
+// (which is not the case in the Blackberry browser)
+try {
+	Array.prototype.slice.call( document.documentElement.childNodes, 0 )[0].nodeType;
 
-		for (n in p) {
-			if (p.hasOwnProperty(n))
-				o[n] = p[n];
-		}
+// Provide a fallback method if it does not work
+} catch(e){
+	makeArray = function(array, results) {
+		var ret = results || [], i = 0;
 
-		for (n in np) {
-			if (np.hasOwnProperty(n))
-				o[n] = np[n];
+		if ( toString.call(array) === "[object Array]" ) {
+			Array.prototype.push.apply( ret, array );
+		} else {
+			if ( typeof array.length === "number" ) {
+				for ( var l = array.length; i < l; i++ ) {
+					ret.push( array[i] );
+				}
+			} else {
+				for ( ; array[i]; i++ ) {
+					ret.push( array[i] );
+				}
+			}
 		}
 
-		return o;
-	},
+		return ret;
+	};
+}
 
-	hideMenus : function() {
-		var e = tinyMCE.lastSelectedMenuBtn;
+var sortOrder;
 
-		if (tinyMCE.lastMenu) {
-			tinyMCE.lastMenu.hide();
-			tinyMCE.lastMenu = null;
+if ( document.documentElement.compareDocumentPosition ) {
+	sortOrder = function( a, b ) {
+		if ( !a.compareDocumentPosition || !b.compareDocumentPosition ) {
+			if ( a == b ) {
+				hasDuplicate = true;
+			}
+			return a.compareDocumentPosition ? -1 : 1;
 		}
 
-		if (e) {
-			tinyMCE.switchClass(e, tinyMCE.lastMenuBtnClass);
-			tinyMCE.lastSelectedMenuBtn = null;
+		var ret = a.compareDocumentPosition(b) & 4 ? -1 : a === b ? 0 : 1;
+		if ( ret === 0 ) {
+			hasDuplicate = true;
 		}
-	}
+		return ret;
+	};
+} else if ( "sourceIndex" in document.documentElement ) {
+	sortOrder = function( a, b ) {
+		if ( !a.sourceIndex || !b.sourceIndex ) {
+			if ( a == b ) {
+				hasDuplicate = true;
+			}
+			return a.sourceIndex ? -1 : 1;
+		}
 
+		var ret = a.sourceIndex - b.sourceIndex;
+		if ( ret === 0 ) {
+			hasDuplicate = true;
+		}
+		return ret;
 	};
+} else if ( document.createRange ) {
+	sortOrder = function( a, b ) {
+		if ( !a.ownerDocument || !b.ownerDocument ) {
+			if ( a == b ) {
+				hasDuplicate = true;
+			}
+			return a.ownerDocument ? -1 : 1;
+		}
 
-// Global instances
-var TinyMCE = TinyMCE_Engine; // Compatiblity with gzip compressors
-var tinyMCE = new TinyMCE_Engine();
-var tinyMCELang = {};
+		var aRange = a.ownerDocument.createRange(), bRange = b.ownerDocument.createRange();
+		aRange.setStart(a, 0);
+		aRange.setEnd(a, 0);
+		bRange.setStart(b, 0);
+		bRange.setEnd(b, 0);
+		var ret = aRange.compareBoundaryPoints(Range.START_TO_END, bRange);
+		if ( ret === 0 ) {
+			hasDuplicate = true;
+		}
+		return ret;
+	};
+}
 
-/* file:jscripts/tiny_mce/classes/TinyMCE_Control.class.js */
+// Utility function for retreiving the text value of an array of DOM nodes
+Sizzle.getText = function( elems ) {
+	var ret = "", elem;
 
-function TinyMCE_Control(settings) {
-	var t, i, tos, fu, p, x, fn, fu, pn, s = settings;
+	for ( var i = 0; elems[i]; i++ ) {
+		elem = elems[i];
 
-	this.undoRedoLevel = true;
-	this.isTinyMCE_Control = true;
+		// Get the text from text nodes and CDATA nodes
+		if ( elem.nodeType === 3 || elem.nodeType === 4 ) {
+			ret += elem.nodeValue;
 
-	// Default settings
-	this.enabled = true;
-	this.settings = s;
-	this.settings.theme = tinyMCE.getParam("theme", "default");
-	this.settings.width = tinyMCE.getParam("width", -1);
-	this.settings.height = tinyMCE.getParam("height", -1);
-	this.selection = new TinyMCE_Selection(this);
-	this.undoRedo = new TinyMCE_UndoRedo(this);
-	this.cleanup = new TinyMCE_Cleanup();
-	this.shortcuts = [];
-	this.hasMouseMoved = false;
-	this.foreColor = this.backColor = "#999999";
-	this.data = {};
-	this.cssClasses = [];
+		// Traverse everything else, except comment nodes
+		} else if ( elem.nodeType !== 8 ) {
+			ret += Sizzle.getText( elem.childNodes );
+		}
+	}
 
-	this.cleanup.init({
-		valid_elements : s.valid_elements,
-		extended_valid_elements : s.extended_valid_elements,
-		valid_child_elements : s.valid_child_elements,
-		entities : s.entities,
-		entity_encoding : s.entity_encoding,
-		debug : s.cleanup_debug,
-		indent : s.apply_source_formatting,
-		invalid_elements : s.invalid_elements,
-		verify_html : s.verify_html,
-		fix_content_duplication : s.fix_content_duplication,
-		convert_fonts_to_spans : s.convert_fonts_to_spans
-	});
+	return ret;
+};
 
-	// Wrap old theme
-	t = this.settings.theme;
-	if (!tinyMCE.hasTheme(t)) {
-		fn = tinyMCE.callbacks;
-		tos = {};
+// Check to see if the browser returns elements by name when
+// querying by getElementById (and provide a workaround)
+(function(){
+	// We're going to inject a fake input element with a specified name
+	var form = document.createElement("div"),
+		id = "script" + (new Date()).getTime();
+	form.innerHTML = "<a name='" + id + "'/>";
 
-		for (i=0; i<fn.length; i++) {
-			if ((fu = window['TinyMCE_' + t + "_" + fn[i]]))
-				tos[fn[i]] = fu;
-		}
+	// Inject it into the root element, check its status, and remove it quickly
+	var root = document.documentElement;
+	root.insertBefore( form, root.firstChild );
 
-		tinyMCE.addTheme(t, tos);
+	// The workaround has to do additional checks after a getElementById
+	// Which slows things down for other browsers (hence the branching)
+	if ( document.getElementById( id ) ) {
+		Expr.find.ID = function(match, context, isXML){
+			if ( typeof context.getElementById !== "undefined" && !isXML ) {
+				var m = context.getElementById(match[1]);
+				return m ? m.id === match[1] || typeof m.getAttributeNode !== "undefined" && m.getAttributeNode("id").nodeValue === match[1] ? [m] : undefined : [];
+			}
+		};
+
+		Expr.filter.ID = function(elem, match){
+			var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id");
+			return elem.nodeType === 1 && node && node.nodeValue === match;
+		};
 	}
 
-	// Wrap old plugins
-	this.plugins = [];
-	p = tinyMCE.getParam('plugins', '', true, ',');
-	if (p.length > 0) {
-		for (i=0; i<p.length; i++) {
-			pn = p[i];
+	root.removeChild( form );
+	root = form = null; // release memory in IE
+})();
 
-			if (pn.charAt(0) == '-')
-				pn = pn.substring(1);
+(function(){
+	// Check to see if the browser returns only elements
+	// when doing getElementsByTagName("*")
 
-			if (!tinyMCE.hasPlugin(pn)) {
-				fn = tinyMCE.callbacks;
-				tos = {};
+	// Create a fake element
+	var div = document.createElement("div");
+	div.appendChild( document.createComment("") );
 
-				for (x=0; x<fn.length; x++) {
-					if ((fu = window['TinyMCE_' + pn + "_" + fn[x]]))
-						tos[fn[x]] = fu;
+	// Make sure no comments are found
+	if ( div.getElementsByTagName("*").length > 0 ) {
+		Expr.find.TAG = function(match, context){
+			var results = context.getElementsByTagName(match[1]);
+
+			// Filter out possible comments
+			if ( match[1] === "*" ) {
+				var tmp = [];
+
+				for ( var i = 0; results[i]; i++ ) {
+					if ( results[i].nodeType === 1 ) {
+						tmp.push( results[i] );
+					}
 				}
 
-				tinyMCE.addPlugin(pn, tos);
+				results = tmp;
 			}
 
-			this.plugins[this.plugins.length] = pn; 
-		}
+			return results;
+		};
 	}
-};
 
-TinyMCE_Control.prototype = {
-	selection : null,
+	// Check to see if an attribute returns normalized href attributes
+	div.innerHTML = "<a href='#'></a>";
+	if ( div.firstChild && typeof div.firstChild.getAttribute !== "undefined" &&
+			div.firstChild.getAttribute("href") !== "#" ) {
+		Expr.attrHandle.href = function(elem){
+			return elem.getAttribute("href", 2);
+		};
+	}
 
-	settings : null,
+	div = null; // release memory in IE
+})();
 
-	cleanup : null,
+if ( document.querySelectorAll ) {
+	(function(){
+		var oldSizzle = Sizzle, div = document.createElement("div");
+		div.innerHTML = "<p class='TEST'></p>";
 
-	getData : function(na) {
-		var o = this.data[na];
+		// Safari can't handle uppercase or unicode characters when
+		// in quirks mode.
+		if ( div.querySelectorAll && div.querySelectorAll(".TEST").length === 0 ) {
+			return;
+		}
+	
+		Sizzle = function(query, context, extra, seed){
+			context = context || document;
 
-		if (!o)
-			o = this.data[na] = {};
+			// Only use querySelectorAll on non-XML documents
+			// (ID selectors don't work in non-HTML documents)
+			if ( !seed && context.nodeType === 9 && !Sizzle.isXML(context) ) {
+				try {
+					return makeArray( context.querySelectorAll(query), extra );
+				} catch(e){}
+			}
+		
+			return oldSizzle(query, context, extra, seed);
+		};
 
-		return o;
-	},
+		for ( var prop in oldSizzle ) {
+			Sizzle[ prop ] = oldSizzle[ prop ];
+		}
 
-	hasPlugin : function(n) {
-		var i;
+		div = null; // release memory in IE
+	})();
+}
 
-		for (i=0; i<this.plugins.length; i++) {
-			if (this.plugins[i] == n)
-				return true;
-		}
+(function(){
+	var div = document.createElement("div");
 
-		return false;
-	},
+	div.innerHTML = "<div class='test e'></div><div class='test'></div>";
 
-	addPlugin : function(n, p) {
-		if (!this.hasPlugin(n)) {
-			tinyMCE.addPlugin(n, p);
-			this.plugins[this.plugins.length] = n;
+	// Opera can't find a second classname (in 9.6)
+	// Also, make sure that getElementsByClassName actually exists
+	if ( !div.getElementsByClassName || div.getElementsByClassName("e").length === 0 ) {
+		return;
+	}
+
+	// Safari caches class attributes, doesn't catch changes (in 3.2)
+	div.lastChild.className = "e";
+
+	if ( div.getElementsByClassName("e").length === 1 ) {
+		return;
+	}
+	
+	Expr.order.splice(1, 0, "CLASS");
+	Expr.find.CLASS = function(match, context, isXML) {
+		if ( typeof context.getElementsByClassName !== "undefined" && !isXML ) {
+			return context.getElementsByClassName(match[1]);
 		}
-	},
+	};
 
-	repaint : function() {
-		var s, b, ex;
+	div = null; // release memory in IE
+})();
 
-		if (tinyMCE.isRealIE)
-			return;
+function dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
+	for ( var i = 0, l = checkSet.length; i < l; i++ ) {
+		var elem = checkSet[i];
+		if ( elem ) {
+			elem = elem[dir];
+			var match = false;
 
-		try {
-			s = this.selection;
-			b = s.getBookmark(true);
-			this.getBody().style.display = 'none';
-			this.getDoc().execCommand('selectall', false, null);
-			this.getSel().collapseToStart();
-			this.getBody().style.display = 'block';
-			s.moveToBookmark(b);
-		} catch (ex) {
-			// Ignore
-		}
-	},
+			while ( elem ) {
+				if ( elem.sizcache === doneName ) {
+					match = checkSet[elem.sizset];
+					break;
+				}
 
-	switchSettings : function() {
-		if (tinyMCE.configs.length > 1 && tinyMCE.currentConfig != this.settings.index) {
-			tinyMCE.settings = this.settings;
-			tinyMCE.currentConfig = this.settings.index;
-		}
-	},
+				if ( elem.nodeType === 1 && !isXML ){
+					elem.sizcache = doneName;
+					elem.sizset = i;
+				}
 
-	select : function() {
-		var oldInst = tinyMCE.selectedInstance;
+				if ( elem.nodeName.toLowerCase() === cur ) {
+					match = elem;
+					break;
+				}
 
-		if (oldInst != this) {
-			if (oldInst)
-				oldInst.execCommand('mceEndTyping');
+				elem = elem[dir];
+			}
 
-			tinyMCE.dispatchCallback(this, 'select_instance_callback', 'selectInstance', this, oldInst);
-			tinyMCE.selectedInstance = this;
+			checkSet[i] = match;
 		}
-	},
+	}
+}
 
-	getBody : function() {
-		return this.contentBody ? this.contentBody : this.getDoc().body;
-	},
+function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) {
+	for ( var i = 0, l = checkSet.length; i < l; i++ ) {
+		var elem = checkSet[i];
+		if ( elem ) {
+			elem = elem[dir];
+			var match = false;
 
-	getDoc : function() {
-//		return this.contentDocument ? this.contentDocument : this.contentWindow.document; // Removed due to IE 5.5 ?
-		return this.contentWindow.document;
-	},
+			while ( elem ) {
+				if ( elem.sizcache === doneName ) {
+					match = checkSet[elem.sizset];
+					break;
+				}
 
-	getWin : function() {
-		return this.contentWindow;
-	},
+				if ( elem.nodeType === 1 ) {
+					if ( !isXML ) {
+						elem.sizcache = doneName;
+						elem.sizset = i;
+					}
+					if ( typeof cur !== "string" ) {
+						if ( elem === cur ) {
+							match = true;
+							break;
+						}
 
-	getContainerWin : function() {
-		return this.containerWindow ? this.containerWindow : window;
-	},
+					} else if ( Sizzle.filter( cur, [elem] ).length > 0 ) {
+						match = elem;
+						break;
+					}
+				}
 
-	getViewPort : function() {
-		return tinyMCE.getViewPort(this.getWin());
-	},
+				elem = elem[dir];
+			}
 
-	getParentNode : function(n, f) {
-		return tinyMCE.getParentNode(n, f, this.getBody());
-	},
+			checkSet[i] = match;
+		}
+	}
+}
 
-	getParentElement : function(n, na, f) {
-		return tinyMCE.getParentElement(n, na, f, this.getBody());
-	},
+Sizzle.contains = document.compareDocumentPosition ? function(a, b){
+	return !!(a.compareDocumentPosition(b) & 16);
+} : function(a, b){
+	return a !== b && (a.contains ? a.contains(b) : true);
+};
 
-	getParentBlockElement : function(n) {
-		return tinyMCE.getParentBlockElement(n, this.getBody());
-	},
+Sizzle.isXML = function(elem){
+	// documentElement is verified for cases where it doesn't yet exist
+	// (such as loading iframes in IE - #4833) 
+	var documentElement = (elem ? elem.ownerDocument || elem : 0).documentElement;
+	return documentElement ? documentElement.nodeName !== "HTML" : false;
+};
 
-	resizeToContent : function() {
-		var d = this.getDoc(), b = d.body, de = d.documentElement;
+var posProcess = function(selector, context){
+	var tmpSet = [], later = "", match,
+		root = context.nodeType ? [context] : context;
 
-		this.iframeElement.style.height = (tinyMCE.isRealIE) ? b.scrollHeight : de.offsetHeight + 'px';
-	},
+	// Position selectors must be done after the filter
+	// And so must :not(positional) so we move all PSEUDOs to the end
+	while ( (match = Expr.match.PSEUDO.exec( selector )) ) {
+		later += match[0];
+		selector = selector.replace( Expr.match.PSEUDO, "" );
+	}
 
-	addShortcut : function(m, k, d, cmd, ui, va) {
-		var n = typeof(k) == "number", ie = tinyMCE.isIE, c, sc, i, scl = this.shortcuts;
+	selector = Expr.relative[selector] ? selector + "*" : selector;
 
-		if (!tinyMCE.getParam('custom_shortcuts'))
-			return false;
+	for ( var i = 0, l = root.length; i < l; i++ ) {
+		Sizzle( selector, root[i], tmpSet );
+	}
 
-		m = m.toLowerCase();
-		k = ie && !n ? k.toUpperCase() : k;
-		c = n ? null : k.charCodeAt(0);
-		d = d && d.indexOf('lang_') == 0 ? tinyMCE.getLang(d) : d;
+	return Sizzle.filter( later, tmpSet );
+};
 
-		sc = {
-			alt : m.indexOf('alt') != -1,
-			ctrl : m.indexOf('ctrl') != -1,
-			shift : m.indexOf('shift') != -1,
-			charCode : c,
-			keyCode : n ? k : (ie ? c : null),
-			desc : d,
-			cmd : cmd,
-			ui : ui,
-			val : va
-		};
+// EXPOSE
 
-		for (i=0; i<scl.length; i++) {
-			if (sc.alt == scl[i].alt && sc.ctrl == scl[i].ctrl && sc.shift == scl[i].shift
-				&& sc.charCode == scl[i].charCode && sc.keyCode == scl[i].keyCode) {
-				return false;
-			}
-		}
+window.tinymce.dom.Sizzle = Sizzle;
 
-		scl[scl.length] = sc;
+})();
 
-		return true;
-	},
 
-	handleShortcut : function(e) {
-		var i, s, o;
+(function(tinymce) {
+	// Shorten names
+	var each = tinymce.each, DOM = tinymce.DOM, isIE = tinymce.isIE, isWebKit = tinymce.isWebKit, Event;
 
-		// Normal key press, then ignore it
-		if (!e.altKey && !e.ctrlKey)
-			return false;
+	tinymce.create('tinymce.dom.EventUtils', {
+		EventUtils : function() {
+			this.inits = [];
+			this.events = [];
+		},
 
-		s = this.shortcuts;
+		add : function(o, n, f, s) {
+			var cb, t = this, el = t.events, r;
 
-		for (i=0; i<s.length; i++) {
-			o = s[i];
+			if (n instanceof Array) {
+				r = [];
 
-			if (o.alt == e.altKey && o.ctrl == e.ctrlKey && (o.keyCode == e.keyCode || o.charCode == e.charCode)) {
-				if (o.cmd && (e.type == "keydown" || (e.type == "keypress" && !tinyMCE.isOpera)))
-					tinyMCE.execCommand(o.cmd, o.ui, o.val);
+				each(n, function(n) {
+					r.push(t.add(o, n, f, s));
+				});
 
-				tinyMCE.cancelEvent(e);
-				return true;
+				return r;
 			}
-		}
 
-		return false;
-	},
+			// Handle array
+			if (o && o.hasOwnProperty && o instanceof Array) {
+				r = [];
 
-	autoResetDesignMode : function() {
-		// Add fix for tab/style.display none/block problems in Gecko
-		if (!tinyMCE.isIE && this.isHidden() && tinyMCE.getParam('auto_reset_designmode'))
-			eval('try { this.getDoc().designMode = "On"; this.useCSS = false; } catch(e) {}');
-	},
+				each(o, function(o) {
+					o = DOM.get(o);
+					r.push(t.add(o, n, f, s));
+				});
 
-	isHidden : function() {
-		var s;
+				return r;
+			}
 
-		if (tinyMCE.isIE)
-			return false;
+			o = DOM.get(o);
 
-		s = this.getSel();
+			if (!o)
+				return;
 
-		// Weird, wheres that cursor selection?
-		return (!s || !s.rangeCount || s.rangeCount == 0);
-	},
+			// Setup event callback
+			cb = function(e) {
+				// Is all events disabled
+				if (t.disabled)
+					return;
 
-	isDirty : function() {
-		// Is content modified and not in a submit procedure
-		return tinyMCE.trim(this.startContent) != tinyMCE.trim(this.getBody().innerHTML) && !this.isNotDirty;
-	},
+				e = e || window.event;
 
-	_mergeElements : function(scmd, pa, ch, override) {
-		var st, stc, className, n;
+				// Patch in target, preventDefault and stopPropagation in IE it's W3C valid
+				if (e && isIE) {
+					if (!e.target)
+						e.target = e.srcElement;
 
-		if (scmd == "removeformat") {
-			pa.className = "";
-			pa.style.cssText = "";
-			ch.className = "";
-			ch.style.cssText = "";
-			return;
-		}
+					// Patch in preventDefault, stopPropagation methods for W3C compatibility
+					tinymce.extend(e, t._stoppers);
+				}
 
-		st = tinyMCE.parseStyle(tinyMCE.getAttrib(pa, "style"));
-		stc = tinyMCE.parseStyle(tinyMCE.getAttrib(ch, "style"));
-		className = tinyMCE.getAttrib(pa, "class");
+				if (!s)
+					return f(e);
 
-		// Removed class adding due to bug #1478272
-		className = tinyMCE.getAttrib(ch, "class");
+				return f.call(s, e);
+			};
 
-		if (override) {
-			for (n in st) {
-				if (typeof(st[n]) == 'function')
-					continue;
-
-				stc[n] = st[n];
+			if (n == 'unload') {
+				tinymce.unloads.unshift({func : cb});
+				return cb;
 			}
-		} else {
-			for (n in stc) {
-				if (typeof(stc[n]) == 'function')
-					continue;
 
-				st[n] = stc[n];
+			if (n == 'init') {
+				if (t.domLoaded)
+					cb();
+				else
+					t.inits.push(cb);
+
+				return cb;
 			}
-		}
 
-		tinyMCE.setAttrib(pa, "style", tinyMCE.serializeStyle(st));
-		tinyMCE.setAttrib(pa, "class", tinyMCE.trim(className));
-		ch.className = "";
-		ch.style.cssText = "";
-		ch.removeAttribute("class");
-		ch.removeAttribute("style");
-	},
+			// Store away listener reference
+			el.push({
+				obj : o,
+				name : n,
+				func : f,
+				cfunc : cb,
+				scope : s
+			});
 
-	_fixRootBlocks : function() {
-		var rb, b, ne, be, nx, bm;
+			t._add(o, n, cb);
 
-		rb = tinyMCE.getParam('forced_root_block');
-		if (!rb)
-			return;
+			return f;
+		},
 
-		b = this.getBody();
-		ne = b.firstChild;
+		remove : function(o, n, f) {
+			var t = this, a = t.events, s = false, r;
 
-		while (ne) {
-			nx = ne.nextSibling;
+			// Handle array
+			if (o && o.hasOwnProperty && o instanceof Array) {
+				r = [];
 
-			// If text node or inline element wrap it in a block element
-			if ((ne.nodeType == 3 && ne.nodeValue.replace(/\s+/g, '') != '') || (ne.nodeType == 1 && !tinyMCE.blockRegExp.test(ne.nodeName))) {
-				if (!bm)
-					bm = this.selection.getBookmark();
+				each(o, function(o) {
+					o = DOM.get(o);
+					r.push(t.remove(o, n, f));
+				});
 
-				if (!be) {
-					be = this.getDoc().createElement(rb);
-					be.appendChild(ne.cloneNode(true));
-					b.replaceChild(be, ne);
-				} else {
-					be.appendChild(ne.cloneNode(true));
-					b.removeChild(ne);
+				return r;
+			}
+
+			o = DOM.get(o);
+
+			each(a, function(e, i) {
+				if (e.obj == o && e.name == n && (!f || (e.func == f || e.cfunc == f))) {
+					a.splice(i, 1);
+					t._remove(o, n, e.cfunc);
+					s = true;
+					return false;
 				}
-			} else
-				be = null;
+			});
 
-			ne = nx;
-		}
+			return s;
+		},
 
-		if (bm)
-			this.selection.moveToBookmark(bm);
-	},
+		clear : function(o) {
+			var t = this, a = t.events, i, e;
 
-	_fixTrailingNbsp : function() {
-		var s = this.selection, e = s.getFocusElement(), bm, v;
+			if (o) {
+				o = DOM.get(o);
 
-		if (e && tinyMCE.blockRegExp.test(e.nodeName) && e.firstChild) {
-			v = e.firstChild.nodeValue;
+				for (i = a.length - 1; i >= 0; i--) {
+					e = a[i];
 
-			if (v && v.length > 1 && /(^\u00a0|\u00a0$)/.test(v)) {
-				e.firstChild.nodeValue = v.replace(/(^\u00a0|\u00a0$)/, '');
-				s.selectNode(e.firstChild, true, false, false); // Select and collapse
+					if (e.obj === o) {
+						t._remove(e.obj, e.name, e.cfunc);
+						e.obj = e.cfunc = null;
+						a.splice(i, 1);
+					}
+				}
 			}
-		}
-	},
+		},
 
-	_setUseCSS : function(b) {
-		var d = this.getDoc();
+		cancel : function(e) {
+			if (!e)
+				return false;
 
-		try {d.execCommand("useCSS", false, !b);} catch (ex) {}
-		try {d.execCommand("styleWithCSS", false, b);} catch (ex) {}
+			this.stop(e);
 
-		if (!tinyMCE.getParam("table_inline_editing"))
-			try {d.execCommand('enableInlineTableEditing', false, "false");} catch (ex) {}
+			return this.prevent(e);
+		},
 
-		if (!tinyMCE.getParam("object_resizing"))
-			try {d.execCommand('enableObjectResizing', false, "false");} catch (ex) {}
-	},
+		stop : function(e) {
+			if (e.stopPropagation)
+				e.stopPropagation();
+			else
+				e.cancelBubble = true;
 
-	execCommand : function(command, user_interface, value) {
-		var i, x, z, align, img, div, doc = this.getDoc(), win = this.getWin(), focusElm = this.getFocusElement();
+			return false;
+		},
 
-		// Is not a undo specific command
-		if (!new RegExp('mceStartTyping|mceEndTyping|mceBeginUndoLevel|mceEndUndoLevel|mceAddUndoLevel', 'gi').test(command))
-			this.undoBookmark = null;
+		prevent : function(e) {
+			if (e.preventDefault)
+				e.preventDefault();
+			else
+				e.returnValue = false;
 
-		// Mozilla issue
-		if (!tinyMCE.isIE && !this.useCSS) {
-			this._setUseCSS(false);
-			this.useCSS = true;
-		}
+			return false;
+		},
 
-		//debug("command: " + command + ", user_interface: " + user_interface + ", value: " + value);
-		this.contentDocument = doc; // <-- Strange, unless this is applied Mozilla 1.3 breaks
+		destroy : function() {
+			var t = this;
 
-		// Don't dispatch key commands
-		if (!/mceStartTyping|mceEndTyping/.test(command)) {
-			if (tinyMCE.execCommandCallback(this, 'execcommand_callback', 'execCommand', this.editorId, this.getBody(), command, user_interface, value))
+			each(t.events, function(e, i) {
+				t._remove(e.obj, e.name, e.cfunc);
+				e.obj = e.cfunc = null;
+			});
+
+			t.events = [];
+			t = null;
+		},
+
+		_add : function(o, n, f) {
+			if (o.attachEvent)
+				o.attachEvent('on' + n, f);
+			else if (o.addEventListener)
+				o.addEventListener(n, f, false);
+			else
+				o['on' + n] = f;
+		},
+
+		_remove : function(o, n, f) {
+			if (o) {
+				try {
+					if (o.detachEvent)
+						o.detachEvent('on' + n, f);
+					else if (o.removeEventListener)
+						o.removeEventListener(n, f, false);
+					else
+						o['on' + n] = null;
+				} catch (ex) {
+					// Might fail with permission denined on IE so we just ignore that
+				}
+			}
+		},
+
+		_pageInit : function(win) {
+			var t = this;
+
+			// Keep it from running more than once
+			if (t.domLoaded)
 				return;
-		}
 
-		// Fix align on images
-		if (focusElm && focusElm.nodeName == "IMG") {
-			align = focusElm.getAttribute('align');
-			img = command == "JustifyCenter" ? focusElm.cloneNode(false) : focusElm;
+			t.domLoaded = true;
 
-			switch (command) {
-				case "JustifyLeft":
-					if (align == 'left') {
-						img.setAttribute('align', ''); // Needed for IE
-						img.removeAttribute('align');
-					} else
-						img.setAttribute('align', 'left');
+			each(t.inits, function(c) {
+				c();
+			});
 
-					// Remove the div
-					div = focusElm.parentNode;
-					if (div && div.nodeName == "DIV" && div.childNodes.length == 1 && div.parentNode)
-						div.parentNode.replaceChild(img, div);
+			t.inits = [];
+		},
 
-					this.selection.selectNode(img);
-					this.repaint();
-					tinyMCE.triggerNodeChange();
-					return;
+		_wait : function(win) {
+			var t = this, doc = win.document;
 
-				case "JustifyCenter":
-					img.setAttribute('align', ''); // Needed for IE
-					img.removeAttribute('align');
+			// No need since the document is already loaded
+			if (win.tinyMCE_GZ && tinyMCE_GZ.loaded) {
+				t.domLoaded = 1;
+				return;
+			}
 
-					// Is centered
-					div = tinyMCE.getParentElement(focusElm, "div");
-					if (div && div.style.textAlign == "center") {
-						// Remove div
-						if (div.nodeName == "DIV" && div.childNodes.length == 1 && div.parentNode)
-							div.parentNode.replaceChild(img, div);
-					} else {
-						// Add div
-						div = this.getDoc().createElement("div");
-						div.style.textAlign = 'center';
-						div.appendChild(img);
-						focusElm.parentNode.replaceChild(div, focusElm);
+			// Use IE method
+			if (doc.attachEvent) {
+				doc.attachEvent("onreadystatechange", function() {
+					if (doc.readyState === "complete") {
+						doc.detachEvent("onreadystatechange", arguments.callee);
+						t._pageInit(win);
 					}
+				});
 
-					this.selection.selectNode(img);
-					this.repaint();
-					tinyMCE.triggerNodeChange();
-					return;
+				if (doc.documentElement.doScroll && win == win.top) {
+					(function() {
+						if (t.domLoaded)
+							return;
 
-				case "JustifyRight":
-					if (align == 'right') {
-						img.setAttribute('align', ''); // Needed for IE
-						img.removeAttribute('align');
-					} else
-						img.setAttribute('align', 'right');
+						try {
+							// If IE is used, use the trick by Diego Perini
+							// http://javascript.nwbox.com/IEContentLoaded/
+							doc.documentElement.doScroll("left");
+						} catch (ex) {
+							setTimeout(arguments.callee, 0);
+							return;
+						}
 
-					// Remove the div
-					div = focusElm.parentNode;
-					if (div && div.nodeName == "DIV" && div.childNodes.length == 1 && div.parentNode)
-						div.parentNode.replaceChild(img, div);
+						t._pageInit(win);
+					})();
+				}
+			} else if (doc.addEventListener) {
+				t._add(win, 'DOMContentLoaded', function() {
+					t._pageInit(win);
+				});
+			}
 
-					this.selection.selectNode(img);
-					this.repaint();
-					tinyMCE.triggerNodeChange();
-					return;
+			t._add(win, 'load', function() {
+				t._pageInit(win);
+			});
+		},
+
+		_stoppers : {
+			preventDefault :  function() {
+				this.returnValue = false;
+			},
+
+			stopPropagation : function() {
+				this.cancelBubble = true;
 			}
 		}
+	});
 
-		if (tinyMCE.settings.force_br_newlines) {
-			var alignValue = "";
+	Event = tinymce.dom.Event = new tinymce.dom.EventUtils();
 
-			if (doc.selection.type != "Control") {
-				switch (command) {
-						case "JustifyLeft":
-							alignValue = "left";
-							break;
+	// Dispatch DOM content loaded event for IE and Safari
+	Event._wait(window);
 
-						case "JustifyCenter":
-							alignValue = "center";
-							break;
+	tinymce.addUnload(function() {
+		Event.destroy();
+	});
+})(tinymce);
 
-						case "JustifyFull":
-							alignValue = "justify";
-							break;
+(function(tinymce) {
+	tinymce.dom.Element = function(id, settings) {
+		var t = this, dom, el;
 
-						case "JustifyRight":
-							alignValue = "right";
-							break;
-				}
+		t.settings = settings = settings || {};
+		t.id = id;
+		t.dom = dom = settings.dom || tinymce.DOM;
 
-				if (alignValue !== '') {
-					var rng = doc.selection.createRange();
+		// Only IE leaks DOM references, this is a lot faster
+		if (!tinymce.isIE)
+			el = dom.get(t.id);
 
-					if ((divElm = tinyMCE.getParentElement(rng.parentElement(), "div")) != null)
-						divElm.setAttribute("align", alignValue);
-					else if (rng.pasteHTML && rng.htmlText.length > 0)
-						rng.pasteHTML('<div align="' + alignValue + '">' + rng.htmlText + "</div>");
+		tinymce.each(
+				('getPos,getRect,getParent,add,setStyle,getStyle,setStyles,' + 
+				'setAttrib,setAttribs,getAttrib,addClass,removeClass,' + 
+				'hasClass,getOuterHTML,setOuterHTML,remove,show,hide,' + 
+				'isHidden,setHTML,get').split(/,/)
+			, function(k) {
+				t[k] = function() {
+					var a = [id], i;
 
-					tinyMCE.triggerNodeChange();
-					return;
+					for (i = 0; i < arguments.length; i++)
+						a.push(arguments[i]);
+
+					a = dom[k].apply(dom, a);
+					t.update(k);
+
+					return a;
+				};
+		});
+
+		tinymce.extend(t, {
+			on : function(n, f, s) {
+				return tinymce.dom.Event.add(t.id, n, f, s);
+			},
+
+			getXY : function() {
+				return {
+					x : parseInt(t.getStyle('left')),
+					y : parseInt(t.getStyle('top'))
+				};
+			},
+
+			getSize : function() {
+				var n = dom.get(t.id);
+
+				return {
+					w : parseInt(t.getStyle('width') || n.clientWidth),
+					h : parseInt(t.getStyle('height') || n.clientHeight)
+				};
+			},
+
+			moveTo : function(x, y) {
+				t.setStyles({left : x, top : y});
+			},
+
+			moveBy : function(x, y) {
+				var p = t.getXY();
+
+				t.moveTo(p.x + x, p.y + y);
+			},
+
+			resizeTo : function(w, h) {
+				t.setStyles({width : w, height : h});
+			},
+
+			resizeBy : function(w, h) {
+				var s = t.getSize();
+
+				t.resizeTo(s.w + w, s.h + h);
+			},
+
+			update : function(k) {
+				var b;
+
+				if (tinymce.isIE6 && settings.blocker) {
+					k = k || '';
+
+					// Ignore getters
+					if (k.indexOf('get') === 0 || k.indexOf('has') === 0 || k.indexOf('is') === 0)
+						return;
+
+					// Remove blocker on remove
+					if (k == 'remove') {
+						dom.remove(t.blocker);
+						return;
+					}
+
+					if (!t.blocker) {
+						t.blocker = dom.uniqueId();
+						b = dom.add(settings.container || dom.getRoot(), 'iframe', {id : t.blocker, style : 'position:absolute;', frameBorder : 0, src : 'javascript:""'});
+						dom.setStyle(b, 'opacity', 0);
+					} else
+						b = dom.get(t.blocker);
+
+					dom.setStyles(b, {
+						left : t.getStyle('left', 1),
+						top : t.getStyle('top', 1),
+						width : t.getStyle('width', 1),
+						height : t.getStyle('height', 1),
+						display : t.getStyle('display', 1),
+						zIndex : parseInt(t.getStyle('zIndex', 1) || 0) - 1
+					});
 				}
 			}
-		}
+		});
+	};
+})(tinymce);
 
-		switch (command) {
-			case "mceRepaint":
-				this.repaint();
-				return true;
+(function(tinymce) {
+	function trimNl(s) {
+		return s.replace(/[\n\r]+/g, '');
+	};
 
-			case "JustifyLeft":
-			case "JustifyCenter":
-			case "JustifyFull":
-			case "JustifyRight":
-				var el = tinyMCE.getParentNode(focusElm, function(n) {return tinyMCE.getAttrib(n, 'align');});
+	// Shorten names
+	var is = tinymce.is, isIE = tinymce.isIE, each = tinymce.each;
 
-				if (el) {
-					el.setAttribute('align', ''); // Needed for IE
-					el.removeAttribute('align');
-				} else
-					this.getDoc().execCommand(command, user_interface, value);
+	tinymce.create('tinymce.dom.Selection', {
+		Selection : function(dom, win, serializer) {
+			var t = this;
 
-				tinyMCE.triggerNodeChange();
+			t.dom = dom;
+			t.win = win;
+			t.serializer = serializer;
 
-				return true;
+			// Add events
+			each([
+				'onBeforeSetContent',
+				'onBeforeGetContent',
+				'onSetContent',
+				'onGetContent'
+			], function(e) {
+				t[e] = new tinymce.util.Dispatcher(t);
+			});
 
-			case "unlink":
-				// Unlink if caret is inside link
-				if (tinyMCE.isGecko && this.getSel().isCollapsed) {
-					focusElm = tinyMCE.getParentElement(focusElm, 'A');
+			// No W3C Range support
+			if (!t.win.getSelection)
+				t.tridentSel = new tinymce.dom.TridentSelection(t);
 
-					if (focusElm)
-						this.selection.selectNode(focusElm, false);
-				}
+			// Prevent leaks
+			tinymce.addUnload(t.destroy, t);
+		},
 
-				this.getDoc().execCommand(command, user_interface, value);
+		getContent : function(s) {
+			var t = this, r = t.getRng(), e = t.dom.create("body"), se = t.getSel(), wb, wa, n;
 
-				tinyMCE.isGecko && this.getSel().collapseToEnd();
+			s = s || {};
+			wb = wa = '';
+			s.get = true;
+			s.format = s.format || 'html';
+			t.onBeforeGetContent.dispatch(t, s);
 
-				tinyMCE.triggerNodeChange();
+			if (s.format == 'text')
+				return t.isCollapsed() ? '' : (r.text || (se.toString ? se.toString() : ''));
 
-				return true;
+			if (r.cloneContents) {
+				n = r.cloneContents();
 
-			case "InsertUnorderedList":
-			case "InsertOrderedList":
-				this.getDoc().execCommand(command, user_interface, value);
-				tinyMCE.triggerNodeChange();
-				break;
+				if (n)
+					e.appendChild(n);
+			} else if (is(r.item) || is(r.htmlText))
+				e.innerHTML = r.item ? r.item(0).outerHTML : r.htmlText;
+			else
+				e.innerHTML = r.toString();
 
-			case "Strikethrough":
-				this.getDoc().execCommand(command, user_interface, value);
-				tinyMCE.triggerNodeChange();
-				break;
+			// Keep whitespace before and after
+			if (/^\s/.test(e.innerHTML))
+				wb = ' ';
 
-			case "mceSelectNode":
-				this.selection.selectNode(value);
-				tinyMCE.triggerNodeChange();
-				tinyMCE.selectedNode = value;
-				break;
+			if (/\s+$/.test(e.innerHTML))
+				wa = ' ';
 
-			case "FormatBlock":
-				if (value == null || value == '') {
-					var elm = tinyMCE.getParentElement(this.getFocusElement(), "p,div,h1,h2,h3,h4,h5,h6,pre,address,blockquote,dt,dl,dd,samp");
+			s.getInner = true;
 
-					if (elm)
-						this.execCommand("mceRemoveNode", false, elm);
-				} else {
-					if (!this.cleanup.isValid(value))
-						return true;
+			s.content = t.isCollapsed() ? '' : wb + t.serializer.serialize(e, s) + wa;
+			t.onGetContent.dispatch(t, s);
 
-					if (tinyMCE.isGecko && new RegExp('<(div|blockquote|code|dt|dd|dl|samp)>', 'gi').test(value))
-						value = value.replace(/[^a-z]/gi, '');
+			return s.content;
+		},
 
-					if (tinyMCE.isIE && new RegExp('blockquote|code|samp', 'gi').test(value)) {
-						var b = this.selection.getBookmark();
-						this.getDoc().execCommand("FormatBlock", false, '<p>');
-						tinyMCE.renameElement(tinyMCE.getParentBlockElement(this.getFocusElement()), value);
-						this.selection.moveToBookmark(b);
-					} else
-						this.getDoc().execCommand("FormatBlock", false, value);
-				}
+		setContent : function(h, s) {
+			var t = this, r = t.getRng(), c, d = t.win.document;
 
-				tinyMCE.triggerNodeChange();
+			s = s || {format : 'html'};
+			s.set = true;
+			h = s.content = t.dom.processHTML(h);
 
-				break;
+			// Dispatch before set content event
+			t.onBeforeSetContent.dispatch(t, s);
+			h = s.content;
 
-			case "mceRemoveNode":
-				if (!value)
-					value = tinyMCE.getParentElement(this.getFocusElement());
+			if (r.insertNode) {
+				// Make caret marker since insertNode places the caret in the beginning of text after insert
+				h += '<span id="__caret">_</span>';
 
-				if (tinyMCE.isIE) {
-					value.outerHTML = value.innerHTML;
+				// Delete and insert new node
+				
+				if (r.startContainer == d && r.endContainer ==  d) {
+					// WebKit will fail if the body is empty since the range is then invalid and it can't insert contents
+					d.body.innerHTML = h;
 				} else {
-					var rng = value.ownerDocument.createRange();
-					rng.setStartBefore(value);
-					rng.setEndAfter(value);
-					rng.deleteContents();
-					rng.insertNode(rng.createContextualFragment(value.innerHTML));
+					r.deleteContents();
+					if (d.body.childNodes.length == 0) {
+						d.body.innerHTML = h;
+					} else {
+						r.insertNode(r.createContextualFragment(h));
+					}
 				}
 
-				tinyMCE.triggerNodeChange();
+				// Move to caret marker
+				c = t.dom.get('__caret');
+				// Make sure we wrap it compleatly, Opera fails with a simple select call
+				r = d.createRange();
+				r.setStartBefore(c);
+				r.setEndBefore(c);
+				t.setRng(r);
 
-				break;
+				// Remove the caret position
+				t.dom.remove('__caret');
+			} else {
+				if (r.item) {
+					// Delete content and get caret text selection
+					d.execCommand('Delete', false, null);
+					r = t.getRng();
+				}
 
-			case "mceSelectNodeDepth":
-				var parentNode = this.getFocusElement();
-				for (i=0; parentNode; i++) {
-					if (parentNode.nodeName.toLowerCase() == "body")
-						break;
+				r.pasteHTML(h);
+			}
 
-					if (parentNode.nodeName.toLowerCase() == "#text") {
-						i--;
-						parentNode = parentNode.parentNode;
-						continue;
-					}
+			// Dispatch set content event
+			t.onSetContent.dispatch(t, s);
+		},
 
-					if (i == value) {
-						this.selection.selectNode(parentNode, false);
-						tinyMCE.triggerNodeChange();
-						tinyMCE.selectedNode = parentNode;
-						return;
+		getStart : function() {
+			var rng = this.getRng(), startElement, parentElement, checkRng, node;
+
+			if (rng.duplicate || rng.item) {
+				// Control selection, return first item
+				if (rng.item)
+					return rng.item(0);
+
+				// Get start element
+				checkRng = rng.duplicate();
+				checkRng.collapse(1);
+				startElement = checkRng.parentElement();
+
+				// Check if range parent is inside the start element, then return the inner parent element
+				// This will fix issues when a single element is selected, IE would otherwise return the wrong start element
+				parentElement = node = rng.parentElement();
+				while (node = node.parentNode) {
+					if (node == startElement) {
+						startElement = parentElement;
+						break;
 					}
-
-					parentNode = parentNode.parentNode;
 				}
 
-				break;
+				// If start element is body element try to move to the first child if it exists
+				if (startElement && startElement.nodeName == 'BODY')
+					return startElement.firstChild || startElement;
 
-			case "mceSetStyleInfo":
-			case "SetStyleInfo":
-				var rng = this.getRng();
-				var sel = this.getSel();
-				var scmd = value.command;
-				var sname = value.name;
-				var svalue = value.value == null ? '' : value.value;
-				//var svalue = value['value'] == null ? '' : value['value'];
-				var wrapper = value.wrapper ? value.wrapper : "span";
-				var parentElm = null;
-				var invalidRe = new RegExp("^BODY|HTML$", "g");
-				var invalidParentsRe = tinyMCE.settings.merge_styles_invalid_parents !== '' ? new RegExp(tinyMCE.settings.merge_styles_invalid_parents, "gi") : null;
+				return startElement;
+			} else {
+				startElement = rng.startContainer;
 
-				// Whole element selected check
-				if (tinyMCE.isIE) {
-					// Control range
-					if (rng.item)
-						parentElm = rng.item(0);
-					else {
-						var pelm = rng.parentElement();
-						var prng = doc.selection.createRange();
-						prng.moveToElementText(pelm);
+				if (startElement.nodeType == 1 && startElement.hasChildNodes())
+					startElement = startElement.childNodes[Math.min(startElement.childNodes.length - 1, rng.startOffset)];
 
-						if (rng.htmlText == prng.htmlText || rng.boundingWidth == 0) {
-							if (invalidParentsRe == null || !invalidParentsRe.test(pelm.nodeName))
-								parentElm = pelm;
+				if (startElement && startElement.nodeType == 3)
+					return startElement.parentNode;
+
+				return startElement;
+			}
+		},
+
+		getEnd : function() {
+			var t = this, r = t.getRng(), e, eo;
+
+			if (r.duplicate || r.item) {
+				if (r.item)
+					return r.item(0);
+
+				r = r.duplicate();
+				r.collapse(0);
+				e = r.parentElement();
+
+				if (e && e.nodeName == 'BODY')
+					return e.lastChild || e;
+
+				return e;
+			} else {
+				e = r.endContainer;
+				eo = r.endOffset;
+
+				if (e.nodeType == 1 && e.hasChildNodes())
+					e = e.childNodes[eo > 0 ? eo - 1 : eo];
+
+				if (e && e.nodeType == 3)
+					return e.parentNode;
+
+				return e;
+			}
+		},
+
+		getBookmark : function(type, normalized) {
+			var t = this, dom = t.dom, rng, rng2, id, collapsed, name, element, index, chr = '\uFEFF', styles;
+
+			function findIndex(name, element) {
+				var index = 0;
+
+				each(dom.select(name), function(node, i) {
+					if (node == element)
+						index = i;
+				});
+
+				return index;
+			};
+
+			if (type == 2) {
+				function getLocation() {
+					var rng = t.getRng(true), root = dom.getRoot(), bookmark = {};
+
+					function getPoint(rng, start) {
+						var container = rng[start ? 'startContainer' : 'endContainer'],
+							offset = rng[start ? 'startOffset' : 'endOffset'], point = [], node, childNodes, after = 0;
+
+						if (container.nodeType == 3) {
+							if (normalized) {
+								for (node = container.previousSibling; node && node.nodeType == 3; node = node.previousSibling)
+									offset += node.nodeValue.length;
+							}
+
+							point.push(offset);
+						} else {
+							childNodes = container.childNodes;
+
+							if (offset >= childNodes.length && childNodes.length) {
+								after = 1;
+								offset = Math.max(0, childNodes.length - 1);
+							}
+
+							point.push(t.dom.nodeIndex(childNodes[offset], normalized) + after);
 						}
+
+						for (; container && container != root; container = container.parentNode)
+							point.push(t.dom.nodeIndex(container, normalized));
+
+						return point;
+					};
+
+					bookmark.start = getPoint(rng, true);
+
+					if (!t.isCollapsed())
+						bookmark.end = getPoint(rng);
+
+					return bookmark;
+				};
+
+				return getLocation();
+			}
+
+			// Handle simple range
+			if (type)
+				return {rng : t.getRng()};
+
+			rng = t.getRng();
+			id = dom.uniqueId();
+			collapsed = tinyMCE.activeEditor.selection.isCollapsed();
+			styles = 'overflow:hidden;line-height:0px';
+
+			// Explorer method
+			if (rng.duplicate || rng.item) {
+				// Text selection
+				if (!rng.item) {
+					rng2 = rng.duplicate();
+
+					// Insert start marker
+					rng.collapse();
+					rng.pasteHTML('<span _mce_type="bookmark" id="' + id + '_start" style="' + styles + '">' + chr + '</span>');
+
+					// Insert end marker
+					if (!collapsed) {
+						rng2.collapse(false);
+						rng2.pasteHTML('<span _mce_type="bookmark" id="' + id + '_end" style="' + styles + '">' + chr + '</span>');
 					}
 				} else {
-					var felm = this.getFocusElement();
-					if (sel.isCollapsed || (new RegExp('td|tr|tbody|table|img', 'gi').test(felm.nodeName) && sel.anchorNode == felm.parentNode))
-						parentElm = felm;
+					// Control selection
+					element = rng.item(0);
+					name = element.nodeName;
+
+					return {name : name, index : findIndex(name, element)};
 				}
+			} else {
+				element = t.getNode();
+				name = element.nodeName;
+				if (name == 'IMG')
+					return {name : name, index : findIndex(name, element)};
 
-				// Whole element selected
-				if (parentElm && !invalidRe.test(parentElm.nodeName)) {
-					if (scmd == "setstyle")
-						tinyMCE.setStyleAttrib(parentElm, sname, svalue);
+				// W3C method
+				rng2 = rng.cloneRange();
 
-					if (scmd == "setattrib")
-						tinyMCE.setAttrib(parentElm, sname, svalue);
+				// Insert end marker
+				if (!collapsed) {
+					rng2.collapse(false);
+					rng2.insertNode(dom.create('span', {_mce_type : "bookmark", id : id + '_end', style : styles}, chr));
+				}
 
-					if (scmd == "removeformat") {
-						parentElm.style.cssText = '';
-						tinyMCE.setAttrib(parentElm, 'class', '');
-					}
+				rng.collapse(true);
+				rng.insertNode(dom.create('span', {_mce_type : "bookmark", id : id + '_start', style : styles}, chr));
+			}
 
-					// Remove style/attribs from all children
-					var ch = tinyMCE.getNodeTree(parentElm, [], 1);
-					for (z=0; z<ch.length; z++) {
-						if (ch[z] == parentElm)
-							continue;
+			t.moveToBookmark({id : id, keep : 1});
 
-						if (scmd == "setstyle")
-							tinyMCE.setStyleAttrib(ch[z], sname, '');
+			return {id : id};
+		},
 
-						if (scmd == "setattrib")
-							tinyMCE.setAttrib(ch[z], sname, '');
+		moveToBookmark : function(bookmark) {
+			var t = this, dom = t.dom, marker1, marker2, rng, root, startContainer, endContainer, startOffset, endOffset;
 
-						if (scmd == "removeformat") {
-							ch[z].style.cssText = '';
-							tinyMCE.setAttrib(ch[z], 'class', '');
-						}
-					}
-				} else {
-					this._setUseCSS(false); // Bug in FF when running in fullscreen
-					doc.execCommand("FontName", false, "#mce_temp_font#");
-					var elementArray = tinyMCE.getElementsByAttributeValue(this.getBody(), "font", "face", "#mce_temp_font#");
+			// Clear selection cache
+			if (t.tridentSel)
+				t.tridentSel.destroy();
 
-					// Change them all
-					for (x=0; x<elementArray.length; x++) {
-						elm = elementArray[x];
-						if (elm) {
-							var spanElm = doc.createElement(wrapper);
+			if (bookmark) {
+				if (bookmark.start) {
+					rng = dom.createRng();
+					root = dom.getRoot();
 
-							if (scmd == "setstyle")
-								tinyMCE.setStyleAttrib(spanElm, sname, svalue);
+					function setEndPoint(start) {
+						var point = bookmark[start ? 'start' : 'end'], i, node, offset, children;
 
-							if (scmd == "setattrib")
-								tinyMCE.setAttrib(spanElm, sname, svalue);
+						if (point) {
+							// Find container node
+							for (node = root, i = point.length - 1; i >= 1; i--) {
+								children = node.childNodes;
 
-							if (scmd == "removeformat") {
-								spanElm.style.cssText = '';
-								tinyMCE.setAttrib(spanElm, 'class', '');
+								if (children.length)
+									node = children[point[i]];
 							}
 
-							if (elm.hasChildNodes()) {
-								for (i=0; i<elm.childNodes.length; i++)
-									spanElm.appendChild(elm.childNodes[i].cloneNode(true));
+							// Set offset within container node
+							if (start)
+								rng.setStart(node, point[0]);
+							else
+								rng.setEnd(node, point[0]);
+						}
+					};
+
+					setEndPoint(true);
+					setEndPoint();
+
+					t.setRng(rng);
+				} else if (bookmark.id) {
+					function restoreEndPoint(suffix) {
+						var marker = dom.get(bookmark.id + '_' + suffix), node, idx, next, prev, keep = bookmark.keep;
+
+						if (marker) {
+							node = marker.parentNode;
+
+							if (suffix == 'start') {
+								if (!keep) {
+									idx = dom.nodeIndex(marker);
+								} else {
+									node = marker.firstChild;
+									idx = 1;
+								}
+
+								startContainer = endContainer = node;
+								startOffset = endOffset = idx;
+							} else {
+								if (!keep) {
+									idx = dom.nodeIndex(marker);
+								} else {
+									node = marker.firstChild;
+									idx = 1;
+								}
+
+								endContainer = node;
+								endOffset = idx;
 							}
 
-							spanElm.setAttribute("mce_new", "true");
-							elm.parentNode.replaceChild(spanElm, elm);
+							if (!keep) {
+								prev = marker.previousSibling;
+								next = marker.nextSibling;
 
-							// Remove style/attribs from all children
-							var ch = tinyMCE.getNodeTree(spanElm, [], 1);
-							for (z=0; z<ch.length; z++) {
-								if (ch[z] == spanElm)
-									continue;
+								// Remove all marker text nodes
+								each(tinymce.grep(marker.childNodes), function(node) {
+									if (node.nodeType == 3)
+										node.nodeValue = node.nodeValue.replace(/\uFEFF/g, '');
+								});
 
-								if (scmd == "setstyle")
-									tinyMCE.setStyleAttrib(ch[z], sname, '');
+								// Remove marker but keep children if for example contents where inserted into the marker
+								// Also remove duplicated instances of the marker for example by a split operation or by WebKit auto split on paste feature
+								while (marker = dom.get(bookmark.id + '_' + suffix))
+									dom.remove(marker, 1);
 
-								if (scmd == "setattrib")
-									tinyMCE.setAttrib(ch[z], sname, '');
+								// If siblings are text nodes then merge them
+								if (prev && next && prev.nodeType == next.nodeType && prev.nodeType == 3) {
+									idx = prev.nodeValue.length;
+									prev.appendData(next.nodeValue);
+									dom.remove(next);
 
-								if (scmd == "removeformat") {
-									ch[z].style.cssText = '';
-									tinyMCE.setAttrib(ch[z], 'class', '');
+									if (suffix == 'start') {
+										startContainer = endContainer = prev;
+										startOffset = endOffset = idx;
+									} else {
+										endContainer = prev;
+										endOffset = idx;
+									}
 								}
 							}
 						}
+					};
+
+					function addBogus(node) {
+						// Adds a bogus BR element for empty block elements
+						// on non IE browsers just to have a place to put the caret
+						if (!isIE && dom.isBlock(node) && !node.innerHTML)
+							node.innerHTML = '<br _mce_bogus="1" />';
+
+						return node;
+					};
+
+					// Restore start/end points
+					restoreEndPoint('start');
+					restoreEndPoint('end');
+
+					if (startContainer) {
+						rng = dom.createRng();
+						rng.setStart(addBogus(startContainer), startOffset);
+						rng.setEnd(addBogus(endContainer), endOffset);
+						t.setRng(rng);
 					}
+				} else if (bookmark.name) {
+					t.select(dom.select(bookmark.name)[bookmark.index]);
+				} else if (bookmark.rng)
+					t.setRng(bookmark.rng);
+			}
+		},
+
+		select : function(node, content) {
+			var t = this, dom = t.dom, rng = dom.createRng(), idx;
+
+			idx = dom.nodeIndex(node);
+			rng.setStart(node.parentNode, idx);
+			rng.setEnd(node.parentNode, idx + 1);
+
+			// Find first/last text node or BR element
+			if (content) {
+				function setPoint(node, start) {
+					var walker = new tinymce.dom.TreeWalker(node, node);
+
+					do {
+						// Text node
+						if (node.nodeType == 3 && tinymce.trim(node.nodeValue).length != 0) {
+							if (start)
+								rng.setStart(node, 0);
+							else
+								rng.setEnd(node, node.nodeValue.length);
+
+							return;
+						}
+
+						// BR element
+						if (node.nodeName == 'BR') {
+							if (start)
+								rng.setStartBefore(node);
+							else
+								rng.setEndBefore(node);
+
+							return;
+						}
+					} while (node = (start ? walker.next() : walker.prev()));
+				};
+
+				setPoint(node, 1);
+				setPoint(node);
+			}
+
+			t.setRng(rng);
+
+			return node;
+		},
+
+		isCollapsed : function() {
+			var t = this, r = t.getRng(), s = t.getSel();
+
+			if (!r || r.item)
+				return false;
+
+			if (r.compareEndPoints)
+				return r.compareEndPoints('StartToEnd', r) === 0;
+
+			return !s || r.collapsed;
+		},
+
+		collapse : function(b) {
+			var t = this, r = t.getRng(), n;
+
+			// Control range on IE
+			if (r.item) {
+				n = r.item(0);
+				r = this.win.document.body.createTextRange();
+				r.moveToElementText(n);
+			}
+
+			r.collapse(!!b);
+			t.setRng(r);
+		},
+
+		getSel : function() {
+			var t = this, w = this.win;
+
+			return w.getSelection ? w.getSelection() : w.document.selection;
+		},
+
+		getRng : function(w3c) {
+			var t = this, s, r;
+
+			// Found tridentSel object then we need to use that one
+			if (w3c && t.tridentSel)
+				return t.tridentSel.getRangeAt(0);
+
+			try {
+				if (s = t.getSel())
+					r = s.rangeCount > 0 ? s.getRangeAt(0) : (s.createRange ? s.createRange() : t.win.document.createRange());
+			} catch (ex) {
+				// IE throws unspecified error here if TinyMCE is placed in a frame/iframe
+			}
+
+			// No range found then create an empty one
+			// This can occur when the editor is placed in a hidden container element on Gecko
+			// Or on IE when there was an exception
+			if (!r)
+				r = t.win.document.createRange ? t.win.document.createRange() : t.win.document.body.createTextRange();
+
+			if (t.selectedRange && t.explicitRange) {
+				if (r.compareBoundaryPoints(r.START_TO_START, t.selectedRange) === 0 && r.compareBoundaryPoints(r.END_TO_END, t.selectedRange) === 0) {
+					// Safari, Opera and Chrome only ever select text which causes the range to change.
+					// This lets us use the originally set range if the selection hasn't been changed by the user.
+					r = t.explicitRange;
+				} else {
+					t.selectedRange = null;
+					t.explicitRange = null;
 				}
+			}
+			return r;
+		},
 
-				// Cleaup wrappers
-				var nodes = doc.getElementsByTagName(wrapper);
-				for (i=nodes.length-1; i>=0; i--) {
-					var elm = nodes[i];
-					var isNew = tinyMCE.getAttrib(elm, "mce_new") == "true";
+		setRng : function(r) {
+			var s, t = this;
+			
+			if (!t.tridentSel) {
+				s = t.getSel();
 
-					elm.removeAttribute("mce_new");
+				if (s) {
+					t.explicitRange = r;
+					s.removeAllRanges();
+					s.addRange(r);
+					t.selectedRange = s.getRangeAt(0);
+				}
+			} else {
+				// Is W3C Range
+				if (r.cloneRange) {
+					t.tridentSel.addRange(r);
+					return;
+				}
 
-					// Is only child a element
-					if (elm.childNodes && elm.childNodes.length == 1 && elm.childNodes[0].nodeType == 1) {
-						//tinyMCE.debug("merge1" + isNew);
-						this._mergeElements(scmd, elm, elm.childNodes[0], isNew);
-						continue;
+				// Is IE specific range
+				try {
+					r.select();
+				} catch (ex) {
+					// Needed for some odd IE bug #1843306
+				}
+			}
+		},
+
+		setNode : function(n) {
+			var t = this;
+
+			t.setContent(t.dom.getOuterHTML(n));
+
+			return n;
+		},
+
+		getNode : function() {
+			var t = this, rng = t.getRng(), sel = t.getSel(), elm;
+
+			if (rng.setStart) {
+				// Range maybe lost after the editor is made visible again
+				if (!rng)
+					return t.dom.getRoot();
+
+				elm = rng.commonAncestorContainer;
+
+				// Handle selection a image or other control like element such as anchors
+				if (!rng.collapsed) {
+					if (rng.startContainer == rng.endContainer) {
+						if (rng.startOffset - rng.endOffset < 2) {
+							if (rng.startContainer.hasChildNodes())
+								elm = rng.startContainer.childNodes[rng.startOffset];
+						}
 					}
 
-					// Is I the only child
-					if (elm.parentNode.childNodes.length == 1 && !invalidRe.test(elm.nodeName) && !invalidRe.test(elm.parentNode.nodeName)) {
-						//tinyMCE.debug("merge2" + isNew + "," + elm.nodeName + "," + elm.parentNode.nodeName);
-						if (invalidParentsRe == null || !invalidParentsRe.test(elm.parentNode.nodeName))
-							this._mergeElements(scmd, elm.parentNode, elm, false);
-					}
+					// If the anchor node is a element instead of a text node then return this element
+					if (tinymce.isWebKit && sel.anchorNode && sel.anchorNode.nodeType == 1) 
+						return sel.anchorNode.childNodes[sel.anchorOffset]; 
 				}
 
-				// Remove empty wrappers
-				var nodes = doc.getElementsByTagName(wrapper);
-				for (i=nodes.length-1; i>=0; i--) {
-					var elm = nodes[i], isEmpty = true;
+				if (elm && elm.nodeType == 3)
+					return elm.parentNode;
 
-					// Check if it has any attribs
-					var tmp = doc.createElement("body");
-					tmp.appendChild(elm.cloneNode(false));
+				return elm;
+			}
 
-					// Is empty span, remove it
-					tmp.innerHTML = tmp.innerHTML.replace(new RegExp('style=""|class=""', 'gi'), '');
-					//tinyMCE.debug(tmp.innerHTML);
-					if (new RegExp('<span>', 'gi').test(tmp.innerHTML)) {
-						for (x=0; x<elm.childNodes.length; x++) {
-							if (elm.parentNode != null)
-								elm.parentNode.insertBefore(elm.childNodes[x].cloneNode(true), elm);
-						}
+			return rng.item ? rng.item(0) : rng.parentElement();
+		},
 
-						elm.parentNode.removeChild(elm);
-					}
+		getSelectedBlocks : function(st, en) {
+			var t = this, dom = t.dom, sb, eb, n, bl = [];
+
+			sb = dom.getParent(st || t.getStart(), dom.isBlock);
+			eb = dom.getParent(en || t.getEnd(), dom.isBlock);
+
+			if (sb)
+				bl.push(sb);
+
+			if (sb && eb && sb != eb) {
+				n = sb;
+
+				while ((n = n.nextSibling) && n != eb) {
+					if (dom.isBlock(n))
+						bl.push(n);
 				}
+			}
 
-				// Re add the visual aids
-				if (scmd == "removeformat")
-					tinyMCE.handleVisualAid(this.getBody(), true, this.visualAid, this);
+			if (eb && sb != eb)
+				bl.push(eb);
 
-				tinyMCE.triggerNodeChange();
+			return bl;
+		},
 
-				break;
+		destroy : function(s) {
+			var t = this;
 
-			case "FontName":
-				if (value == null) {
-					var s = this.getSel();
+			t.win = null;
 
-					// Find font and select it
-					if (tinyMCE.isGecko && s.isCollapsed) {
-						var f = tinyMCE.getParentElement(this.getFocusElement(), "font");
+			if (t.tridentSel)
+				t.tridentSel.destroy();
 
-						if (f != null)
-							this.selection.selectNode(f, false);
-					}
+			// Manual destroy then remove unload handler
+			if (!s)
+				tinymce.removeUnload(t.destroy);
+		}
+	});
+})(tinymce);
 
-					// Remove format
-					this.getDoc().execCommand("RemoveFormat", false, null);
+(function(tinymce) {
+	tinymce.create('tinymce.dom.XMLWriter', {
+		node : null,
 
-					// Collapse range if font was found
-					if (f != null && tinyMCE.isGecko) {
-						var r = this.getRng().cloneRange();
-						r.collapse(true);
-						s.removeAllRanges();
-						s.addRange(r);
-					}
+		XMLWriter : function(s) {
+			// Get XML document
+			function getXML() {
+				var i = document.implementation;
+
+				if (!i || !i.createDocument) {
+					// Try IE objects
+					try {return new ActiveXObject('MSXML2.DOMDocument');} catch (ex) {}
+					try {return new ActiveXObject('Microsoft.XmlDom');} catch (ex) {}
 				} else
-					this.getDoc().execCommand('FontName', false, value);
+					return i.createDocument('', '', null);
+			};
 
-				if (tinyMCE.isGecko)
-					window.setTimeout('tinyMCE.triggerNodeChange(false);', 1);
+			this.doc = getXML();
+			
+			// Since Opera and WebKit doesn't escape > into &gt; we need to do it our self to normalize the output for all browsers
+			this.valid = tinymce.isOpera || tinymce.isWebKit;
 
-				return;
+			this.reset();
+		},
 
-			case "FontSize":
-				this.getDoc().execCommand('FontSize', false, value);
+		reset : function() {
+			var t = this, d = t.doc;
 
-				if (tinyMCE.isGecko)
-					window.setTimeout('tinyMCE.triggerNodeChange(false);', 1);
+			if (d.firstChild)
+				d.removeChild(d.firstChild);
 
-				return;
+			t.node = d.appendChild(d.createElement("html"));
+		},
 
-			case "forecolor":
-				value = value == null ? this.foreColor : value;
-				value = tinyMCE.trim(value);
-				value = value.charAt(0) != '#' ? (isNaN('0x' + value) ? value : '#' + value) : value;
+		writeStartElement : function(n) {
+			var t = this;
 
-				this.foreColor = value;
-				this.getDoc().execCommand('forecolor', false, value);
-				break;
+			t.node = t.node.appendChild(t.doc.createElement(n));
+		},
 
-			case "HiliteColor":
-				value = value == null ? this.backColor : value;
-				value = tinyMCE.trim(value);
-				value = value.charAt(0) != '#' ? (isNaN('0x' + value) ? value : '#' + value) : value;
-				this.backColor = value;
+		writeAttribute : function(n, v) {
+			if (this.valid)
+				v = v.replace(/>/g, '%MCGT%');
 
-				if (tinyMCE.isGecko || tinyMCE.isOpera) {
-					this._setUseCSS(true);
-					this.getDoc().execCommand('hilitecolor', false, value);
-					this._setUseCSS(false);
-				} else
-					this.getDoc().execCommand('BackColor', false, value);
-				break;
+			this.node.setAttribute(n, v);
+		},
 
-			case "Cut":
-			case "Copy":
-			case "Paste":
-				var cmdFailed = false;
+		writeEndElement : function() {
+			this.node = this.node.parentNode;
+		},
 
-				// Try executing command
-				eval('try {this.getDoc().execCommand(command, user_interface, value);} catch (e) {cmdFailed = true;}');
+		writeFullEndElement : function() {
+			var t = this, n = t.node;
 
-				if (tinyMCE.isOpera && cmdFailed)
-					alert('Currently not supported by your browser, use keyboard shortcuts instead.');
+			n.appendChild(t.doc.createTextNode(""));
+			t.node = n.parentNode;
+		},
 
-				// Alert error in gecko if command failed
-				if (tinyMCE.isGecko && cmdFailed) {
-					// Confirm more info
-					if (confirm(tinyMCE.entityDecode(tinyMCE.getLang('lang_clipboard_msg'))))
-						window.open('http://www.mozilla.org/editor/midasdemo/securityprefs.html', 'mceExternal');
+		writeText : function(v) {
+			if (this.valid)
+				v = v.replace(/>/g, '%MCGT%');
 
-					return;
-				} else
-					tinyMCE.triggerNodeChange();
-			break;
+			this.node.appendChild(this.doc.createTextNode(v));
+		},
 
-			case "mceSetContent":
-				if (!value)
-					value = "";
+		writeCDATA : function(v) {
+			this.node.appendChild(this.doc.createCDATASection(v));
+		},
 
-				// Call custom cleanup code
-				value = tinyMCE.storeAwayURLs(value);
-				value = tinyMCE._customCleanup(this, "insert_to_editor", value);
+		writeComment : function(v) {
+			// Fix for bug #2035694
+			if (tinymce.isIE)
+				v = v.replace(/^\-|\-$/g, ' ');
 
-				if (this.getBody().nodeName == 'BODY')
-					tinyMCE._setHTML(doc, value);
-				else
-					this.getBody().innerHTML = value;
+			this.node.appendChild(this.doc.createComment(v.replace(/\-\-/g, ' ')));
+		},
 
-				tinyMCE.setInnerHTML(this.getBody(), tinyMCE._cleanupHTML(this, doc, this.settings, this.getBody(), false, false, false, true));
-				tinyMCE.convertAllRelativeURLs(this.getBody());
+		getContent : function() {
+			var h;
 
-				// Cleanup any mess left from storyAwayURLs
-				tinyMCE._removeInternal(this.getBody());
+			h = this.doc.xml || new XMLSerializer().serializeToString(this.doc);
+			h = h.replace(/<\?[^?]+\?>|<html>|<\/html>|<html\/>|<!DOCTYPE[^>]+>/g, '');
+			h = h.replace(/ ?\/>/g, ' />');
 
-				// When editing always use fonts internaly
-				if (tinyMCE.getParam("convert_fonts_to_spans"))
-					tinyMCE.convertSpansToFonts(doc);
+			if (this.valid)
+				h = h.replace(/\%MCGT%/g, '&gt;');
 
-				tinyMCE.handleVisualAid(this.getBody(), true, this.visualAid, this);
-				tinyMCE._setEventsEnabled(this.getBody(), false);
-				this._addBogusBR();
+			return h;
+		}
+	});
+})(tinymce);
 
-				return true;
+(function(tinymce) {
+	tinymce.create('tinymce.dom.StringWriter', {
+		str : null,
+		tags : null,
+		count : 0,
+		settings : null,
+		indent : null,
 
-			case "mceCleanup":
-				var b = this.selection.getBookmark();
-				tinyMCE._setHTML(this.contentDocument, this.getBody().innerHTML);
-				tinyMCE.setInnerHTML(this.getBody(), tinyMCE._cleanupHTML(this, this.contentDocument, this.settings, this.getBody(), this.visualAid));
-				tinyMCE.convertAllRelativeURLs(doc.body);
+		StringWriter : function(s) {
+			this.settings = tinymce.extend({
+				indent_char : ' ',
+				indentation : 0
+			}, s);
 
-				// When editing always use fonts internaly
-				if (tinyMCE.getParam("convert_fonts_to_spans"))
-					tinyMCE.convertSpansToFonts(doc);
+			this.reset();
+		},
 
-				tinyMCE.handleVisualAid(this.getBody(), true, this.visualAid, this);
-				tinyMCE._setEventsEnabled(this.getBody(), false);
-				this._addBogusBR();
-				this.repaint();
-				this.selection.moveToBookmark(b);
-				tinyMCE.triggerNodeChange();
-			break;
+		reset : function() {
+			this.indent = '';
+			this.str = "";
+			this.tags = [];
+			this.count = 0;
+		},
 
-			case "mceReplaceContent":
-				// Force empty string
-				if (!value)
-					value = '';
+		writeStartElement : function(n) {
+			this._writeAttributesEnd();
+			this.writeRaw('<' + n);
+			this.tags.push(n);
+			this.inAttr = true;
+			this.count++;
+			this.elementCount = this.count;
+		},
 
-				this.getWin().focus();
+		writeAttribute : function(n, v) {
+			var t = this;
 
-				var selectedText = "";
+			t.writeRaw(" " + t.encode(n) + '="' + t.encode(v) + '"');
+		},
 
-				if (tinyMCE.isIE) {
-					var rng = doc.selection.createRange();
-					selectedText = rng.text;
-				} else
-					selectedText = this.getSel().toString();
+		writeEndElement : function() {
+			var n;
 
-				if (selectedText.length > 0) {
-					value = tinyMCE.replaceVar(value, "selection", selectedText);
-					tinyMCE.execCommand('mceInsertContent', false, value);
+			if (this.tags.length > 0) {
+				n = this.tags.pop();
+
+				if (this._writeAttributesEnd(1))
+					this.writeRaw('</' + n + '>');
+
+				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(v) {
+			this._writeAttributesEnd();
+			this.writeRaw(this.encode(v));
+			this.count++;
+		},
+
+		writeCDATA : function(v) {
+			this._writeAttributesEnd();
+			this.writeRaw('<![CDATA[' + v + ']]>');
+			this.count++;
+		},
+
+		writeComment : function(v) {
+			this._writeAttributesEnd();
+			this.writeRaw('<!-- ' + v + '-->');
+			this.count++;
+		},
+
+		writeRaw : function(v) {
+			this.str += v;
+		},
+
+		encode : function(s) {
+			return s.replace(/[<>&"]/g, function(v) {
+				switch (v) {
+					case '<':
+						return '&lt;';
+
+					case '>':
+						return '&gt;';
+
+					case '&':
+						return '&amp;';
+
+					case '"':
+						return '&quot;';
 				}
 
-				this._addBogusBR();
-				tinyMCE.triggerNodeChange();
-			break;
+				return v;
+			});
+		},
 
-			case "mceSetAttribute":
-				if (typeof(value) == 'object') {
-					var targetElms = (typeof(value.targets) == "undefined") ? "p,img,span,div,td,h1,h2,h3,h4,h5,h6,pre,address" : value.targets;
-					var targetNode = tinyMCE.getParentElement(this.getFocusElement(), targetElms);
+		getContent : function() {
+			return this.str;
+		},
 
-					if (targetNode) {
-						targetNode.setAttribute(value.name, value.value);
-						tinyMCE.triggerNodeChange();
+		_writeAttributesEnd : function(s) {
+			if (!this.inAttr)
+				return;
+
+			this.inAttr = false;
+
+			if (s && this.elementCount == this.count) {
+				this.writeRaw(' />');
+				return false;
+			}
+
+			this.writeRaw('>');
+
+			return true;
+		}
+	});
+})(tinymce);
+
+(function(tinymce) {
+	// Shorten names
+	var extend = tinymce.extend, each = tinymce.each, Dispatcher = tinymce.util.Dispatcher, isIE = tinymce.isIE, isGecko = tinymce.isGecko;
+
+	function wildcardToRE(s) {
+		return s.replace(/([?+*])/g, '.$1');
+	};
+
+	tinymce.create('tinymce.dom.Serializer', {
+		Serializer : function(s) {
+			var t = this;
+
+			t.key = 0;
+			t.onPreProcess = new Dispatcher(t);
+			t.onPostProcess = new Dispatcher(t);
+
+			try {
+				t.writer = new tinymce.dom.XMLWriter();
+			} catch (ex) {
+				// IE might throw exception if ActiveX is disabled so we then switch to the slightly slower StringWriter
+				t.writer = new tinymce.dom.StringWriter();
+			}
+
+			// Default settings
+			t.settings = s = extend({
+				dom : tinymce.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,9
 13,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,88
 04,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'
+			}, s);
+
+			t.dom = s.dom;
+			t.schema = s.schema;
+
+			// Use raw entities if no entities are defined
+			if (s.entity_encoding == 'named' && !s.entities)
+				s.entity_encoding = 'raw';
+
+			if (s.remove_redundant_brs) {
+				t.onPostProcess.add(function(se, o) {
+					// Remove single BR at end of block elements since they get rendered
+					o.content = o.content.replace(/(<br \/>\s*)+<\/(p|h[1-6]|div|li)>/gi, function(a, b, c) {
+						// Check if it's a single element
+						if (/^<br \/>\s*<\//.test(a))
+							return '</' + c + '>';
+
+						return a;
+					});
+				});
+			}
+
+			// Remove XHTML element endings i.e. produce crap :) XHTML is better
+			if (s.element_format == 'html') {
+				t.onPostProcess.add(function(se, o) {
+					o.content = o.content.replace(/<([^>]+) \/>/g, '<$1>');
+				});
+			}
+
+			if (s.fix_list_elements) {
+				t.onPreProcess.add(function(se, o) {
+					var nl, x, a = ['ol', 'ul'], i, n, p, r = /^(OL|UL)$/, np;
+
+					function prevNode(e, n) {
+						var a = n.split(','), i;
+
+						while ((e = e.previousSibling) != null) {
+							for (i=0; i<a.length; i++) {
+								if (e.nodeName == a[i])
+									return e;
+							}
+						}
+
+						return null;
+					};
+
+					for (x=0; x<a.length; x++) {
+						nl = t.dom.select(a[x], o.node);
+
+						for (i=0; i<nl.length; i++) {
+							n = nl[i];
+							p = n.parentNode;
+
+							if (r.test(p.nodeName)) {
+								np = prevNode(n, 'LI');
+
+								if (!np) {
+									np = t.dom.create('li');
+									np.innerHTML = '&nbsp;';
+									np.appendChild(n);
+									p.insertBefore(np, p.firstChild);
+								} else
+									np.appendChild(n);
+							}
+						}
 					}
-				}
-			break;
+				});
+			}
 
-			case "mceSetCSSClass":
-				this.execCommand("mceSetStyleInfo", false, {command : "setattrib", name : "class", value : value});
-			break;
+			if (s.fix_table_elements) {
+				t.onPreProcess.add(function(se, o) {
+					// Since Opera will crash if you attach the node to a dynamic document we need to brrowser sniff a specific build
+					// so Opera users with an older version will have to live with less compaible output not much we can do here
+					if (!tinymce.isOpera || opera.buildNumber() >= 1767) {
+						each(t.dom.select('p table', o.node).reverse(), function(n) {
+							var parent = t.dom.getParent(n.parentNode, 'table,p');
 
-			case "mceInsertRawHTML":
-				var key = 'tiny_mce_marker';
+							if (parent.nodeName != 'TABLE') {
+								try {
+									t.dom.split(parent, n);
+								} catch (ex) {
+									// IE can sometimes fire an unknown runtime error so we just ignore it
+								}
+							}
+						});
+					}
+				});
+			}
+		},
 
-				this.execCommand('mceBeginUndoLevel');
+		setEntities : function(s) {
+			var t = this, a, i, l = {}, v;
 
-				// Insert marker key
-				this.execCommand('mceInsertContent', false, key);
+			// No need to setup more than once
+			if (t.entityLookup)
+				return;
 
-				// Store away scroll pos
-				var scrollX = this.getBody().scrollLeft + this.getDoc().documentElement.scrollLeft;
-				var scrollY = this.getBody().scrollTop + this.getDoc().documentElement.scrollTop;
+			// Build regex and lookup array
+			a = s.split(',');
+			for (i = 0; i < a.length; i += 2) {
+				v = a[i];
 
-				// Find marker and replace with RAW HTML
-				var html = this.getBody().innerHTML;
-				if ((pos = html.indexOf(key)) != -1)
-					tinyMCE.setInnerHTML(this.getBody(), html.substring(0, pos) + value + html.substring(pos + key.length));
+				// Don't add default &amp; &quot; etc.
+				if (v == 34 || v == 38 || v == 60 || v == 62)
+					continue;
 
-				// Restore scoll pos
-				this.contentWindow.scrollTo(scrollX, scrollY);
+				l[String.fromCharCode(a[i])] = a[i + 1];
 
-				this.execCommand('mceEndUndoLevel');
+				v = parseInt(a[i]).toString(16);
+			}
 
-				break;
+			t.entityLookup = l;
+		},
 
-			case "mceInsertContent":
-				// Force empty string
-				if (!value)
-					value = '';
+		setRules : function(s) {
+			var t = this;
 
-				var insertHTMLFailed = false;
+			t._setup();
+			t.rules = {};
+			t.wildRules = [];
+			t.validElements = {};
 
-				// Removed since it produced problems in IE
-				// this.getWin().focus();
+			return t.addRules(s);
+		},
 
-				if (tinyMCE.isGecko || tinyMCE.isOpera) {
-					try {
-						// Is plain text or HTML, &amp;, &nbsp; etc will be encoded wrong in FF
-						if (value.indexOf('<') == -1 && !value.match(/(&#38;|&#160;|&#60;|&#62;)/g)) {
-							var r = this.getRng();
-							var n = this.getDoc().createTextNode(tinyMCE.entityDecode(value));
-							var s = this.getSel();
-							var r2 = r.cloneRange();
+		addRules : function(s) {
+			var t = this, dr;
 
-							// Insert text at cursor position
-							s.removeAllRanges();
-							r.deleteContents();
-							r.insertNode(n);
+			if (!s)
+				return;
 
-							// Move the cursor to the end of text
-							r2.selectNode(n);
-							r2.collapse(false);
-							s.removeAllRanges();
-							s.addRange(r2);
+			t._setup();
+
+			each(s.split(','), function(s) {
+				var p = s.split(/\[|\]/), tn = p[0].split('/'), ra, at, wat, va = [];
+
+				// Extend with default rules
+				if (dr)
+					at = tinymce.extend([], dr.attribs);
+
+				// Parse attributes
+				if (p.length > 1) {
+					each(p[1].split('|'), function(s) {
+						var ar = {}, i;
+
+						at = at || [];
+
+						// Parse attribute rule
+						s = s.replace(/::/g, '~');
+						s = /^([!\-])?([\w*.?~_\-]+|)([=:<])?(.+)?$/.exec(s);
+						s[2] = s[2].replace(/~/g, ':');
+
+						// Add required attributes
+						if (s[1] == '!') {
+							ra = ra || [];
+							ra.push(s[2]);
+						}
+
+						// Remove inherited attributes
+						if (s[1] == '-') {
+							for (i = 0; i <at.length; i++) {
+								if (at[i].name == s[2]) {
+									at.splice(i, 1);
+									return;
+								}
+							}
+						}
+
+						switch (s[3]) {
+							// Add default attrib values
+							case '=':
+								ar.defaultVal = s[4] || '';
+								break;
+
+							// Add forced attrib values
+							case ':':
+								ar.forcedVal = s[4];
+								break;
+
+							// Add validation values
+							case '<':
+								ar.validVals = s[4].split('?');
+								break;
+						}
+
+						if (/[*.?]/.test(s[2])) {
+							wat = wat || [];
+							ar.nameRE = new RegExp('^' + wildcardToRE(s[2]) + '$');
+							wat.push(ar);
 						} else {
-							value = tinyMCE.fixGeckoBaseHREFBug(1, this.getDoc(), value);
-							this.getDoc().execCommand('inserthtml', false, value);
-							tinyMCE.fixGeckoBaseHREFBug(2, this.getDoc(), value);
+							ar.name = s[2];
+							at.push(ar);
 						}
-					} catch (ex) {
-						insertHTMLFailed = true;
+
+						va.push(s[2]);
+					});
+				}
+
+				// Handle element names
+				each(tn, function(s, i) {
+					var pr = s.charAt(0), x = 1, ru = {};
+
+					// Extend with default rule data
+					if (dr) {
+						if (dr.noEmpty)
+							ru.noEmpty = dr.noEmpty;
+
+						if (dr.fullEnd)
+							ru.fullEnd = dr.fullEnd;
+
+						if (dr.padd)
+							ru.padd = dr.padd;
 					}
 
-					if (!insertHTMLFailed) {
-						tinyMCE.triggerNodeChange();
-						return;
+					// Handle prefixes
+					switch (pr) {
+						case '-':
+							ru.noEmpty = true;
+							break;
+
+						case '+':
+							ru.fullEnd = true;
+							break;
+
+						case '#':
+							ru.padd = true;
+							break;
+
+						default:
+							x = 0;
 					}
-				}
 
-				if (!tinyMCE.isIE) {
-					var isHTML = value.indexOf('<') != -1;
-					var sel = this.getSel();
-					var rng = this.getRng();
+					tn[i] = s = s.substring(x);
+					t.validElements[s] = 1;
 
-					if (isHTML) {
-						if (tinyMCE.isSafari) {
-							var tmpRng = this.getDoc().createRange();
+					// Add element name or element regex
+					if (/[*.?]/.test(tn[0])) {
+						ru.nameRE = new RegExp('^' + wildcardToRE(tn[0]) + '$');
+						t.wildRules = t.wildRules || {};
+						t.wildRules.push(ru);
+					} else {
+						ru.name = tn[0];
 
-							tmpRng.setStart(this.getBody(), 0);
-							tmpRng.setEnd(this.getBody(), 0);
+						// Store away default rule
+						if (tn[0] == '@')
+							dr = ru;
 
-							value = tmpRng.createContextualFragment(value);
-						} else
-							value = rng.createContextualFragment(value);
-					} else {
-						// Setup text node
-						value = doc.createTextNode(tinyMCE.entityDecode(value));
+						t.rules[s] = ru;
 					}
 
-					// Insert plain text in Safari
-					if (tinyMCE.isSafari && !isHTML) {
-						this.execCommand('InsertText', false, value.nodeValue);
-						tinyMCE.triggerNodeChange();
-						return true;
-					} else if (tinyMCE.isSafari && isHTML) {
-						rng.deleteContents();
-						rng.insertNode(value);
-						tinyMCE.triggerNodeChange();
-						return true;
+					ru.attribs = at;
+
+					if (ra)
+						ru.requiredAttribs = ra;
+
+					if (wat) {
+						// Build valid attributes regexp
+						s = '';
+						each(va, function(v) {
+							if (s)
+								s += '|';
+
+							s += '(' + wildcardToRE(v) + ')';
+						});
+						ru.validAttribsRE = new RegExp('^' + s.toLowerCase() + '$');
+						ru.wildAttribs = wat;
 					}
+				});
+			});
 
-					rng.deleteContents();
+			// Build valid elements regexp
+			s = '';
+			each(t.validElements, function(v, k) {
+				if (s)
+					s += '|';
 
-					// If target node is text do special treatment, (Mozilla 1.3 fix)
-					if (rng.startContainer.nodeType == 3) {
-						var node = rng.startContainer.splitText(rng.startOffset);
-						node.parentNode.insertBefore(value, node); 
-					} else
-						rng.insertNode(value);
+				if (k != '@')
+					s += k;
+			});
+			t.validElementsRE = new RegExp('^(' + wildcardToRE(s.toLowerCase()) + ')$');
 
-					if (!isHTML) {
-						// Removes weird selection trails
-						sel.selectAllChildren(doc.body);
-						sel.removeAllRanges();
+			//console.debug(t.validElementsRE.toString());
+			//console.dir(t.rules);
+			//console.dir(t.wildRules);
+		},
 
-						// Move cursor to end of content
-						var rng = doc.createRange();
+		findRule : function(n) {
+			var t = this, rl = t.rules, i, r;
 
-						rng.selectNode(value);
-						rng.collapse(false);
+			t._setup();
 
-						sel.addRange(rng);
-					} else
-						rng.collapse(false);
+			// Exact match
+			r = rl[n];
+			if (r)
+				return r;
 
-					tinyMCE.fixGeckoBaseHREFBug(2, this.getDoc(), value);
-				} else {
-					var rng = doc.selection.createRange(), tmpRng = null;
-					var c = value.indexOf('<!--') != -1;
+			// Try wildcards
+			rl = t.wildRules;
+			for (i = 0; i < rl.length; i++) {
+				if (rl[i].nameRE.test(n))
+					return rl[i];
+			}
 
-					// Fix comment bug, add tag before comments
-					if (c)
-						value = tinyMCE.uniqueTag + value;
+			return null;
+		},
 
-					//	tmpRng = rng.duplicate(); // Store away range (Fixes Undo bookmark bug in IE)
+		findAttribRule : function(ru, n) {
+			var i, wa = ru.wildAttribs;
 
-					if (rng.item)
-						rng.item(0).outerHTML = value;
-					else
-						rng.pasteHTML(value);
+			for (i = 0; i < wa.length; i++) {
+				if (wa[i].nameRE.test(n))
+					return wa[i];
+			}
 
-					//if (tmpRng)
-					//	tmpRng.select(); // Restore range  (Fixes Undo bookmark bug in IE)
+			return null;
+		},
 
-					// Remove unique tag
-					if (c) {
-						var e = this.getDoc().getElementById('mceTMPElement');
-						e.parentNode.removeChild(e);
+		serialize : function(n, o) {
+			var h, t = this, doc, oldDoc, impl, selected;
+
+			t._setup();
+			o = o || {};
+			o.format = o.format || 'html';
+			t.processObj = o;
+
+			// IE looses the selected attribute on option elements so we need to store it
+			// See: http://support.microsoft.com/kb/829907
+			if (isIE) {
+				selected = [];
+				each(n.getElementsByTagName('option'), function(n) {
+					var v = t.dom.getAttrib(n, 'selected');
+
+					selected.push(v ? v : null);
+				});
+			}
+
+			n = n.cloneNode(true);
+
+			// IE looses the selected attribute on option elements so we need to restore it
+			if (isIE) {
+				each(n.getElementsByTagName('option'), function(n, i) {
+					t.dom.setAttrib(n, 'selected', selected[i]);
+				});
+			}
+
+			// Nodes needs to be attached to something in WebKit/Opera
+			// Older builds of Opera crashes if you attach the node to an document created dynamically
+			// and since we can't feature detect a crash we need to sniff the acutal build number
+			// This fix will make DOM ranges and make Sizzle happy!
+			impl = n.ownerDocument.implementation;
+			if (impl.createHTMLDocument && (tinymce.isOpera && opera.buildNumber() >= 1767)) {
+				// Create an empty HTML document
+				doc = impl.createHTMLDocument("");
+
+				// Add the element or it's children if it's a body element to the new document
+				each(n.nodeName == 'BODY' ? n.childNodes : [n], function(node) {
+					doc.body.appendChild(doc.importNode(node, true));
+				});
+
+				// Grab first child or body element for serialization
+				if (n.nodeName != 'BODY')
+					n = doc.body.firstChild;
+				else
+					n = doc.body;
+
+				// set the new document in DOMUtils so createElement etc works
+				oldDoc = t.dom.doc;
+				t.dom.doc = doc;
+			}
+
+			t.key = '' + (parseInt(t.key) + 1);
+
+			// Pre process
+			if (!o.no_events) {
+				o.node = n;
+				t.onPreProcess.dispatch(t, o);
+			}
+
+			// Serialize HTML DOM into a string
+			t.writer.reset();
+			t._info = o;
+			t._serializeNode(n, o.getInner);
+
+			// Post process
+			o.content = t.writer.getContent();
+
+			// Restore the old document if it was changed
+			if (oldDoc)
+				t.dom.doc = oldDoc;
+
+			if (!o.no_events)
+				t.onPostProcess.dispatch(t, o);
+
+			t._postProcess(o);
+			o.node = null;
+
+			return tinymce.trim(o.content);
+		},
+
+		// Internal functions
+
+		_postProcess : function(o) {
+			var t = this, s = t.settings, h = o.content, sc = [], p;
+
+			if (o.format == 'html') {
+				// Protect some elements
+				p = t._protect({
+					content : h,
+					patterns : [
+						{pattern : /(<script[^>]*>)(.*?)(<\/script>)/g},
+						{pattern : /(<noscript[^>]*>)(.*?)(<\/noscript>)/g},
+						{pattern : /(<style[^>]*>)(.*?)(<\/style>)/g},
+						{pattern : /(<pre[^>]*>)(.*?)(<\/pre>)/g, encode : 1},
+						{pattern : /(<!--\[CDATA\[)(.*?)(\]\]-->)/g}
+					]
+				});
+
+				h = p.content;
+
+				// Entity encode
+				if (s.entity_encoding !== 'raw')
+					h = t._encode(h);
+
+				// Use BR instead of &nbsp; padded P elements inside editor and use <p>&nbsp;</p> outside editor
+/*				if (o.set)
+					h = h.replace(/<p>\s+(&nbsp;|&#160;|\u00a0|<br \/>)\s+<\/p>/g, '<p><br /></p>');
+				else
+					h = h.replace(/<p>\s+(&nbsp;|&#160;|\u00a0|<br \/>)\s+<\/p>/g, '<p>$1</p>');*/
+
+				// Since Gecko and Safari keeps whitespace in the DOM we need to
+				// remove it inorder to match other browsers. But I think Gecko and Safari is right.
+				// This process is only done when getting contents out from the editor.
+				if (!o.set) {
+					// We need to replace paragraph whitespace with an nbsp before indentation to keep the \u00a0 char
+					h = h.replace(/<p>\s+<\/p>|<p([^>]+)>\s+<\/p>/g, s.entity_encoding == 'numeric' ? '<p$1>&#160;</p>' : '<p$1>&nbsp;</p>');
+
+					if (s.remove_linebreaks) {
+						h = h.replace(/\r?\n|\r/g, ' ');
+						h = h.replace(/(<[^>]+>)\s+/g, '$1 ');
+						h = h.replace(/\s+(<\/[^>]+>)/g, ' $1');
+						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
+						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
+						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
 					}
+
+					// Simple indentation
+					if (s.apply_source_formatting && s.indent_mode == 'simple') {
+						// Add line breaks before and after block elements
+						h = h.replace(/<(\/?)(ul|hr|table|meta|link|tbody|tr|object|body|head|html|map)(|[^>]+)>\s*/g, '\n<$1$2$3>\n');
+						h = h.replace(/\s*<(p|h[1-6]|blockquote|div|title|style|pre|script|td|li|area)(|[^>]+)>/g, '\n<$1$2>');
+						h = h.replace(/<\/(p|h[1-6]|blockquote|div|title|style|pre|script|td|li)>\s*/g, '</$1>\n');
+						h = h.replace(/\n\n/g, '\n');
+					}
 				}
 
-				tinyMCE.execCommand("mceAddUndoLevel");
-				tinyMCE.triggerNodeChange();
-			break;
+				h = t._unprotect(h, p);
 
-			case "mceStartTyping":
-				if (tinyMCE.settings.custom_undo_redo && this.undoRedo.typingUndoIndex == -1) {
-					this.undoRedo.typingUndoIndex = this.undoRedo.undoIndex;
-					tinyMCE.typingUndoIndex = tinyMCE.undoIndex;
-					this.execCommand('mceAddUndoLevel');
-				}
-				break;
+				// Restore CDATA sections
+				h = h.replace(/<!--\[CDATA\[([\s\S]+)\]\]-->/g, '<![CDATA[$1]]>');
 
-			case "mceEndTyping":
-				if (tinyMCE.settings.custom_undo_redo && this.undoRedo.typingUndoIndex != -1) {
-					this.execCommand('mceAddUndoLevel');
-					this.undoRedo.typingUndoIndex = -1;
-				}
+				// Restore the \u00a0 character if raw mode is enabled
+				if (s.entity_encoding == 'raw')
+					h = h.replace(/<p>&nbsp;<\/p>|<p([^>]+)>&nbsp;<\/p>/g, '<p$1>\u00a0</p>');
 
-				tinyMCE.typingUndoIndex = -1;
-				break;
+				// Restore noscript elements
+				h = h.replace(/<noscript([^>]+|)>([\s\S]*?)<\/noscript>/g, function(v, attribs, text) {
+					return '<noscript' + attribs + '>' + t.dom.decode(text.replace(/<!--|-->/g, '')) + '</noscript>';
+				});
+			}
 
-			case "mceBeginUndoLevel":
-				this.undoRedoLevel = false;
-				break;
+			o.content = h;
+		},
 
-			case "mceEndUndoLevel":
-				this.undoRedoLevel = true;
-				this.execCommand('mceAddUndoLevel');
-				break;
+		_serializeNode : function(n, inner) {
+			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;
 
-			case "mceAddUndoLevel":
-				if (tinyMCE.settings.custom_undo_redo && this.undoRedoLevel) {
-					if (this.undoRedo.add())
-						tinyMCE.triggerNodeChange(false);
-				}
-				break;
+			if (!s.node_filter || s.node_filter(n)) {
+				switch (n.nodeType) {
+					case 1: // Element
+						if (n.hasAttribute ? n.hasAttribute('_mce_bogus') : n.getAttribute('_mce_bogus'))
+							return;
 
-			case "Undo":
-				if (tinyMCE.settings.custom_undo_redo) {
-					tinyMCE.execCommand("mceEndTyping");
-					this.undoRedo.undo();
-					tinyMCE.triggerNodeChange();
-				} else
-					this.getDoc().execCommand(command, user_interface, value);
-				break;
+						iv = keep = false;
+						hc = n.hasChildNodes();
+						nn = n.getAttribute('_mce_name') || n.nodeName.toLowerCase();
 
-			case "Redo":
-				if (tinyMCE.settings.custom_undo_redo) {
-					tinyMCE.execCommand("mceEndTyping");
-					this.undoRedo.redo();
-					tinyMCE.triggerNodeChange();
-				} else
-					this.getDoc().execCommand(command, user_interface, value);
-				break;
+						// Get internal type
+						type = n.getAttribute('_mce_type');
+						if (type) {
+							if (!t._info.cleanup) {
+								iv = true;
+								return;
+							} else
+								keep = 1;
+						}
 
-			case "mceToggleVisualAid":
-				this.visualAid = !this.visualAid;
-				tinyMCE.handleVisualAid(this.getBody(), true, this.visualAid, this);
-				tinyMCE.triggerNodeChange();
-				break;
+						// Add correct prefix on IE
+						if (isIE) {
+							scopeName = n.scopeName;
+							if (scopeName && scopeName !== 'HTML' && scopeName !== 'html')
+								nn = scopeName + ':' + nn;
+						}
 
-			case "Indent":
-				this.getDoc().execCommand(command, user_interface, value);
-				tinyMCE.triggerNodeChange();
+						// Remove mce prefix on IE needed for the abbr element
+						if (nn.indexOf('mce:') === 0)
+							nn = nn.substring(4);
 
-				if (tinyMCE.isIE) {
-					var n = tinyMCE.getParentElement(this.getFocusElement(), "blockquote");
-					do {
-						if (n && n.nodeName == "BLOCKQUOTE") {
-							n.removeAttribute("dir");
-							n.removeAttribute("style");
+						// Check if valid
+						if (!keep) {
+							if (!t.validElementsRE || !t.validElementsRE.test(nn) || (t.invalidElementsRE && t.invalidElementsRE.test(nn)) || inner) {
+								iv = true;
+								break;
+							}
 						}
-					} while (n != null && (n = n.parentNode) != null);
-				}
-				break;
 
-			case "RemoveFormat":
-			case "removeformat":
-				var text = this.selection.getSelectedText();
+						if (isIE) {
+							// Fix IE content duplication (DOM can have multiple copies of the same node)
+							if (s.fix_content_duplication) {
+								if (n._mce_serialized == t.key)
+									return;
 
-				if (tinyMCE.isOpera) {
-					this.getDoc().execCommand("RemoveFormat", false, null);
-					return;
-				}
+								n._mce_serialized = t.key;
+							}
 
-				if (tinyMCE.isIE) {
-					try {
-						var rng = doc.selection.createRange();
-						rng.execCommand("RemoveFormat", false, null);
-					} catch (e) {
-						// Do nothing
-					}
+							// IE sometimes adds a / infront of the node name
+							if (nn.charAt(0) == '/')
+								nn = nn.substring(1);
+						} else if (isGecko) {
+							// Ignore br elements
+							if (n.nodeName === 'BR' && n.getAttribute('type') == '_moz')
+								return;
+						}
 
-					this.execCommand("mceSetStyleInfo", false, {command : "removeformat"});
-				} else {
-					this.getDoc().execCommand(command, user_interface, value);
+						// Check if valid child
+						if (s.validate_children) {
+							if (t.elementName && !t.schema.isValid(t.elementName, nn)) {
+								iv = true;
+								break;
+							}
 
-					this.execCommand("mceSetStyleInfo", false, {command : "removeformat"});
-				}
+							t.elementName = nn;
+						}
 
-				// Remove class
-				if (text.length == 0)
-					this.execCommand("mceSetCSSClass", false, "");
+						ru = t.findRule(nn);
+						
+						// No valid rule for this element could be found then skip it
+						if (!ru) {
+							iv = true;
+							break;
+						}
 
-				tinyMCE.triggerNodeChange();
-				break;
+						nn = ru.name || nn;
+						closed = s.closed.test(nn);
 
-			default:
-				this.getDoc().execCommand(command, user_interface, value);
+						// Skip empty nodes or empty node name in IE
+						if ((!hc && ru.noEmpty) || (isIE && !nn)) {
+							iv = true;
+							break;
+						}
 
-				if (tinyMCE.isGecko)
-					window.setTimeout('tinyMCE.triggerNodeChange(false);', 1);
-				else
-					tinyMCE.triggerNodeChange();
-		}
+						// Check required
+						if (ru.requiredAttribs) {
+							a = ru.requiredAttribs;
 
-		// Add undo level after modification
-		if (command != "mceAddUndoLevel" && command != "Undo" && command != "Redo" && command != "mceStartTyping" && command != "mceEndTyping")
-			tinyMCE.execCommand("mceAddUndoLevel");
-	},
+							for (i = a.length - 1; i >= 0; i--) {
+								if (this.dom.getAttrib(n, a[i]) !== '')
+									break;
+							}
 
-	queryCommandValue : function(c) {
-		try {
-			return this.getDoc().queryCommandValue(c);
-		} catch (e) {
-			return null;
-		}
-	},
+							// None of the required was there
+							if (i == -1) {
+								iv = true;
+								break;
+							}
+						}
 
-	queryCommandState : function(c) {
-		return this.getDoc().queryCommandState(c);
-	},
+						w.writeStartElement(nn);
 
-	_addBogusBR : function() {
-		var b = this.getBody();
+						// Add ordered attributes
+						if (ru.attribs) {
+							for (i=0, at = ru.attribs, l = at.length; i<l; i++) {
+								a = at[i];
+								v = t._getAttrib(n, a);
 
-		if (tinyMCE.isGecko && !b.hasChildNodes())
-			b.innerHTML = '<br _moz_editor_bogus_node="TRUE" />';
-	},
+								if (v !== null)
+									w.writeAttribute(a.name, v);
+							}
+						}
 
-	_onAdd : function(replace_element, form_element_name, target_document) {
-		var hc, th, tos, editorTemplate, targetDoc, deltaWidth, deltaHeight, html, rng, fragment;
-		var dynamicIFrame, tElm, doc, parentElm;
+						// Add wild attributes
+						if (ru.validAttribsRE) {
+							at = t.dom.getAttribs(n);
+							for (i=at.length-1; i>-1; i--) {
+								no = at[i];
 
-		th = this.settings.theme;
-		tos = tinyMCE.themes[th];
+								if (no.specified) {
+									a = no.nodeName.toLowerCase();
 
-		targetDoc = target_document ? target_document : document;
+									if (s.invalid_attrs.test(a) || !ru.validAttribsRE.test(a))
+										continue;
 
-		this.targetDoc = targetDoc;
+									ar = t.findAttribRule(ru, a);
+									v = t._getAttrib(n, ar, a);
 
-		tinyMCE.themeURL = tinyMCE.baseURL + "/themes/" + this.settings.theme;
-		this.settings.themeurl = tinyMCE.themeURL;
+									if (v !== null)
+										w.writeAttribute(a, v);
+								}
+							}
+						}
 
-		if (!replace_element) {
-			alert("Error: Could not find the target element.");
-			return false;
-		}
+						// Keep type attribute
+						if (type && keep)
+							w.writeAttribute('_mce_type', type);
 
-		if (tos.getEditorTemplate)
-			editorTemplate = tos.getEditorTemplate(this.settings, this.editorId);
+						// Write text from script
+						if (nn === 'script' && tinymce.trim(n.innerHTML)) {
+							w.writeText('// '); // Padd it with a comment so it will parse on older browsers
+							w.writeCDATA(n.innerHTML.replace(/<!--|-->|<\[CDATA\[|\]\]>/g, '')); // Remove comments and cdata stuctures
+							hc = false;
+							break;
+						}
 
-		deltaWidth = editorTemplate.delta_width ? editorTemplate.delta_width : 0;
-		deltaHeight = editorTemplate.delta_height ? editorTemplate.delta_height : 0;
-		html = '<span id="' + this.editorId + '_parent" class="mceEditorContainer">' + editorTemplate.html;
+						// Padd empty nodes with a &nbsp;
+						if (ru.padd) {
+							// If it has only one bogus child, padd it anyway workaround for <td><br /></td> bug
+							if (hc && (cn = n.firstChild) && cn.nodeType === 1 && n.childNodes.length === 1) {
+								if (cn.hasAttribute ? cn.hasAttribute('_mce_bogus') : cn.getAttribute('_mce_bogus'))
+									w.writeText('\u00a0');
+							} else if (!hc)
+								w.writeText('\u00a0'); // No children then padd it
+						}
 
-		html = tinyMCE.replaceVar(html, "editor_id", this.editorId);
+						break;
 
-		if (!this.settings.default_document)
-			this.settings.default_document = tinyMCE.baseURL + "/blank.htm";
+					case 3: // Text
+						// Check if valid child
+						if (s.validate_children && t.elementName && !t.schema.isValid(t.elementName, '#text'))
+							return;
 
-		this.settings.old_width = this.settings.width;
-		this.settings.old_height = this.settings.height;
+						return w.writeText(n.nodeValue);
 
-		// Set default width, height
-		if (this.settings.width == -1)
-			this.settings.width = replace_element.offsetWidth;
+					case 4: // CDATA
+						return w.writeCDATA(n.nodeValue);
 
-		if (this.settings.height == -1)
-			this.settings.height = replace_element.offsetHeight;
+					case 8: // Comment
+						return w.writeComment(n.nodeValue);
+				}
+			} else if (n.nodeType == 1)
+				hc = n.hasChildNodes();
 
-		// Try the style width
-		if (this.settings.width == 0)
-			this.settings.width = replace_element.style.width;
+			if (hc && !closed) {
+				cn = n.firstChild;
 
-		// Try the style height
-		if (this.settings.height == 0)
-			this.settings.height = replace_element.style.height; 
+				while (cn) {
+					t._serializeNode(cn);
+					t.elementName = nn;
+					cn = cn.nextSibling;
+				}
+			}
 
-		// If no width/height then default to 320x240, better than nothing
-		if (this.settings.width == 0)
-			this.settings.width = 320;
+			// Write element end
+			if (!iv) {
+				if (!closed)
+					w.writeFullEndElement();
+				else
+					w.writeEndElement();
+			}
+		},
 
-		if (this.settings.height == 0)
-			this.settings.height = 240;
+		_protect : function(o) {
+			var t = this;
 
-		this.settings.area_width = parseInt(this.settings.width);
-		this.settings.area_height = parseInt(this.settings.height);
-		this.settings.area_width += deltaWidth;
-		this.settings.area_height += deltaHeight;
-		this.settings.width_style = "" + this.settings.width;
-		this.settings.height_style = "" + this.settings.height;
+			o.items = o.items || [];
 
-		// Special % handling
-		if (("" + this.settings.width).indexOf('%') != -1)
-			this.settings.area_width = "100%";
-		else
-			this.settings.width_style += 'px';
+			function enc(s) {
+				return s.replace(/[\r\n\\]/g, function(c) {
+					if (c === '\n')
+						return '\\n';
+					else if (c === '\\')
+						return '\\\\';
 
-		if (("" + this.settings.height).indexOf('%') != -1)
-			this.settings.area_height = "100%";
-		else
-			this.settings.height_style += 'px';
+					return '\\r';
+				});
+			};
 
-		if (("" + replace_element.style.width).indexOf('%') != -1) {
-			this.settings.width = replace_element.style.width;
-			this.settings.area_width = "100%";
-			this.settings.width_style = "100%";
-		}
+			function dec(s) {
+				return s.replace(/\\[\\rn]/g, function(c) {
+					if (c === '\\n')
+						return '\n';
+					else if (c === '\\\\')
+						return '\\';
 
-		if (("" + replace_element.style.height).indexOf('%') != -1) {
-			this.settings.height = replace_element.style.height;
-			this.settings.area_height = "100%";
-			this.settings.height_style = "100%";
-		}
+					return '\r';
+				});
+			};
 
-		html = tinyMCE.applyTemplate(html);
+			each(o.patterns, function(p) {
+				o.content = dec(enc(o.content).replace(p.pattern, function(x, a, b, c) {
+					b = dec(b);
 
-		this.settings.width = this.settings.old_width;
-		this.settings.height = this.settings.old_height;
+					if (p.encode)
+						b = t._encode(b);
 
-		this.visualAid = this.settings.visual;
-		this.formTargetElementId = form_element_name;
+					o.items.push(b);
+					return a + '<!--mce:' + (o.items.length - 1) + '-->' + c;
+				}));
+			});
 
-		// Get replace_element contents
-		if (replace_element.nodeName == "TEXTAREA" || replace_element.nodeName == "INPUT")
-			this.startContent = replace_element.value;
-		else
-			this.startContent = replace_element.innerHTML;
+			return o;
+		},
 
-		// If not text area or input
-		if (replace_element.nodeName != "TEXTAREA" && replace_element.nodeName != "INPUT") {
-			this.oldTargetElement = replace_element;
+		_unprotect : function(h, o) {
+			h = h.replace(/\<!--mce:([0-9]+)--\>/g, function(a, b) {
+				return o.items[parseInt(b)];
+			});
 
-			// Debug mode
-			hc = '<input type="hidden" id="' + form_element_name + '" name="' + form_element_name + '" />';
-			this.oldTargetDisplay = tinyMCE.getStyle(this.oldTargetElement, 'display', 'inline');
-			this.oldTargetElement.style.display = "none";
+			o.items = [];
 
-			html += '</span>';
+			return h;
+		},
 
-			if (tinyMCE.isGecko)
-				html = hc + html;
-			else
-				html += hc;
+		_encode : function(h) {
+			var t = this, s = t.settings, l;
 
-			// Output HTML and set editable
-			if (tinyMCE.isGecko) {
-				rng = replace_element.ownerDocument.createRange();
-				rng.setStartBefore(replace_element);
+			// Entity encode
+			if (s.entity_encoding !== 'raw') {
+				if (s.entity_encoding.indexOf('named') != -1) {
+					t.setEntities(s.entities);
+					l = t.entityLookup;
 
-				fragment = rng.createContextualFragment(html);
-				tinyMCE.insertAfter(fragment, replace_element);
-			} else
-				replace_element.insertAdjacentHTML("beforeBegin", html);
-		} else {
-			html += '</span>';
+					h = h.replace(/[\u007E-\uFFFF]/g, function(a) {
+						var v;
 
-			// Just hide the textarea element
-			this.oldTargetElement = replace_element;
+						if (v = l[a])
+							a = '&' + v + ';';
 
-			this.oldTargetDisplay = tinyMCE.getStyle(this.oldTargetElement, 'display', 'inline');
-			this.oldTargetElement.style.display = "none";
+						return a;
+					});
+				}
 
-			// Output HTML and set editable
-			if (tinyMCE.isGecko) {
-				rng = replace_element.ownerDocument.createRange();
-				rng.setStartBefore(replace_element);
+				if (s.entity_encoding.indexOf('numeric') != -1) {
+					h = h.replace(/[\u007E-\uFFFF]/g, function(a) {
+						return '&#' + a.charCodeAt(0) + ';';
+					});
+				}
+			}
 
-				fragment = rng.createContextualFragment(html);
-				tinyMCE.insertAfter(fragment, replace_element);
-			} else
-				replace_element.insertAdjacentHTML("beforeBegin", html);
-		}
+			return h;
+		},
 
-		// Setup iframe
-		dynamicIFrame = false;
-		tElm = targetDoc.getElementById(this.editorId);
+		_setup : function() {
+			var t = this, s = this.settings;
 
-		if (!tinyMCE.isIE) {
-			// Node case is preserved in XML strict mode
-			if (tElm && (tElm.nodeName == "SPAN" || tElm.nodeName == "span")) {
-				tElm = tinyMCE._createIFrame(tElm, targetDoc);
-				dynamicIFrame = true;
+			if (t.done)
+				return;
+
+			t.done = 1;
+
+			t.setRules(s.valid_elements);
+			t.addRules(s.extended_valid_elements);
+
+			if (s.invalid_elements)
+				t.invalidElementsRE = new RegExp('^(' + wildcardToRE(s.invalid_elements.replace(/,/g, '|').toLowerCase()) + ')$');
+
+			if (s.attrib_value_filter)
+				t.attribValueFilter = s.attribValueFilter;
+		},
+
+		_getAttrib : function(n, a, na) {
+			var i, v;
+
+			na = na || a.name;
+
+			if (a.forcedVal && (v = a.forcedVal)) {
+				if (v === '{$uid}')
+					return this.dom.uniqueId();
+
+				return v;
 			}
 
-			this.targetElement = tElm;
-			this.iframeElement = tElm;
-			this.contentDocument = tElm.contentDocument;
-			this.contentWindow = tElm.contentWindow;
+			v = this.dom.getAttrib(n, na);
 
-			//this.getDoc().designMode = "on";
-		} else {
-			if (tElm && tElm.nodeName == "SPAN")
-				tElm = tinyMCE._createIFrame(tElm, targetDoc, targetDoc.parentWindow);
-			else
-				tElm = targetDoc.frames[this.editorId];
+			switch (na) {
+				case 'rowspan':
+				case 'colspan':
+					// Whats the point? Remove usless attribute value
+					if (v == '1')
+						v = '';
 
-			this.targetElement = tElm;
-			this.iframeElement = targetDoc.getElementById(this.editorId);
+					break;
+			}
 
-			if (tinyMCE.isOpera) {
-				this.contentDocument = this.iframeElement.contentDocument;
-				this.contentWindow = this.iframeElement.contentWindow;
-				dynamicIFrame = true;
+			if (this.attribValueFilter)
+				v = this.attribValueFilter(na, v, n);
+
+			if (a.validVals) {
+				for (i = a.validVals.length - 1; i >= 0; i--) {
+					if (v == a.validVals[i])
+						break;
+				}
+
+				if (i == -1)
+					return null;
+			}
+
+			if (v === '' && typeof(a.defaultVal) != 'undefined') {
+				v = a.defaultVal;
+
+				if (v === '{$uid}')
+					return this.dom.uniqueId();
+
+				return v;
 			} else {
-				this.contentDocument = tElm.window.document;
-				this.contentWindow = tElm.window;
+				// Remove internal mceItemXX classes when content is extracted from editor
+				if (na == 'class' && this.processObj.get)
+					v = v.replace(/\s?mceItem\w+\s?/g, '');
 			}
 
-			this.getDoc().designMode = "on";
+			if (v === '')
+				return null;
+
+
+			return v;
 		}
+	});
+})(tinymce);
 
-		// Setup base HTML
-		doc = this.contentDocument;
-		if (dynamicIFrame) {
-			html = tinyMCE.getParam('doctype') + '<html><head xmlns="http://www.w3.org/1999/xhtml"><base href="' + tinyMCE.settings.base_href + '" /><title>blank_page</title><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"></head><body class="mceContentBody"></body></html>';
+(function(tinymce) {
+	tinymce.dom.ScriptLoader = function(settings) {
+		var QUEUED = 0,
+			LOADING = 1,
+			LOADED = 2,
+			states = {},
+			queue = [],
+			scriptLoadedCallbacks = {},
+			queueLoadedCallbacks = [],
+			loading = 0,
+			undefined;
 
-			try {
-				if (!this.isHidden())
-					this.getDoc().designMode = "on";
+		function loadScript(url, callback) {
+			var t = this, dom = tinymce.DOM, elm, uri, loc, id;
 
-				doc.open();
-				doc.write(html);
-				doc.close();
-			} catch (e) {
-				// Failed Mozilla 1.3
-				this.getDoc().location.href = tinyMCE.baseURL + "/blank.htm";
+			// Execute callback when script is loaded
+			function done() {
+				dom.remove(id);
+
+				if (elm)
+					elm.onreadystatechange = elm.onload = elm = null;
+
+				callback();
+			};
+
+			id = dom.uniqueId();
+
+			if (tinymce.isIE6) {
+				uri = new tinymce.util.URI(url);
+				loc = location;
+
+				// If script is from same domain and we
+				// use IE 6 then use XHR since it's more reliable
+				if (uri.host == loc.hostname && uri.port == loc.port && (uri.protocol + ':') == loc.protocol) {
+					tinymce.util.XHR.send({
+						url : tinymce._addVer(uri.getURI()),
+						success : function(content) {
+							// Create new temp script element
+							var script = dom.create('script', {
+								type : 'text/javascript'
+							});
+
+							// Evaluate script in global scope
+							script.text = content;
+							document.getElementsByTagName('head')[0].appendChild(script);
+							dom.remove(script);
+
+							done();
+						}
+					});
+
+					return;
+				}
 			}
-		}
 
-		// This timeout is needed in MSIE 5.5 for some odd reason
-		// it seems that the document.frames isn't initialized yet?
-		if (tinyMCE.isIE)
-			window.setTimeout("tinyMCE.addEventHandlers(tinyMCE.instances[\"" + this.editorId + "\"]);", 1);
+			// Create new script element
+			elm = dom.create('script', {
+				id : id,
+				type : 'text/javascript',
+				src : tinymce._addVer(url)
+			});
 
-		// Setup element references
-		parentElm = this.targetDoc.getElementById(this.editorId + '_parent');
-		this.formElement = tinyMCE.isGecko ? parentElm.previousSibling : parentElm.nextSibling;
+			// Add onload and readystate listeners
+			elm.onload = done;
+			elm.onreadystatechange = function() {
+				var state = elm.readyState;
 
-		tinyMCE.setupContent(this.editorId, true);
+				// Loaded state is passed on IE 6 however there
+				// are known issues with this method but we can't use
+				// XHR in a cross domain loading
+				if (state == 'complete' || state == 'loaded')
+					done();
+			};
 
-		return true;
-	},
+			// Most browsers support this feature so we report errors
+			// for those at least to help users track their missing plugins etc
+			// todo: Removed since it produced error if the document is unloaded by navigating away, re-add it as an option
+			/*elm.onerror = function() {
+				alert('Failed to load: ' + url);
+			};*/
 
-	setBaseHREF : function(u) {
-		var h, b, d, nl;
+			// Add script to document
+			(document.getElementsByTagName('head')[0] || document.body).appendChild(elm);
+		};
 
-		d = this.getDoc();
-		nl = d.getElementsByTagName("base");
-		b = nl.length > 0 ? nl[0] : null;
+		this.isDone = function(url) {
+			return states[url] == LOADED;
+		};
 
-		if (!b) {
-			nl = d.getElementsByTagName("head");
-			h = nl.length > 0 ? nl[0] : null;
+		this.markDone = function(url) {
+			states[url] = LOADED;
+		};
 
-			b = d.createElement("base");
-			b.setAttribute('href', u);
-			h.appendChild(b);
-		} else {
-			if (u == '' || u == null)
-				b.parentNode.removeChild(b);
-			else
-				b.setAttribute('href', u);
-		}
-	},
+		this.add = this.load = function(url, callback, scope) {
+			var item, state = states[url];
 
-	getHTML : function(r) {
-		var h, d = this.getDoc(), b = this.getBody();
+			// Add url to load queue
+			if (state == undefined) {
+				queue.push(url);
+				states[url] = QUEUED;
+			}
 
-		if (r)
-			return b.innerHTML;
+			if (callback) {
+				// Store away callback for later execution
+				if (!scriptLoadedCallbacks[url])
+					scriptLoadedCallbacks[url] = [];
 
-		h = tinyMCE._cleanupHTML(this, d, this.settings, b, false, true, false, true);
+				scriptLoadedCallbacks[url].push({
+					func : callback,
+					scope : scope || this
+				});
+			}
+		};
 
-		if (tinyMCE.getParam("convert_fonts_to_spans"))
-			tinyMCE.convertSpansToFonts(d);
+		this.loadQueue = function(callback, scope) {
+			this.loadScripts(queue, callback, scope);
+		};
 
-		return h;
-	},
+		this.loadScripts = function(scripts, callback, scope) {
+			var loadScripts;
 
-	setHTML : function(h) {
-		this.execCommand('mceSetContent', false, h);
-		this.repaint();
-	},
+			function execScriptLoadedCallbacks(url) {
+				// Execute URL callback functions
+				tinymce.each(scriptLoadedCallbacks[url], function(callback) {
+					callback.func.call(callback.scope);
+				});
 
-	getFocusElement : function() {
-		return this.selection.getFocusElement();
-	},
+				scriptLoadedCallbacks[url] = undefined;
+			};
 
-	getSel : function() {
-		return this.selection.getSel();
-	},
+			queueLoadedCallbacks.push({
+				func : callback,
+				scope : scope || this
+			});
 
-	getRng : function() {
-		return this.selection.getRng();
-	},
+			loadScripts = function() {
+				var loadingScripts = tinymce.grep(scripts);
 
-	triggerSave : function(skip_cleanup, skip_callback) {
-		var e, nl = [], i, s, content, htm;
+				// Current scripts has been handled
+				scripts.length = 0;
 
-		if (!this.enabled)
-			return;
+				// Load scripts that needs to be loaded
+				tinymce.each(loadingScripts, function(url) {
+					// Script is already loaded then execute script callbacks directly
+					if (states[url] == LOADED) {
+						execScriptLoadedCallbacks(url);
+						return;
+					}
 
-		this.switchSettings();
-		s = tinyMCE.settings;
+					// Is script not loading then start loading it
+					if (states[url] != LOADING) {
+						states[url] = LOADING;
+						loading++;
 
-		// Force hidden tabs visible while serializing
-		if (tinyMCE.isRealIE) {
-			e = this.iframeElement;
+						loadScript(url, function() {
+							states[url] = LOADED;
+							loading--;
 
-			do {
-				if (e.style && e.style.display == 'none') {
-					e.style.display = 'block';
-					nl[nl.length] = {elm : e, type : 'style'};
+							execScriptLoadedCallbacks(url);
+
+							// Load more scripts if they where added by the recently loaded script
+							loadScripts();
+						});
+					}
+				});
+
+				// No scripts are currently loading then execute all pending queue loaded callbacks
+				if (!loading) {
+					tinymce.each(queueLoadedCallbacks, function(callback) {
+						callback.func.call(callback.scope);
+					});
+
+					queueLoadedCallbacks.length = 0;
 				}
+			};
 
-				if (e.style && s.hidden_tab_class.length > 0 && e.className.indexOf(s.hidden_tab_class) != -1) {
-					e.className = s.display_tab_class;
-					nl[nl.length] = {elm : e, type : 'class'};
+			loadScripts();
+		};
+	};
+
+	// Global script loader
+	tinymce.ScriptLoader = new tinymce.dom.ScriptLoader();
+})(tinymce);
+
+tinymce.dom.TreeWalker = function(start_node, root_node) {
+	var node = start_node;
+
+	function findSibling(node, start_name, sibling_name, shallow) {
+		var sibling, parent;
+
+		if (node) {
+			// Walk into nodes if it has a start
+			if (!shallow && node[start_name])
+				return node[start_name];
+
+			// Return the sibling if it has one
+			if (node != root_node) {
+				sibling = node[sibling_name];
+				if (sibling)
+					return sibling;
+
+				// Walk up the parents to look for siblings
+				for (parent = node.parentNode; parent && parent != root_node; parent = parent.parentNode) {
+					sibling = parent[sibling_name];
+					if (sibling)
+						return sibling;
 				}
-			} while ((e = e.parentNode) != null)
+			}
 		}
+	};
 
-		tinyMCE.settings.preformatted = false;
+	this.current = function() {
+		return node;
+	};
 
-		// Default to false
-		if (typeof(skip_cleanup) == "undefined")
-			skip_cleanup = false;
+	this.next = function(shallow) {
+		return (node = findSibling(node, 'firstChild', 'nextSibling', shallow));
+	};
 
-		// Default to false
-		if (typeof(skip_callback) == "undefined")
-			skip_callback = false;
+	this.prev = function(shallow) {
+		return (node = findSibling(node, 'lastChild', 'lastSibling', shallow));
+	};
+};
 
-		tinyMCE._setHTML(this.getDoc(), this.getBody().innerHTML);
+(function() {
+	var transitional = {};
 
-		// Remove visual aids when cleanup is disabled
-		if (this.settings.cleanup == false) {
-			tinyMCE.handleVisualAid(this.getBody(), true, false, this);
-			tinyMCE._setEventsEnabled(this.getBody(), true);
+	function unpack(lookup, data) {
+		var key;
+
+		function replace(value) {
+			return value.replace(/[A-Z]+/g, function(key) {
+				return replace(lookup[key]);
+			});
+		};
+
+		// Unpack lookup
+		for (key in lookup) {
+			if (lookup.hasOwnProperty(key))
+				lookup[key] = replace(lookup[key]);
 		}
 
-		tinyMCE._customCleanup(this, "submit_content_dom", this.contentWindow.document.body);
-		htm = skip_cleanup ? this.getBody().innerHTML : tinyMCE._cleanupHTML(this, this.getDoc(), this.settings, this.getBody(), tinyMCE.visualAid, true, true);
-		htm = tinyMCE._customCleanup(this, "submit_content", htm);
+		// Unpack and parse data into object map
+		replace(data).replace(/#/g, '#text').replace(/(\w+)\[([^\]]+)\]/g, function(str, name, children) {
+			var i, map = {};
 
-		if (!skip_callback && tinyMCE.settings.save_callback !== '')
-			content = tinyMCE.resolveDots(tinyMCE.settings.save_callback, window)(this.formTargetElementId,htm,this.getBody());
+			children = children.split(/\|/);
 
-		// Use callback content if available
-		if ((typeof(content) != "undefined") && content != null)
-			htm = content;
+			for (i = children.length - 1; i >= 0; i--)
+				map[children[i]] = 1;
 
-		// Replace some weird entities (Bug: #1056343)
-		htm = tinyMCE.regexpReplace(htm, "&#40;", "(", "gi");
-		htm = tinyMCE.regexpReplace(htm, "&#41;", ")", "gi");
-		htm = tinyMCE.regexpReplace(htm, "&#59;", ";", "gi");
-		htm = tinyMCE.regexpReplace(htm, "&#34;", "&quot;", "gi");
-		htm = tinyMCE.regexpReplace(htm, "&#94;", "^", "gi");
+			transitional[name] = map;
+		});
+	};
 
-		if (this.formElement)
-			this.formElement.value = htm;
+	// This is the XHTML 1.0 transitional elements with it's children packed to reduce it's size
+	// we will later include the attributes here and use it as a default for valid elements but it
+	// requires us to rewrite the serializer engine
+	unpack({
+		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]'
+	);
 
-		if (tinyMCE.isSafari && this.formElement)
-			this.formElement.innerText = htm;
+	tinymce.dom.Schema = function() {
+		var t = this, elements = transitional;
 
-		// Hide them again (tabs in MSIE)
-		for (i=0; i<nl.length; i++) {
-			if (nl[i].type == 'style')
-				nl[i].elm.style.display = 'none';
-			else
-				nl[i].elm.className = s.hidden_tab_class;
-		}
-	}
+		t.isValid = function(name, child_name) {
+			var element = elements[name];
 
+			return !!(element && (!child_name || element[child_name]));
+		};
 	};
+})();
+(function(tinymce) {
+	tinymce.dom.RangeUtils = function(dom) {
+		var INVISIBLE_CHAR = '\uFEFF';
 
-/* file:jscripts/tiny_mce/classes/TinyMCE_Cleanup.class.js */
+		this.walk = function(rng, callback) {
+			var startContainer = rng.startContainer,
+				startOffset = rng.startOffset,
+				endContainer = rng.endContainer,
+				endOffset = rng.endOffset,
+				ancestor, startPoint,
+				endPoint, node, parent, siblings, nodes;
 
-tinyMCE.add(TinyMCE_Engine, {
-	cleanupHTMLCode : function(s) {
-		s = s.replace(new RegExp('<p \\/>', 'gi'), '<p>&nbsp;</p>');
-		s = s.replace(new RegExp('<p>\\s*<\\/p>', 'gi'), '<p>&nbsp;</p>');
+			// Handle table cell selection the table plugin enables
+			// you to fake select table cells and perform formatting actions on them
+			nodes = dom.select('td.mceSelected,th.mceSelected');
+			if (nodes.length > 0) {
+				tinymce.each(nodes, function(node) {
+					callback([node]);
+				});
 
-		// Fix close BR elements
-		s = s.replace(new RegExp('<br>\\s*<\\/br>', 'gi'), '<br />');
+				return;
+			}
 
-		// Open closed tags like <b/> to <b></b>
-		s = s.replace(new RegExp('<(h[1-6]|p|div|address|pre|form|table|li|ol|ul|td|b|font|em|strong|i|strike|u|span|a|ul|ol|li|blockquote)([a-z]*)([^\\\\|>]*)\\/>', 'gi'), '<$1$2$3></$1$2>');
+			function collectSiblings(node, name, end_node) {
+				var siblings = [];
 
-		// Remove trailing space <b > to <b>
-		s = s.replace(new RegExp('\\s+></', 'gi'), '></');
+				for (; node && node != end_node; node = node[name])
+					siblings.push(node);
 
-		// Close tags <img></img> to <img/>
-		s = s.replace(new RegExp('<(img|br|hr)([^>]*)><\\/(img|br|hr)>', 'gi'), '<$1$2 />');
+				return siblings;
+			};
 
-		// Weird MSIE bug, <p><hr /></p> breaks runtime?
-		if (tinyMCE.isIE)
-			s = s.replace(new RegExp('<p><hr \\/><\\/p>', 'gi'), "<hr>");
+			function findEndPoint(node, root) {
+				do {
+					if (node.parentNode == root)
+						return node;
 
-		// Weird tags will make IE error #bug: 1538495
-		if (tinyMCE.isIE)
-			s = s.replace(/<!(\s*)\/>/g, '');
+					node = node.parentNode;
+				} while(node);
+			};
 
-		// Convert relative anchors to absolute URLs ex: #something to file.htm#something
-		// Removed: Since local document anchors should never be forced absolute example edit.php?id=something
-		//if (tinyMCE.getParam('convert_urls'))
-		//	s = s.replace(new RegExp('(href=\"{0,1})(\\s*#)', 'gi'), '$1' + tinyMCE.settings.document_base_url + "#");
+			function walkBoundary(start_node, end_node, next) {
+				var siblingName = next ? 'nextSibling' : 'previousSibling';
 
-		return s;
-	},
+				for (node = start_node, parent = node.parentNode; node && node != end_node; node = parent) {
+					parent = node.parentNode;
+					siblings = collectSiblings(node == start_node ? node : node[siblingName], siblingName);
 
-	parseStyle : function(str) {
-		var ar = [], st, i, re, pa;
+					if (siblings.length) {
+						if (!next)
+							siblings.reverse();
 
-		if (str == null)
-			return ar;
+						callback(siblings);
+					}
+				}
+			};
 
-		st = str.split(';');
+			// If index based start position then resolve it
+			if (startContainer.nodeType == 1 && startContainer.hasChildNodes())
+				startContainer = startContainer.childNodes[startOffset];
 
-		tinyMCE.clearArray(ar);
+			// If index based end position then resolve it
+			if (endContainer.nodeType == 1 && endContainer.hasChildNodes())
+				endContainer = endContainer.childNodes[Math.min(startOffset == endOffset ? endOffset : endOffset - 1, endContainer.childNodes.length - 1)];
 
-		for (i=0; i<st.length; i++) {
-			if (st[i] == '')
-				continue;
+			// Find common ancestor and end points
+			ancestor = dom.findCommonAncestor(startContainer, endContainer);
 
-			re = new RegExp('^\\s*([^:]*):\\s*(.*)\\s*$');
-			pa = st[i].replace(re, '$1||$2').split('||');
-	//tinyMCE.debug(str, pa[0] + "=" + pa[1], st[i].replace(re, '$1||$2'));
-			if (pa.length == 2)
-				ar[pa[0].toLowerCase()] = pa[1];
-		}
+			// Same container
+			if (startContainer == endContainer)
+				return callback([startContainer]);
 
-		return ar;
-	},
+			// Process left side
+			for (node = startContainer; node; node = node.parentNode) {
+				if (node == endContainer)
+					return walkBoundary(startContainer, ancestor, true);
 
-	compressStyle : function(ar, pr, sf, res) {
-		var box = [], i, a;
+				if (node == ancestor)
+					break;
+			}
 
-		box[0] = ar[pr + '-top' + sf];
-		box[1] = ar[pr + '-left' + sf];
-		box[2] = ar[pr + '-right' + sf];
-		box[3] = ar[pr + '-bottom' + sf];
+			// Process right side
+			for (node = endContainer; node; node = node.parentNode) {
+				if (node == startContainer)
+					return walkBoundary(endContainer, ancestor);
 
-		for (i=0; i<box.length; i++) {
-			if (box[i] == null)
-				return;
+				if (node == ancestor)
+					break;
+			}
 
-			if (i && box[i] != box[i-1])
-				return;
-		}
+			// Find start/end point
+			startPoint = findEndPoint(startContainer, ancestor) || startContainer;
+			endPoint = findEndPoint(endContainer, ancestor) || endContainer;
 
-		// They are all the same
-		ar[res] = box[0];
-		ar[pr + '-top' + sf] = null;
-		ar[pr + '-left' + sf] = null;
-		ar[pr + '-right' + sf] = null;
-		ar[pr + '-bottom' + sf] = null;
-	},
+			// Walk left leaf
+			walkBoundary(startContainer, startPoint, true);
 
-	serializeStyle : function(ar) {
-		var str = "", key, val, m;
+			// Walk the middle from start to end point
+			siblings = collectSiblings(
+				startPoint == startContainer ? startPoint : startPoint.nextSibling,
+				'nextSibling',
+				endPoint == endContainer ? endPoint.nextSibling : endPoint
+			);
 
-		// Compress box
-		tinyMCE.compressStyle(ar, "border", "", "border");
-		tinyMCE.compressStyle(ar, "border", "-width", "border-width");
-		tinyMCE.compressStyle(ar, "border", "-color", "border-color");
-		tinyMCE.compressStyle(ar, "border", "-style", "border-style");
-		tinyMCE.compressStyle(ar, "padding", "", "padding");
-		tinyMCE.compressStyle(ar, "margin", "", "margin");
+			if (siblings.length)
+				callback(siblings);
 
-		for (key in ar) {
-			val = ar[key];
+			// Walk right leaf
+			walkBoundary(endContainer, endPoint);
+		};
 
-			if (typeof(val) == 'function')
-				continue;
+		/*		this.split = function(rng) {
+			var startContainer = rng.startContainer,
+				startOffset = rng.startOffset,
+				endContainer = rng.endContainer,
+				endOffset = rng.endOffset;
 
-			if (key.indexOf('mso-') == 0)
-				continue;
+			function splitText(node, offset) {
+				if (offset == node.nodeValue.length)
+					node.appendData(INVISIBLE_CHAR);
 
-			if (val != null && val !== '') {
-				val = '' + val; // Force string
+				node = node.splitText(offset);
 
-				// Fix style URL
-				val = val.replace(new RegExp("url\\(\\'?([^\\']*)\\'?\\)", 'gi'), "url('$1')");
+				if (node.nodeValue === INVISIBLE_CHAR)
+					node.nodeValue = '';
 
-				// Convert URL
-				if (val.indexOf('url(') != -1 && tinyMCE.getParam('convert_urls')) {
-					m = new RegExp("url\\('(.*?)'\\)").exec(val);
+				return node;
+			};
 
-					if (m.length > 1)
-						val = "url('" + eval(tinyMCE.getParam('urlconverter_callback') + "(m[1], null, true);") + "')";
+			// Handle single text node
+			if (startContainer == endContainer) {
+				if (startContainer.nodeType == 3) {
+					if (startOffset != 0)
+						startContainer = endContainer = splitText(startContainer, startOffset);
+
+					if (endOffset - startOffset != startContainer.nodeValue.length)
+						splitText(startContainer, endOffset - startOffset);
 				}
+			} else {
+				// Split startContainer text node if needed
+				if (startContainer.nodeType == 3 && startOffset != 0) {
+					startContainer = splitText(startContainer, startOffset);
+					startOffset = 0;
+				}
 
-				// Force HEX colors
-				if (tinyMCE.getParam("force_hex_style_colors"))
-					val = tinyMCE.convertRGBToHex(val, true);
+				// Split endContainer text node if needed
+				if (endContainer.nodeType == 3 && endOffset != endContainer.nodeValue.length) {
+					endContainer = splitText(endContainer, endOffset).previousSibling;
+					endOffset = endContainer.nodeValue.length;
+				}
+			}
 
-				val = val.replace(/\"/g, '\'');
+			return {
+				startContainer : startContainer,
+				startOffset : startOffset,
+				endContainer : endContainer,
+				endOffset : endOffset
+			};
+		};
+*/
+	};
 
-				if (val != "url('')")
-					str += key.toLowerCase() + ": " + val + "; ";
+	tinymce.dom.RangeUtils.compareRanges = function(rng1, rng2) {
+		if (rng1 && rng2) {
+			// Compare native IE ranges
+			if (rng1.item || rng1.duplicate) {
+				// Both are control ranges and the selected element matches
+				if (rng1.item && rng2.item && rng1.item(0) === rng2.item(0))
+					return true;
+
+				// Both are text ranges and the range matches
+				if (rng1.isEqual && rng2.isEqual && rng2.isEqual(rng1))
+					return true;
+			} else {
+				// Compare w3c ranges
+				return rng1.startContainer == rng2.startContainer && rng1.startOffset == rng2.startOffset;
 			}
 		}
 
-		if (new RegExp('; $').test(str))
-			str = str.substring(0, str.length - 2);
+		return false;
+	};
+})(tinymce);
 
-		return str;
-	},
+(function(tinymce) {
+	// Shorten class names
+	var DOM = tinymce.DOM, is = tinymce.is;
 
-	convertRGBToHex : function(s, k) {
-		var re, rgb;
+	tinymce.create('tinymce.ui.Control', {
+		Control : function(id, s) {
+			this.id = id;
+			this.settings = s = s || {};
+			this.rendered = false;
+			this.onRender = new tinymce.util.Dispatcher(this);
+			this.classPrefix = '';
+			this.scope = s.scope || this;
+			this.disabled = 0;
+			this.active = 0;
+		},
 
-		if (s.toLowerCase().indexOf('rgb') != -1) {
-			re = new RegExp("(.*?)rgb\\s*?\\(\\s*?([0-9]+).*?,\\s*?([0-9]+).*?,\\s*?([0-9]+).*?\\)(.*?)", "gi");
-			rgb = s.replace(re, "$1,$2,$3,$4,$5").split(',');
+		setDisabled : function(s) {
+			var e;
 
-			if (rgb.length == 5) {
-				r = parseInt(rgb[1]).toString(16);
-				g = parseInt(rgb[2]).toString(16);
-				b = parseInt(rgb[3]).toString(16);
+			if (s != this.disabled) {
+				e = DOM.get(this.id);
 
-				r = r.length == 1 ? '0' + r : r;
-				g = g.length == 1 ? '0' + g : g;
-				b = b.length == 1 ? '0' + b : b;
+				// Add accessibility title for unavailable actions
+				if (e && this.settings.unavailable_prefix) {
+					if (s) {
+						this.prevTitle = e.title;
+						e.title = this.settings.unavailable_prefix + ": " + e.title;
+					} else
+						e.title = this.prevTitle;
+				}
 
-				s = "#" + r + g + b;
+				this.setState('Disabled', s);
+				this.setState('Enabled', !s);
+				this.disabled = s;
+			}
+		},
 
-				if (k)
-					s = rgb[0] + s + rgb[4];
+		isDisabled : function() {
+			return this.disabled;
+		},
+
+		setActive : function(s) {
+			if (s != this.active) {
+				this.setState('Active', s);
+				this.active = s;
 			}
+		},
+
+		isActive : function() {
+			return this.active;
+		},
+
+		setState : function(c, s) {
+			var n = DOM.get(this.id);
+
+			c = this.classPrefix + c;
+
+			if (s)
+				DOM.addClass(n, c);
+			else
+				DOM.removeClass(n, c);
+		},
+
+		isRendered : function() {
+			return this.rendered;
+		},
+
+		renderHTML : function() {
+		},
+
+		renderTo : function(n) {
+			DOM.setHTML(n, this.renderHTML());
+		},
+
+		postRender : function() {
+			var t = this, b;
+
+			// Set pending states
+			if (is(t.disabled)) {
+				b = t.disabled;
+				t.disabled = -1;
+				t.setDisabled(b);
+			}
+
+			if (is(t.active)) {
+				b = t.active;
+				t.active = -1;
+				t.setActive(b);
+			}
+		},
+
+		remove : function() {
+			DOM.remove(this.id);
+			this.destroy();
+		},
+
+		destroy : function() {
+			tinymce.dom.Event.clear(this.id);
 		}
+	});
+})(tinymce);
+tinymce.create('tinymce.ui.Container:tinymce.ui.Control', {
+	Container : function(id, s) {
+		this.parent(id, s);
 
-		return s;
+		this.controls = [];
+
+		this.lookup = {};
 	},
 
-	convertHexToRGB : function(s) {
-		if (s.indexOf('#') != -1) {
-			s = s.replace(new RegExp('[^0-9A-F]', 'gi'), '');
-			return "rgb(" + parseInt(s.substring(0, 2), 16) + "," + parseInt(s.substring(2, 4), 16) + "," + parseInt(s.substring(4, 6), 16) + ")";
-		}
+	add : function(c) {
+		this.lookup[c.id] = c;
+		this.controls.push(c);
 
-		return s;
+		return c;
 	},
 
-	convertSpansToFonts : function(doc) {
-		var s, i, size, fSize, x, fFace, fColor, sizes = tinyMCE.getParam('font_size_style_values').replace(/\s+/, '').split(',');
+	get : function(n) {
+		return this.lookup[n];
+	}
+});
 
-		s = tinyMCE.selectElements(doc, 'span,font');
-		for (i=0; i<s.length; i++) {
-			size = tinyMCE.trim(s[i].style.fontSize).toLowerCase();
-			fSize = 0;
 
-			for (x=0; x<sizes.length; x++) {
-				if (sizes[x] == size) {
-					fSize = x + 1;
-					break;
-				}
+tinymce.create('tinymce.ui.Separator:tinymce.ui.Control', {
+	Separator : function(id, s) {
+		this.parent(id, s);
+		this.classPrefix = 'mceSeparator';
+	},
+
+	renderHTML : function() {
+		return tinymce.DOM.createHTML('span', {'class' : this.classPrefix});
+	}
+});
+
+(function(tinymce) {
+	var is = tinymce.is, DOM = tinymce.DOM, each = tinymce.each, walk = tinymce.walk;
+
+	tinymce.create('tinymce.ui.MenuItem:tinymce.ui.Control', {
+		MenuItem : function(id, s) {
+			this.parent(id, s);
+			this.classPrefix = 'mceMenuItem';
+		},
+
+		setSelected : function(s) {
+			this.setState('Selected', s);
+			this.selected = s;
+		},
+
+		isSelected : function() {
+			return this.selected;
+		},
+
+		postRender : function() {
+			var t = this;
+			
+			t.parent();
+
+			// Set pending state
+			if (is(t.selected))
+				t.setSelected(t.selected);
+		}
+	});
+})(tinymce);
+
+(function(tinymce) {
+	var is = tinymce.is, DOM = tinymce.DOM, each = tinymce.each, walk = tinymce.walk;
+
+	tinymce.create('tinymce.ui.Menu:tinymce.ui.MenuItem', {
+		Menu : function(id, s) {
+			var t = this;
+
+			t.parent(id, s);
+			t.items = {};
+			t.collapsed = false;
+			t.menuCount = 0;
+			t.onAddItem = new tinymce.util.Dispatcher(this);
+		},
+
+		expand : function(d) {
+			var t = this;
+
+			if (d) {
+				walk(t, function(o) {
+					if (o.expand)
+						o.expand();
+				}, 'items', t);
 			}
 
-			if (fSize > 0) {
-				tinyMCE.setAttrib(s[i], 'size', fSize);
-				s[i].style.fontSize = '';
+			t.collapsed = false;
+		},
+
+		collapse : function(d) {
+			var t = this;
+
+			if (d) {
+				walk(t, function(o) {
+					if (o.collapse)
+						o.collapse();
+				}, 'items', t);
 			}
 
-			fFace = s[i].style.fontFamily;
-			if (fFace != null && fFace !== '') {
-				tinyMCE.setAttrib(s[i], 'face', fFace);
-				s[i].style.fontFamily = '';
+			t.collapsed = true;
+		},
+
+		isCollapsed : function() {
+			return this.collapsed;
+		},
+
+		add : function(o) {
+			if (!o.settings)
+				o = new tinymce.ui.MenuItem(o.id || DOM.uniqueId(), o);
+
+			this.onAddItem.dispatch(this, o);
+
+			return this.items[o.id] = o;
+		},
+
+		addSeparator : function() {
+			return this.add({separator : true});
+		},
+
+		addMenu : function(o) {
+			if (!o.collapse)
+				o = this.createMenu(o);
+
+			this.menuCount++;
+
+			return this.add(o);
+		},
+
+		hasMenus : function() {
+			return this.menuCount !== 0;
+		},
+
+		remove : function(o) {
+			delete this.items[o.id];
+		},
+
+		removeAll : function() {
+			var t = this;
+
+			walk(t, function(o) {
+				if (o.removeAll)
+					o.removeAll();
+				else
+					o.remove();
+
+				o.destroy();
+			}, 'items', t);
+
+			t.items = {};
+		},
+
+		createMenu : function(o) {
+			var m = new tinymce.ui.Menu(o.id || DOM.uniqueId(), o);
+
+			m.onAddItem.add(this.onAddItem.dispatch, this.onAddItem);
+
+			return m;
+		}
+	});
+})(tinymce);
+(function(tinymce) {
+	var is = tinymce.is, DOM = tinymce.DOM, each = tinymce.each, Event = tinymce.dom.Event, Element = tinymce.dom.Element;
+
+	tinymce.create('tinymce.ui.DropMenu:tinymce.ui.Menu', {
+		DropMenu : function(id, s) {
+			s = s || {};
+			s.container = s.container || DOM.doc.body;
+			s.offset_x = s.offset_x || 0;
+			s.offset_y = s.offset_y || 0;
+			s.vp_offset_x = s.vp_offset_x || 0;
+			s.vp_offset_y = s.vp_offset_y || 0;
+
+			if (is(s.icons) && !s.icons)
+				s['class'] += ' mceNoIcons';
+
+			this.parent(id, s);
+			this.onShowMenu = new tinymce.util.Dispatcher(this);
+			this.onHideMenu = new tinymce.util.Dispatcher(this);
+			this.classPrefix = 'mceMenu';
+		},
+
+		createMenu : function(s) {
+			var t = this, cs = t.settings, m;
+
+			s.container = s.container || cs.container;
+			s.parent = t;
+			s.constrain = s.constrain || cs.constrain;
+			s['class'] = s['class'] || cs['class'];
+			s.vp_offset_x = s.vp_offset_x || cs.vp_offset_x;
+			s.vp_offset_y = s.vp_offset_y || cs.vp_offset_y;
+			m = new tinymce.ui.DropMenu(s.id || DOM.uniqueId(), s);
+
+			m.onAddItem.add(t.onAddItem.dispatch, t.onAddItem);
+
+			return m;
+		},
+
+		update : function() {
+			var t = this, s = t.settings, tb = DOM.get('menu_' + t.id + '_tbl'), co = DOM.get('menu_' + t.id + '_co'), tw, th;
+
+			tw = s.max_width ? Math.min(tb.clientWidth, s.max_width) : tb.clientWidth;
+			th = s.max_height ? Math.min(tb.clientHeight, s.max_height) : tb.clientHeight;
+
+			if (!DOM.boxModel)
+				t.element.setStyles({width : tw + 2, height : th + 2});
+			else
+				t.element.setStyles({width : tw, height : th});
+
+			if (s.max_width)
+				DOM.setStyle(co, 'width', tw);
+
+			if (s.max_height) {
+				DOM.setStyle(co, 'height', th);
+
+				if (tb.clientHeight < s.max_height)
+					DOM.setStyle(co, 'overflow', 'hidden');
 			}
+		},
 
-			fColor = s[i].style.color;
-			if (fColor != null && fColor !== '') {
-				tinyMCE.setAttrib(s[i], 'color', tinyMCE.convertRGBToHex(fColor));
-				s[i].style.color = '';
+		showMenu : function(x, y, px) {
+			var t = this, s = t.settings, co, vp = DOM.getViewPort(), w, h, mx, my, ot = 2, dm, tb, cp = t.classPrefix;
+
+			t.collapse(1);
+
+			if (t.isMenuVisible)
+				return;
+
+			if (!t.rendered) {
+				co = DOM.add(t.settings.container, t.renderNode());
+
+				each(t.items, function(o) {
+					o.postRender();
+				});
+
+				t.element = new Element('menu_' + t.id, {blocker : 1, container : s.container});
+			} else
+				co = DOM.get('menu_' + t.id);
+
+			// Move layer out of sight unless it's Opera since it scrolls to top of page due to an bug
+			if (!tinymce.isOpera)
+				DOM.setStyles(co, {left : -0xFFFF , top : -0xFFFF});
+
+			DOM.show(co);
+			t.update();
+
+			x += s.offset_x || 0;
+			y += s.offset_y || 0;
+			vp.w -= 4;
+			vp.h -= 4;
+
+			// Move inside viewport if not submenu
+			if (s.constrain) {
+				w = co.clientWidth - ot;
+				h = co.clientHeight - ot;
+				mx = vp.x + vp.w;
+				my = vp.y + vp.h;
+
+				if ((x + s.vp_offset_x + w) > mx)
+					x = px ? px - w : Math.max(0, (mx - s.vp_offset_x) - w);
+
+				if ((y + s.vp_offset_y + h) > my)
+					y = Math.max(0, (my - s.vp_offset_y) - h);
 			}
-		}
-	},
 
-	convertFontsToSpans : function(doc) {
-		var fsClasses, s, i, fSize, fFace, fColor, sizes = tinyMCE.getParam('font_size_style_values').replace(/\s+/, '').split(',');
+			DOM.setStyles(co, {left : x , top : y});
+			t.element.update();
 
-		fsClasses = tinyMCE.getParam('font_size_classes');
-		if (fsClasses !== '')
-			fsClasses = fsClasses.replace(/\s+/, '').split(',');
-		else
-			fsClasses = null;
+			t.isMenuVisible = 1;
+			t.mouseClickFunc = Event.add(co, 'click', function(e) {
+				var m;
 
-		s = tinyMCE.selectElements(doc, 'span,font');
-		for (i=0; i<s.length; i++) {
-			fSize = tinyMCE.getAttrib(s[i], 'size');
-			fFace = tinyMCE.getAttrib(s[i], 'face');
-			fColor = tinyMCE.getAttrib(s[i], 'color');
+				e = e.target;
 
-			if (fSize !== '') {
-				fSize = parseInt(fSize);
+				if (e && (e = DOM.getParent(e, 'tr')) && !DOM.hasClass(e, cp + 'ItemSub')) {
+					m = t.items[e.id];
 
-				if (fSize > 0 && fSize < 8) {
-					if (fsClasses != null)
-						tinyMCE.setAttrib(s[i], 'class', fsClasses[fSize-1]);
-					else
-						s[i].style.fontSize = sizes[fSize-1];
+					if (m.isDisabled())
+						return;
+
+					dm = t;
+
+					while (dm) {
+						if (dm.hideMenu)
+							dm.hideMenu();
+
+						dm = dm.settings.parent;
+					}
+
+					if (m.settings.onclick)
+						m.settings.onclick(e);
+
+					return Event.cancel(e); // Cancel to fix onbeforeunload problem
 				}
+			});
 
-				s[i].removeAttribute('size');
+			if (t.hasMenus()) {
+				t.mouseOverFunc = Event.add(co, 'mouseover', function(e) {
+					var m, r, mi;
+
+					e = e.target;
+					if (e && (e = DOM.getParent(e, 'tr'))) {
+						m = t.items[e.id];
+
+						if (t.lastMenu)
+							t.lastMenu.collapse(1);
+
+						if (m.isDisabled())
+							return;
+
+						if (e && DOM.hasClass(e, cp + 'ItemSub')) {
+							//p = DOM.getPos(s.container);
+							r = DOM.getRect(e);
+							m.showMenu((r.x + r.w - ot), r.y - ot, r.x);
+							t.lastMenu = m;
+							DOM.addClass(DOM.get(m.id).firstChild, cp + 'ItemActive');
+						}
+					}
+				});
 			}
 
-			if (fFace !== '') {
-				s[i].style.fontFamily = fFace;
-				s[i].removeAttribute('face');
+			t.onShowMenu.dispatch(t);
+
+			if (s.keyboard_focus) {
+				Event.add(co, 'keydown', t._keyHandler, t);
+				DOM.select('a', 'menu_' + t.id)[0].focus(); // Select first link
+				t._focusIdx = 0;
 			}
+		},
 
-			if (fColor !== '') {
-				s[i].style.color = fColor;
-				s[i].removeAttribute('color');
+		hideMenu : function(c) {
+			var t = this, co = DOM.get('menu_' + t.id), e;
+
+			if (!t.isMenuVisible)
+				return;
+
+			Event.remove(co, 'mouseover', t.mouseOverFunc);
+			Event.remove(co, 'click', t.mouseClickFunc);
+			Event.remove(co, 'keydown', t._keyHandler);
+			DOM.hide(co);
+			t.isMenuVisible = 0;
+
+			if (!c)
+				t.collapse(1);
+
+			if (t.element)
+				t.element.hide();
+
+			if (e = DOM.get(t.id))
+				DOM.removeClass(e.firstChild, t.classPrefix + 'ItemActive');
+
+			t.onHideMenu.dispatch(t);
+		},
+
+		add : function(o) {
+			var t = this, co;
+
+			o = t.parent(o);
+
+			if (t.isRendered && (co = DOM.get('menu_' + t.id)))
+				t._add(DOM.select('tbody', co)[0], o);
+
+			return o;
+		},
+
+		collapse : function(d) {
+			this.parent(d);
+			this.hideMenu(1);
+		},
+
+		remove : function(o) {
+			DOM.remove(o.id);
+			this.destroy();
+
+			return this.parent(o);
+		},
+
+		destroy : function() {
+			var t = this, co = DOM.get('menu_' + t.id);
+
+			Event.remove(co, 'mouseover', t.mouseOverFunc);
+			Event.remove(co, 'click', t.mouseClickFunc);
+
+			if (t.element)
+				t.element.remove();
+
+			DOM.remove(co);
+		},
+
+		renderNode : function() {
+			var t = this, s = t.settings, n, tb, co, w;
+
+			w = DOM.create('div', {id : 'menu_' + t.id, 'class' : s['class'], 'style' : 'position:absolute;left:0;top:0;z-index:200000'});
+			co = DOM.add(w, 'div', {id : 'menu_' + t.id + '_co', 'class' : t.classPrefix + (s['class'] ? ' ' + s['class'] : '')});
+			t.element = new Element('menu_' + t.id, {blocker : 1, container : s.container});
+
+			if (s.menu_line)
+				DOM.add(co, 'span', {'class' : t.classPrefix + 'Line'});
+
+//			n = DOM.add(co, 'div', {id : 'menu_' + t.id + '_co', 'class' : 'mceMenuContainer'});
+			n = DOM.add(co, 'table', {id : 'menu_' + t.id + '_tbl', border : 0, cellPadding : 0, cellSpacing : 0});
+			tb = DOM.add(n, 'tbody');
+
+			each(t.items, function(o) {
+				t._add(tb, o);
+			});
+
+			t.rendered = true;
+
+			return w;
+		},
+
+		// Internal functions
+
+		_keyHandler : function(e) {
+			var t = this, kc = e.keyCode;
+
+			function focus(d) {
+				var i = t._focusIdx + d, e = DOM.select('a', 'menu_' + t.id)[i];
+
+				if (e) {
+					t._focusIdx = i;
+					e.focus();
+				}
+			};
+
+			switch (kc) {
+				case 38:
+					focus(-1); // Select first link
+					return;
+
+				case 40:
+					focus(1);
+					return;
+
+				case 13:
+					return;
+
+				case 27:
+					return this.hideMenu();
 			}
-		}
-	},
+		},
 
-	cleanupAnchors : function(doc) {
-		var i, cn, x, an = doc.getElementsByTagName("a");
+		_add : function(tb, o) {
+			var n, s = o.settings, a, ro, it, cp = this.classPrefix, ic;
 
-		// Loops backwards due to bug #1467987
-		for (i=an.length-1; i>=0; i--) {
-			if (tinyMCE.getAttrib(an[i], "name") !== '' && tinyMCE.getAttrib(an[i], "href") == '') {
-				cn = an[i].childNodes;
+			if (s.separator) {
+				ro = DOM.add(tb, 'tr', {id : o.id, 'class' : cp + 'ItemSeparator'});
+				DOM.add(ro, 'td', {'class' : cp + 'ItemSeparator'});
 
-				for (x=cn.length-1; x>=0; x--)
-					tinyMCE.insertAfter(cn[x], an[i]);
+				if (n = ro.previousSibling)
+					DOM.addClass(n, 'mceLast');
+
+				return;
 			}
+
+			n = ro = DOM.add(tb, 'tr', {id : o.id, 'class' : cp + 'Item ' + cp + 'ItemEnabled'});
+			n = it = DOM.add(n, 'td');
+			n = a = DOM.add(n, 'a', {href : 'javascript:;', onclick : "return false;", onmousedown : 'return false;'});
+
+			DOM.addClass(it, s['class']);
+//			n = DOM.add(n, 'span', {'class' : 'item'});
+
+			ic = DOM.add(n, 'span', {'class' : 'mceIcon' + (s.icon ? ' mce_' + s.icon : '')});
+
+			if (s.icon_src)
+				DOM.add(ic, 'img', {src : s.icon_src});
+
+			n = DOM.add(n, s.element || 'span', {'class' : 'mceText', title : o.settings.title}, o.settings.title);
+
+			if (o.settings.style)
+				DOM.setAttrib(n, 'style', o.settings.style);
+
+			if (tb.childNodes.length == 1)
+				DOM.addClass(ro, 'mceFirst');
+
+			if ((n = ro.previousSibling) && DOM.hasClass(n, cp + 'ItemSeparator'))
+				DOM.addClass(ro, 'mceFirst');
+
+			if (o.collapse)
+				DOM.addClass(ro, cp + 'ItemSub');
+
+			if (n = ro.previousSibling)
+				DOM.removeClass(n, 'mceLast');
+
+			DOM.addClass(ro, 'mceLast');
 		}
-	},
+	});
+})(tinymce);
+(function(tinymce) {
+	var DOM = tinymce.DOM;
 
-	getContent : function(editor_id) {
-		if (typeof(editor_id) != "undefined")
-			 tinyMCE.getInstanceById(editor_id).select();
+	tinymce.create('tinymce.ui.Button:tinymce.ui.Control', {
+		Button : function(id, s) {
+			this.parent(id, s);
+			this.classPrefix = 'mceButton';
+		},
 
-		if (tinyMCE.selectedInstance)
-			return tinyMCE.selectedInstance.getHTML();
+		renderHTML : function() {
+			var cp = this.classPrefix, s = this.settings, h, l;
 
-		return null;
-	},
+			l = DOM.encode(s.label || '');
+			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) + '">';
 
-	_fixListElements : function(d) {
-		var nl, x, a = ['ol', 'ul'], i, n, p, r = new RegExp('^(OL|UL)$'), np;
+			if (s.image)
+				h += '<img class="mceIcon" src="' + s.image + '" />' + l + '</a>';
+			else
+				h += '<span class="mceIcon ' + s['class'] + '"></span>' + (l ? '<span class="' + cp + 'Label">' + l + '</span>' : '') + '</a>';
 
-		for (x=0; x<a.length; x++) {
-			nl = d.getElementsByTagName(a[x]);
+			return h;
+		},
 
-			for (i=0; i<nl.length; i++) {
-				n = nl[i];
-				p = n.parentNode;
+		postRender : function() {
+			var t = this, s = t.settings;
 
-				if (r.test(p.nodeName)) {
-					np = tinyMCE.prevNode(n, 'LI');
+			tinymce.dom.Event.add(t.id, 'click', function(e) {
+				if (!t.isDisabled())
+					return s.onclick.call(s.scope, e);
+			});
+		}
+	});
+})(tinymce);
 
-					if (!np) {
-						np = d.createElement('li');
-						np.innerHTML = '&nbsp;';
-						np.appendChild(n);
-						p.insertBefore(np, p.firstChild);
-					} else
-						np.appendChild(n);
+(function(tinymce) {
+	var DOM = tinymce.DOM, Event = tinymce.dom.Event, each = tinymce.each, Dispatcher = tinymce.util.Dispatcher;
+
+	tinymce.create('tinymce.ui.ListBox:tinymce.ui.Control', {
+		ListBox : function(id, s) {
+			var t = this;
+
+			t.parent(id, s);
+
+			t.items = [];
+
+			t.onChange = new Dispatcher(t);
+
+			t.onPostRender = new Dispatcher(t);
+
+			t.onAdd = new Dispatcher(t);
+
+			t.onRenderMenu = new tinymce.util.Dispatcher(this);
+
+			t.classPrefix = 'mceListBox';
+		},
+
+		select : function(va) {
+			var t = this, fv, f;
+
+			if (va == undefined)
+				return t.selectByIndex(-1);
+
+			// Is string or number make function selector
+			if (va && va.call)
+				f = va;
+			else {
+				f = function(v) {
+					return v == va;
+				};
+			}
+
+			// Do we need to do something?
+			if (va != t.selectedValue) {
+				// Find item
+				each(t.items, function(o, i) {
+					if (f(o.value)) {
+						fv = 1;
+						t.selectByIndex(i);
+						return false;
+					}
+				});
+
+				if (!fv)
+					t.selectByIndex(-1);
+			}
+		},
+
+		selectByIndex : function(idx) {
+			var t = this, e, o;
+
+			if (idx != t.selectedIndex) {
+				e = DOM.get(t.id + '_text');
+				o = t.items[idx];
+
+				if (o) {
+					t.selectedValue = o.value;
+					t.selectedIndex = idx;
+					DOM.setHTML(e, DOM.encode(o.title));
+					DOM.removeClass(e, 'mceTitle');
+				} else {
+					DOM.setHTML(e, DOM.encode(t.settings.title));
+					DOM.addClass(e, 'mceTitle');
+					t.selectedValue = t.selectedIndex = null;
 				}
+
+				e = 0;
 			}
-		}
-	},
+		},
 
-	_fixTables : function(d) {
-		var nl, i, n, p, np, x, t;
+		add : function(n, v, o) {
+			var t = this;
 
-		nl = d.getElementsByTagName('table');
-		for (i=0; i<nl.length; i++) {
-			n = nl[i];
+			o = o || {};
+			o = tinymce.extend(o, {
+				title : n,
+				value : v
+			});
 
-			if ((p = tinyMCE.getParentElement(n, 'p,h1,h2,h3,h4,h5,h6')) != null) {
-				np = p.cloneNode(false);
-				np.removeAttribute('id');
+			t.items.push(o);
+			t.onAdd.dispatch(t, o);
+		},
 
-				t = n;
+		getLength : function() {
+			return this.items.length;
+		},
 
-				while ((n = n.nextSibling))
-					np.appendChild(n);
+		renderHTML : function() {
+			var h = '', t = this, s = t.settings, cp = t.classPrefix;
 
-				tinyMCE.insertAfter(np, p);
-				tinyMCE.insertAfter(t, p);
+			h = '<table id="' + t.id + '" cellpadding="0" cellspacing="0" class="' + cp + ' ' + cp + 'Enabled' + (s['class'] ? (' ' + s['class']) : '') + '"><tbody><tr>';
+			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>';
+			h += '<td>' + DOM.createHTML('a', {id : t.id + '_open', tabindex : -1, href : 'javascript:;', 'class' : 'mceOpen', onclick : "return false;", onmousedown : 'return false;'}, '<span></span>') + '</td>';
+			h += '</tr></tbody></table>';
+
+			return h;
+		},
+
+		showMenu : function() {
+			var t = this, p1, p2, e = DOM.get(this.id), m;
+
+			if (t.isDisabled() || t.items.length == 0)
+				return;
+
+			if (t.menu && t.menu.isMenuVisible)
+				return t.hideMenu();
+
+			if (!t.isMenuRendered) {
+				t.renderMenu();
+				t.isMenuRendered = true;
 			}
-		}
-	},
 
-	_cleanupHTML : function(inst, doc, config, elm, visual, on_save, on_submit, inn) {
-		var h, d, t1, t2, t3, t4, t5, c, s, nb;
+			p1 = DOM.getPos(this.settings.menu_container);
+			p2 = DOM.getPos(e);
 
-		if (!tinyMCE.getParam('cleanup'))
-			return elm.innerHTML;
+			m = t.menu;
+			m.settings.offset_x = p2.x;
+			m.settings.offset_y = p2.y;
+			m.settings.keyboard_focus = !tinymce.isOpera; // Opera is buggy when it comes to auto focus
 
-		on_save = typeof(on_save) == 'undefined' ? false : on_save;
+			// Select in menu
+			if (t.oldID)
+				m.items[t.oldID].setSelected(0);
 
-		c = inst.cleanup;
-		s = inst.settings;
-		d = c.settings.debug;
+			each(t.items, function(o) {
+				if (o.value === t.selectedValue) {
+					m.items[o.id].setSelected(1);
+					t.oldID = o.id;
+				}
+			});
 
-		if (d)
-			t1 = new Date().getTime();
+			m.showMenu(0, e.clientHeight);
 
-		inst._fixRootBlocks();
+			Event.add(DOM.doc, 'mousedown', t.hideMenu, t);
+			DOM.addClass(t.id, t.classPrefix + 'Selected');
 
-		if (tinyMCE.getParam("convert_fonts_to_spans"))
-			tinyMCE.convertFontsToSpans(doc);
+			//DOM.get(t.id + '_text').focus();
+		},
 
-		if (tinyMCE.getParam("fix_list_elements"))
-			tinyMCE._fixListElements(doc);
+		hideMenu : function(e) {
+			var t = this;
 
-		if (tinyMCE.getParam("fix_table_elements"))
-			tinyMCE._fixTables(doc);
+			if (t.menu && t.menu.isMenuVisible) {
+				// Prevent double toogles by canceling the mouse click event to the button
+				if (e && e.type == "mousedown" && (e.target.id == t.id + '_text' || e.target.id == t.id + '_open'))
+					return;
 
-		// Call custom cleanup code
-		tinyMCE._customCleanup(inst, on_save ? "get_from_editor_dom" : "insert_to_editor_dom", doc.body);
+				if (!e || !DOM.getParent(e.target, '.mceMenu')) {
+					DOM.removeClass(t.id, t.classPrefix + 'Selected');
+					Event.remove(DOM.doc, 'mousedown', t.hideMenu, t);
+					t.menu.hideMenu();
+				}
+			}
+		},
 
-		if (d)
-			t2 = new Date().getTime();
+		renderMenu : function() {
+			var t = this, m;
 
-		c.settings.on_save = on_save;
+			m = t.settings.control_manager.createDropMenu(t.id + '_menu', {
+				menu_line : 1,
+				'class' : t.classPrefix + 'Menu mceNoIcons',
+				max_width : 150,
+				max_height : 150
+			});
 
-		c.idCount = 0;
-		c.serializationId++; // Unique ID needed for the content duplication bug
-		c.serializedNodes = [];
-		c.sourceIndex = -1;
+			m.onHideMenu.add(t.hideMenu, t);
 
-		if (s.cleanup_serializer == "xml")
-			h = c.serializeNodeAsXML(elm, inn);
-		else
-			h = c.serializeNodeAsHTML(elm, inn);
+			m.add({
+				title : t.settings.title,
+				'class' : 'mceMenuItemTitle',
+				onclick : function() {
+					if (t.settings.onselect('') !== false)
+						t.select(''); // Must be runned after
+				}
+			});
 
-		if (d)
-			t3 = new Date().getTime();
+			each(t.items, function(o) {
+				// No value then treat it as a title
+				if (o.value === undefined) {
+					m.add({
+						title : o.title,
+						'class' : 'mceMenuItemTitle',
+						onclick : function() {
+							if (t.settings.onselect('') !== false)
+								t.select(''); // Must be runned after
+						}
+					});
+				} else {
+					o.id = DOM.uniqueId();
+					o.onclick = function() {
+						if (t.settings.onselect(o.value) !== false)
+							t.select(o.value); // Must be runned after
+					};
 
-		// Post processing
-		nb = tinyMCE.getParam('entity_encoding') == 'numeric' ? '&#160;' : '&nbsp;';
-		h = h.replace(/<\/?(body|head|html)[^>]*>/gi, '');
-		h = h.replace(new RegExp(' (rowspan="1"|colspan="1")', 'g'), '');
-		h = h.replace(/<p><hr \/><\/p>/g, '<hr />');
-		h = h.replace(/<p>(&nbsp;|&#160;)<\/p><hr \/><p>(&nbsp;|&#160;)<\/p>/g, '<hr />');
-		h = h.replace(/<td>\s*<br \/>\s*<\/td>/g, '<td>' + nb + '</td>');
-		h = h.replace(/<p>\s*<br \/>\s*<\/p>/g, '<p>' + nb + '</p>');
-		h = h.replace(/<br \/>$/, ''); // Remove last BR for Gecko
-		h = h.replace(/<br \/><\/p>/g, '</p>'); // Remove last BR in P tags for Gecko
-		h = h.replace(/<p>\s*(&nbsp;|&#160;)\s*<br \/>\s*(&nbsp;|&#160;)\s*<\/p>/g, '<p>' + nb + '</p>');
-		h = h.replace(/<p>\s*(&nbsp;|&#160;)\s*<br \/>\s*<\/p>/g, '<p>' + nb + '</p>');
-		h = h.replace(/<p>\s*<br \/>\s*&nbsp;\s*<\/p>/g, '<p>' + nb + '</p>');
-		h = h.replace(new RegExp('<a>(.*?)<\\/a>', 'g'), '$1');
-		h = h.replace(/<p([^>]*)>\s*<\/p>/g, '<p$1>' + nb + '</p>');
+					m.add(o);
+				}
+			});
 
-		// Clean body
-		if (/^\s*(<br \/>|<p>&nbsp;<\/p>|<p>&#160;<\/p>|<p><\/p>)\s*$/.test(h))
-			h = '';
+			t.onRenderMenu.dispatch(t, m);
+			t.menu = m;
+		},
 
-		// If preformatted
-		if (s.preformatted) {
-			h = h.replace(/^<pre>/, '');
-			h = h.replace(/<\/pre>$/, '');
-			h = '<pre>' + h + '</pre>';
-		}
+		postRender : function() {
+			var t = this, cp = t.classPrefix;
 
-		// Gecko specific processing
-		if (tinyMCE.isGecko) {
-			// Makes no sence but FF generates it!!
-			h = h.replace(/<br \/>\s*<\/li>/g, '</li>');
-			h = h.replace(/&nbsp;\s*<\/(dd|dt)>/g, '</$1>');
-			h = h.replace(/<o:p _moz-userdefined="" \/>/g, '');
-			h = h.replace(/<td([^>]*)>\s*<br \/>\s*<\/td>/g, '<td$1>' + nb + '</td>');
-		}
+			Event.add(t.id, 'click', t.showMenu, t);
+			Event.add(t.id + '_text', 'focus', function() {
+				if (!t._focused) {
+					t.keyDownHandler = Event.add(t.id + '_text', 'keydown', function(e) {
+						var idx = -1, v, kc = e.keyCode;
 
-		if (s.force_br_newlines)
-			h = h.replace(/<p>(&nbsp;|&#160;)<\/p>/g, '<br />');
+						// Find current index
+						each(t.items, function(v, i) {
+							if (t.selectedValue == v.value)
+								idx = i;
+						});
 
-		// Call custom cleanup code
-		h = tinyMCE._customCleanup(inst, on_save ? "get_from_editor" : "insert_to_editor", h);
+						// Move up/down
+						if (kc == 38)
+							v = t.items[idx - 1];
+						else if (kc == 40)
+							v = t.items[idx + 1];
+						else if (kc == 13) {
+							// Fake select on enter
+							v = t.selectedValue;
+							t.selectedValue = null; // Needs to be null to fake change
+							t.settings.onselect(v);
+							return Event.cancel(e);
+						}
 
-		// Remove internal classes
-		if (on_save) {
-			h = h.replace(new RegExp(' ?(mceItem[a-zA-Z0-9]*|' + s.visual_table_class + ')', 'g'), '');
-			h = h.replace(new RegExp(' ?class=""', 'g'), '');
+						if (v) {
+							t.hideMenu();
+							t.select(v.value);
+						}
+					});
+				}
+
+				t._focused = 1;
+			});
+			Event.add(t.id + '_text', 'blur', function() {Event.remove(t.id + '_text', 'keydown', t.keyDownHandler); t._focused = 0;});
+
+			// Old IE doesn't have hover on all elements
+			if (tinymce.isIE6 || !DOM.boxModel) {
+				Event.add(t.id, 'mouseover', function() {
+					if (!DOM.hasClass(t.id, cp + 'Disabled'))
+						DOM.addClass(t.id, cp + 'Hover');
+				});
+
+				Event.add(t.id, 'mouseout', function() {
+					if (!DOM.hasClass(t.id, cp + 'Disabled'))
+						DOM.removeClass(t.id, cp + 'Hover');
+				});
+			}
+
+			t.onPostRender.dispatch(t, DOM.get(t.id));
+		},
+
+		destroy : function() {
+			this.parent();
+
+			Event.clear(this.id + '_text');
+			Event.clear(this.id + '_open');
 		}
+	});
+})(tinymce);
+(function(tinymce) {
+	var DOM = tinymce.DOM, Event = tinymce.dom.Event, each = tinymce.each, Dispatcher = tinymce.util.Dispatcher;
 
-		if (s.remove_linebreaks && !c.settings.indent)
-			h = h.replace(/\n|\r/g, ' ');
+	tinymce.create('tinymce.ui.NativeListBox:tinymce.ui.ListBox', {
+		NativeListBox : function(id, s) {
+			this.parent(id, s);
+			this.classPrefix = 'mceNativeListBox';
+		},
 
-		if (d)
-			t4 = new Date().getTime();
+		setDisabled : function(s) {
+			DOM.get(this.id).disabled = s;
+		},
 
-		if (on_save && c.settings.indent)
-			h = c.formatHTML(h);
+		isDisabled : function() {
+			return DOM.get(this.id).disabled;
+		},
 
-		// If encoding (not recommended option)
-		if (on_submit && (s.encoding == "xml" || s.encoding == "html"))
-			h = c.xmlEncode(h);
+		select : function(va) {
+			var t = this, fv, f;
 
-		if (d)
-			t5 = new Date().getTime();
+			if (va == undefined)
+				return t.selectByIndex(-1);
 
-		if (c.settings.debug)
-			tinyMCE.debug("Cleanup in ms: Pre=" + (t2-t1) + ", Serialize: " + (t3-t2) + ", Post: " + (t4-t3) + ", Format: " + (t5-t4) + ", Sum: " + (t5-t1) + ".");
+			// Is string or number make function selector
+			if (va && va.call)
+				f = va;
+			else {
+				f = function(v) {
+					return v == va;
+				};
+			}
 
-		return h;
-	}
-});
+			// Do we need to do something?
+			if (va != t.selectedValue) {
+				// Find item
+				each(t.items, function(o, i) {
+					if (f(o.value)) {
+						fv = 1;
+						t.selectByIndex(i);
+						return false;
+					}
+				});
 
-function TinyMCE_Cleanup() {
-	this.isIE = (navigator.appName == "Microsoft Internet Explorer");
-	this.rules = tinyMCE.clearArray([]);
+				if (!fv)
+					t.selectByIndex(-1);
+			}
+		},
 
-	// Default config
-	this.settings = {
-		indent_elements : 'head,table,tbody,thead,tfoot,form,tr,ul,ol,blockquote,object',
-		newline_before_elements : 'h1,h2,h3,h4,h5,h6,pre,address,div,ul,ol,li,meta,option,area,title,link,base,script,td',
-		newline_after_elements : 'br,hr,p,pre,address,div,ul,ol,meta,option,area,link,base,script',
-		newline_before_after_elements : 'html,head,body,table,thead,tbody,tfoot,tr,form,ul,ol,blockquote,p,object,param,hr,div',
-		indent_char : '\t',
-		indent_levels : 1,
-		entity_encoding : 'raw',
-		valid_elements : '*[*]',
-		entities : '',
-		url_converter : '',
-		invalid_elements : '',
-		verify_html : false
-	};
+		selectByIndex : function(idx) {
+			DOM.get(this.id).selectedIndex = idx + 1;
+			this.selectedValue = this.items[idx] ? this.items[idx].value : null;
+		},
 
-	this.vElements = tinyMCE.clearArray([]);
-	this.vElementsRe = '';
-	this.closeElementsRe = /^(IMG|BR|HR|LINK|META|BASE|INPUT|AREA)$/;
-	this.codeElementsRe = /^(SCRIPT|STYLE)$/;
-	this.serializationId = 0;
-	this.mceAttribs = {
-		href : 'mce_href',
-		src : 'mce_src',
-		type : 'mce_type'
-	};
-}
+		add : function(n, v, a) {
+			var o, t = this;
 
-TinyMCE_Cleanup.prototype = {
-	init : function(s) {
-		var n, a, i, ir, or, st;
+			a = a || {};
+			a.value = v;
 
-		for (n in s)
-			this.settings[n] = s[n];
+			if (t.isRendered())
+				DOM.add(DOM.get(this.id), 'option', a, n);
 
-		// Setup code formating
-		s = this.settings;
+			o = {
+				title : n,
+				value : v,
+				attribs : a
+			};
 
-		// Setup regexps
-		this.inRe = this._arrayToRe(s.indent_elements.split(','), '', '^<(', ')[^>]*');
-		this.ouRe = this._arrayToRe(s.indent_elements.split(','), '', '^<\\/(', ')[^>]*');
-		this.nlBeforeRe = this._arrayToRe(s.newline_before_elements.split(','), 'gi', '<(',  ')([^>]*)>');
-		this.nlAfterRe = this._arrayToRe(s.newline_after_elements.split(','), 'gi', '<(',  ')([^>]*)>');
-		this.nlBeforeAfterRe = this._arrayToRe(s.newline_before_after_elements.split(','), 'gi', '<(\\/?)(', ')([^>]*)>');
-		this.serializedNodes = [];
-		this.serializationId = 0;
+			t.items.push(o);
+			t.onAdd.dispatch(t, o);
+		},
 
-		if (s.invalid_elements !== '')
-			this.iveRe = this._arrayToRe(s.invalid_elements.toUpperCase().split(','), 'g', '^(', ')$');
-		else
-			this.iveRe = null;
+		getLength : function() {
+			return this.items.length;
+		},
 
-		// Setup separator
-		st = '';
-		for (i=0; i<s.indent_levels; i++)
-			st += s.indent_char;
+		renderHTML : function() {
+			var h, t = this;
 
-		this.inStr = st;
+			h = DOM.createHTML('option', {value : ''}, '-- ' + t.settings.title + ' --');
 
-		// If verify_html if false force *[*]
-		if (!s.verify_html) {
-			s.valid_elements = '*[*]';
-			s.extended_valid_elements = '';
-		}
+			each(t.items, function(it) {
+				h += DOM.createHTML('option', {value : it.value}, it.title);
+			});
 
-		this.fillStr = s.entity_encoding == "named" ? "&nbsp;" : "&#160;";
-		this.idCount = 0;
-		this.xmlEncodeRe = new RegExp('[\u007F-\uFFFF<>&"]', 'g');
-	},
+			h = DOM.createHTML('select', {id : t.id, 'class' : 'mceNativeListBox'}, h);
 
-	addRuleStr : function(s) {
-		var r = this.parseRuleStr(s), n;
+			return h;
+		},
 
-		for (n in r) {
-			if (r[n])
-				this.rules[n] = r[n];
-		}
+		postRender : function() {
+			var t = this, ch;
 
-		this.vElements = tinyMCE.clearArray([]);
+			t.rendered = true;
 
-		for (n in this.rules) {
-			if (this.rules[n])
-				this.vElements[this.vElements.length] = this.rules[n].tag;
+			function onChange(e) {
+				var v = t.items[e.target.selectedIndex - 1];
+
+				if (v && (v = v.value)) {
+					t.onChange.dispatch(t, v);
+
+					if (t.settings.onselect)
+						t.settings.onselect(v);
+				}
+			};
+
+			Event.add(t.id, 'change', onChange);
+
+			// Accessibility keyhandler
+			Event.add(t.id, 'keydown', function(e) {
+				var bf;
+
+				Event.remove(t.id, 'change', ch);
+
+				bf = Event.add(t.id, 'blur', function() {
+					Event.add(t.id, 'change', onChange);
+					Event.remove(t.id, 'blur', bf);
+				});
+
+				if (e.keyCode == 13 || e.keyCode == 32) {
+					onChange(e);
+					return Event.cancel(e);
+				}
+			});
+
+			t.onPostRender.dispatch(t, DOM.get(t.id));
 		}
+	});
+})(tinymce);
+(function(tinymce) {
+	var DOM = tinymce.DOM, Event = tinymce.dom.Event, each = tinymce.each;
 
-		this.vElementsRe = this._arrayToRe(this.vElements, '');
-	},
+	tinymce.create('tinymce.ui.MenuButton:tinymce.ui.Button', {
+		MenuButton : function(id, s) {
+			this.parent(id, s);
 
-	isValid : function(n) {
-		if (!this.rulesDone)
-			this._setupRules(); // Will initialize cleanup rules
+			this.onRenderMenu = new tinymce.util.Dispatcher(this);
 
-		// Empty is true since it removes formatting
-		if (!n)
-			return true;
+			s.menu_container = s.menu_container || DOM.doc.body;
+		},
 
-		// Clean the name up a bit
-		n = n.replace(/[^a-z0-9]+/gi, '').toUpperCase();
+		showMenu : function() {
+			var t = this, p1, p2, e = DOM.get(t.id), m;
 
-		return !tinyMCE.getParam('cleanup') || this.vElementsRe.test(n);
-	},
+			if (t.isDisabled())
+				return;
 
-	addChildRemoveRuleStr : function(s) {
-		var x, y, p, i, t, tn, ta, cl, r;
+			if (!t.isMenuRendered) {
+				t.renderMenu();
+				t.isMenuRendered = true;
+			}
 
-		if (!s)
-			return;
+			if (t.isMenuVisible)
+				return t.hideMenu();
 
-		ta = s.split(',');
-		for (x=0; x<ta.length; x++) {
-			s = ta[x];
+			p1 = DOM.getPos(t.settings.menu_container);
+			p2 = DOM.getPos(e);
 
-			// Split tag/children
-			p = this.split(/\[|\]/, s);
-			if (p == null || p.length < 1)
-				t = s.toUpperCase();
-			else
-				t = p[0].toUpperCase();
+			m = t.menu;
+			m.settings.offset_x = p2.x;
+			m.settings.offset_y = p2.y;
+			m.settings.vp_offset_x = p2.x;
+			m.settings.vp_offset_y = p2.y;
+			m.settings.keyboard_focus = t._focused;
+			m.showMenu(0, e.clientHeight);
 
-			// Handle all tag names
-			tn = this.split('/', t);
-			for (y=0; y<tn.length; y++) {
-				r = "^(";
+			Event.add(DOM.doc, 'mousedown', t.hideMenu, t);
+			t.setState('Selected', 1);
 
-				// Build regex
-				cl = this.split(/\|/, p[1]);
-				for (i=0; i<cl.length; i++) {
-					if (cl[i] == '%istrict')
-						r += tinyMCE.inlineStrict;
-					else if (cl[i] == '%itrans')
-						r += tinyMCE.inlineTransitional;
-					else if (cl[i] == '%istrict_na')
-						r += tinyMCE.inlineStrict.substring(2);
-					else if (cl[i] == '%itrans_na')
-						r += tinyMCE.inlineTransitional.substring(2);
-					else if (cl[i] == '%btrans')
-						r += tinyMCE.blockElms;
-					else if (cl[i] == '%strict')
-						r += tinyMCE.blockStrict;
-					else
-						r += (cl[i].charAt(0) != '#' ? cl[i].toUpperCase() : cl[i]);
+			t.isMenuVisible = 1;
+		},
 
-					r += (i != cl.length - 1 ? '|' : '');
-				}
+		renderMenu : function() {
+			var t = this, m;
 
-				r += ')$';
+			m = t.settings.control_manager.createDropMenu(t.id + '_menu', {
+				menu_line : 1,
+				'class' : this.classPrefix + 'Menu',
+				icons : t.settings.icons
+			});
 
-				if (this.childRules == null)
-					this.childRules = tinyMCE.clearArray([]);
+			m.onHideMenu.add(t.hideMenu, t);
 
-				this.childRules[tn[y]] = new RegExp(r);
+			t.onRenderMenu.dispatch(t, m);
+			t.menu = m;
+		},
 
-				if (p.length > 1)
-					this.childRules[tn[y]].wrapTag = p[2];
+		hideMenu : function(e) {
+			var t = this;
+
+			// Prevent double toogles by canceling the mouse click event to the button
+			if (e && e.type == "mousedown" && DOM.getParent(e.target, function(e) {return e.id === t.id || e.id === t.id + '_open';}))
+				return;
+
+			if (!e || !DOM.getParent(e.target, '.mceMenu')) {
+				t.setState('Selected', 0);
+				Event.remove(DOM.doc, 'mousedown', t.hideMenu, t);
+				if (t.menu)
+					t.menu.hideMenu();
 			}
+
+			t.isMenuVisible = 0;
+		},
+
+		postRender : function() {
+			var t = this, s = t.settings;
+
+			Event.add(t.id, 'click', function() {
+				if (!t.isDisabled()) {
+					if (s.onclick)
+						s.onclick(t.value);
+
+					t.showMenu();
+				}
+			});
 		}
-	},
+	});
+})(tinymce);
 
-	parseRuleStr : function(s) {
-		var ta, p, r, a, i, x, px, t, tn, y, av, or = tinyMCE.clearArray([]), dv;
+(function(tinymce) {
+	var DOM = tinymce.DOM, Event = tinymce.dom.Event, each = tinymce.each;
 
-		if (s == null || s.length == 0)
-			return or;
+	tinymce.create('tinymce.ui.SplitButton:tinymce.ui.MenuButton', {
+		SplitButton : function(id, s) {
+			this.parent(id, s);
+			this.classPrefix = 'mceSplitButton';
+		},
 
-		ta = s.split(',');
-		for (x=0; x<ta.length; x++) {
-			s = ta[x];
-			if (s.length == 0)
-				continue;
+		renderHTML : function() {
+			var h, t = this, s = t.settings, h1;
 
-			// Split tag/attrs
-			p = this.split(/\[|\]/, s);
-			if (p == null || p.length < 1)
-				t = s.toUpperCase();
+			h = '<tbody><tr>';
+
+			if (s.image)
+				h1 = DOM.createHTML('img ', {src : s.image, 'class' : 'mceAction ' + s['class']});
 			else
-				t = p[0].toUpperCase();
+				h1 = DOM.createHTML('span', {'class' : 'mceAction ' + s['class']}, '');
 
-			// Handle all tag names
-			tn = this.split('/', t);
-			for (y=0; y<tn.length; y++) {
-				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>';
+	
+			h1 = DOM.createHTML('span', {'class' : 'mceOpen ' + s['class']});
+			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.tag = tn[y];
-				r.forceAttribs = null;
-				r.defaultAttribs = null;
-				r.validAttribValues = null;
+			h += '</tr></tbody>';
 
-				// Handle prefixes
-				px = r.tag.charAt(0);
-				r.forceOpen = px == '+';
-				r.removeEmpty = px == '-';
-				r.fill = px == '#';
-				r.tag = r.tag.replace(/\+|-|#/g, '');
-				r.oTagName = tn[0].replace(/\+|-|#/g, '').toLowerCase();
-				r.isWild = new RegExp('\\*|\\?|\\+', 'g').test(r.tag);
-				r.validRe = new RegExp(this._wildcardToRe('^' + r.tag + '$'));
+			return DOM.createHTML('table', {id : t.id, 'class' : 'mceSplitButton mceSplitButtonEnabled ' + s['class'], cellpadding : '0', cellspacing : '0', onmousedown : 'return false;', title : s.title}, h);
+		},
 
-				// Setup valid attributes
-				if (p.length > 1) {
-					r.vAttribsRe = '^(';
-					a = this.split(/\|/, p[1]);
+		postRender : function() {
+			var t = this, s = t.settings;
 
-					for (i=0; i<a.length; i++) {
-						t = a[i];
+			if (s.onclick) {
+				Event.add(t.id + '_action', 'click', function() {
+					if (!t.isDisabled())
+						s.onclick(t.value);
+				});
+			}
 
-						if (t.charAt(0) == '!') {
-							a[i] = t = t.substring(1);
+			Event.add(t.id + '_open', 'click', t.showMenu, t);
+			Event.add(t.id + '_open', 'focus', function() {t._focused = 1;});
+			Event.add(t.id + '_open', 'blur', function() {t._focused = 0;});
 
-							if (!r.reqAttribsRe)
-								r.reqAttribsRe = '\\s+(' + t;
-							else
-								r.reqAttribsRe += '|' + t;
-						}
+			// Old IE doesn't have hover on all elements
+			if (tinymce.isIE6 || !DOM.boxModel) {
+				Event.add(t.id, 'mouseover', function() {
+					if (!DOM.hasClass(t.id, 'mceSplitButtonDisabled'))
+						DOM.addClass(t.id, 'mceSplitButtonHover');
+				});
 
-						av = new RegExp('(=|:|<)(.*?)$').exec(t);
-						t = t.replace(new RegExp('(=|:|<).*?$'), '');
-						if (av && av.length > 0) {
-							if (av[0].charAt(0) == ':') {
-								if (!r.forceAttribs)
-									r.forceAttribs = tinyMCE.clearArray([]);
+				Event.add(t.id, 'mouseout', function() {
+					if (!DOM.hasClass(t.id, 'mceSplitButtonDisabled'))
+						DOM.removeClass(t.id, 'mceSplitButtonHover');
+				});
+			}
+		},
 
-								r.forceAttribs[t.toLowerCase()] = av[0].substring(1);
-							} else if (av[0].charAt(0) == '=') {
-								if (!r.defaultAttribs)
-									r.defaultAttribs = tinyMCE.clearArray([]);
+		destroy : function() {
+			this.parent();
 
-								dv = av[0].substring(1);
+			Event.clear(this.id + '_action');
+			Event.clear(this.id + '_open');
+		}
+	});
+})(tinymce);
 
-								r.defaultAttribs[t.toLowerCase()] = dv == '' ? "mce_empty" : dv;
-							} else if (av[0].charAt(0) == '<') {
-								if (!r.validAttribValues)
-									r.validAttribValues = tinyMCE.clearArray([]);
+(function(tinymce) {
+	var DOM = tinymce.DOM, Event = tinymce.dom.Event, is = tinymce.is, each = tinymce.each;
 
-								r.validAttribValues[t.toLowerCase()] = this._arrayToRe(this.split('?', av[0].substring(1)), 'i');
-							}
-						}
+	tinymce.create('tinymce.ui.ColorSplitButton:tinymce.ui.SplitButton', {
+		ColorSplitButton : function(id, s) {
+			var t = this;
 
-						r.vAttribsRe += '' + t.toLowerCase() + (i != a.length - 1 ? '|' : '');
+			t.parent(id, s);
 
-						a[i] = t.toLowerCase();
-					}
+			t.settings = s = tinymce.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'
+			}, t.settings);
 
-					if (r.reqAttribsRe)
-						r.reqAttribsRe = new RegExp(r.reqAttribsRe + ')=\"', 'g');
+			t.onShowMenu = new tinymce.util.Dispatcher(t);
 
-					r.vAttribsRe += ')$';
-					r.vAttribsRe = this._wildcardToRe(r.vAttribsRe);
-					r.vAttribsReIsWild = new RegExp('\\*|\\?|\\+', 'g').test(r.vAttribsRe);
-					r.vAttribsRe = new RegExp(r.vAttribsRe);
-					r.vAttribs = a.reverse();
+			t.onHideMenu = new tinymce.util.Dispatcher(t);
 
-					//tinyMCE.debug(r.tag, r.oTagName, r.vAttribsRe, r.vAttribsReWC);
-				} else {
-					r.vAttribsRe = '';
-					r.vAttribs = tinyMCE.clearArray([]);
-					r.vAttribsReIsWild = false;
+			t.value = s.default_color;
+		},
+
+		showMenu : function() {
+			var t = this, r, p, e, p2;
+
+			if (t.isDisabled())
+				return;
+
+			if (!t.isMenuRendered) {
+				t.renderMenu();
+				t.isMenuRendered = true;
+			}
+
+			if (t.isMenuVisible)
+				return t.hideMenu();
+
+			e = DOM.get(t.id);
+			DOM.show(t.id + '_menu');
+			DOM.addClass(e, 'mceSplitButtonSelected');
+			p2 = DOM.getPos(e);
+			DOM.setStyles(t.id + '_menu', {
+				left : p2.x,
+				top : p2.y + e.clientHeight,
+				zIndex : 200000
+			});
+			e = 0;
+
+			Event.add(DOM.doc, 'mousedown', t.hideMenu, t);
+			t.onShowMenu.dispatch(t);
+
+			if (t._focused) {
+				t._keyHandler = Event.add(t.id + '_menu', 'keydown', function(e) {
+					if (e.keyCode == 27)
+						t.hideMenu();
+				});
+
+				DOM.select('a', t.id + '_menu')[0].focus(); // Select first link
+			}
+
+			t.isMenuVisible = 1;
+		},
+
+		hideMenu : function(e) {
+			var t = this;
+
+			// Prevent double toogles by canceling the mouse click event to the button
+			if (e && e.type == "mousedown" && DOM.getParent(e.target, function(e) {return e.id === t.id + '_open';}))
+				return;
+
+			if (!e || !DOM.getParent(e.target, '.mceSplitButtonMenu')) {
+				DOM.removeClass(t.id, 'mceSplitButtonSelected');
+				Event.remove(DOM.doc, 'mousedown', t.hideMenu, t);
+				Event.remove(t.id + '_menu', 'keydown', t._keyHandler);
+				DOM.hide(t.id + '_menu');
+			}
+
+			t.onHideMenu.dispatch(t);
+
+			t.isMenuVisible = 0;
+		},
+
+		renderMenu : function() {
+			var t = this, m, i = 0, s = t.settings, n, tb, tr, w;
+
+			w = DOM.add(s.menu_container, 'div', {id : t.id + '_menu', 'class' : s['menu_class'] + ' ' + s['class'], style : 'position:absolute;left:0;top:-1000px;'});
+			m = DOM.add(w, 'div', {'class' : s['class'] + ' mceSplitButtonMenu'});
+			DOM.add(m, 'span', {'class' : 'mceMenuLine'});
+
+			n = DOM.add(m, 'table', {'class' : 'mceColorSplitMenu'});
+			tb = DOM.add(n, 'tbody');
+
+			// Generate color grid
+			i = 0;
+			each(is(s.colors, 'array') ? s.colors : s.colors.split(','), function(c) {
+				c = c.replace(/^#/, '');
+
+				if (!i--) {
+					tr = DOM.add(tb, 'tr');
+					i = s.grid_width - 1;
 				}
 
-				or[r.tag] = r;
+				n = DOM.add(tr, 'td');
+
+				n = DOM.add(n, 'a', {
+					href : 'javascript:;',
+					style : {
+						backgroundColor : '#' + c
+					},
+					_mce_color : '#' + c
+				});
+			});
+
+			if (s.more_colors_func) {
+				n = DOM.add(tb, 'tr');
+				n = DOM.add(n, 'td', {colspan : s.grid_width, 'class' : 'mceMoreColors'});
+				n = DOM.add(n, 'a', {id : t.id + '_more', href : 'javascript:;', onclick : 'return false;', 'class' : 'mceMoreColors'}, s.more_colors_title);
+
+				Event.add(n, 'click', function(e) {
+					s.more_colors_func.call(s.more_colors_scope || this);
+					return Event.cancel(e); // Cancel to fix onbeforeunload problem
+				});
 			}
+
+			DOM.addClass(m, 'mceColorSplitMenu');
+
+			Event.add(t.id + '_menu', 'click', function(e) {
+				var c;
+
+				e = e.target;
+
+				if (e.nodeName == 'A' && (c = e.getAttribute('_mce_color')))
+					t.setColor(c);
+
+				return Event.cancel(e); // Prevent IE auto save warning
+			});
+
+			return w;
+		},
+
+		setColor : function(c) {
+			var t = this;
+
+			DOM.setStyle(t.id + '_preview', 'backgroundColor', c);
+
+			t.value = c;
+			t.hideMenu();
+			t.settings.onselect(c);
+		},
+
+		postRender : function() {
+			var t = this, id = t.id;
+
+			t.parent();
+			DOM.add(id + '_action', 'div', {id : id + '_preview', 'class' : 'mceColorPreview'});
+			DOM.setStyle(t.id + '_preview', 'backgroundColor', t.value);
+		},
+
+		destroy : function() {
+			this.parent();
+
+			Event.clear(this.id + '_menu');
+			Event.clear(this.id + '_more');
+			DOM.remove(this.id + '_menu');
 		}
+	});
+})(tinymce);
 
-		return or;
-	},
+tinymce.create('tinymce.ui.Toolbar:tinymce.ui.Container', {
+	renderHTML : function() {
+		var t = this, h = '', c, co, dom = tinymce.DOM, s = t.settings, i, pr, nx, cl;
 
-	serializeNodeAsXML : function(n) {
-		var s, b;
+		cl = t.controls;
+		for (i=0; i<cl.length; i++) {
+			// Get current control, prev control, next control and if the control is a list box or not
+			co = cl[i];
+			pr = cl[i - 1];
+			nx = cl[i + 1];
 
-		if (!this.xmlDoc) {
-			if (this.isIE) {
-				try {this.xmlDoc = new ActiveXObject('MSXML2.DOMDocument');} catch (e) {}
+			// Add toolbar start
+			if (i === 0) {
+				c = 'mceToolbarStart';
 
-				if (!this.xmlDoc)
-					try {this.xmlDoc = new ActiveXObject('Microsoft.XmlDom');} catch (e) {}
-			} else
-				this.xmlDoc = document.implementation.createDocument('', '', null);
+				if (co.Button)
+					c += ' mceToolbarStartButton';
+				else if (co.SplitButton)
+					c += ' mceToolbarStartSplitButton';
+				else if (co.ListBox)
+					c += ' mceToolbarStartListBox';
 
-			if (!this.xmlDoc)
-				alert("Error XML Parser could not be found.");
+				h += dom.createHTML('td', {'class' : c}, dom.createHTML('span', null, '<!-- IE -->'));
+			}
+
+			// Add toolbar end before list box and after the previous button
+			// This is to fix the o2k7 editor skins
+			if (pr && co.ListBox) {
+				if (pr.Button || pr.SplitButton)
+					h += dom.createHTML('td', {'class' : 'mceToolbarEnd'}, dom.createHTML('span', null, '<!-- IE -->'));
+			}
+
+			// Render control HTML
+
+			// IE 8 quick fix, needed to propertly generate a hit area for anchors
+			if (dom.stdMode)
+				h += '<td style="position: relative">' + co.renderHTML() + '</td>';
+			else
+				h += '<td>' + co.renderHTML() + '</td>';
+
+			// Add toolbar start after list box and before the next button
+			// This is to fix the o2k7 editor skins
+			if (nx && co.ListBox) {
+				if (nx.Button || nx.SplitButton)
+					h += dom.createHTML('td', {'class' : 'mceToolbarStart'}, dom.createHTML('span', null, '<!-- IE -->'));
+			}
 		}
 
-		if (this.xmlDoc.firstChild)
-			this.xmlDoc.removeChild(this.xmlDoc.firstChild);
+		c = 'mceToolbarEnd';
 
-		b = this.xmlDoc.createElement("html");
-		b = this.xmlDoc.appendChild(b);
+		if (co.Button)
+			c += ' mceToolbarEndButton';
+		else if (co.SplitButton)
+			c += ' mceToolbarEndSplitButton';
+		else if (co.ListBox)
+			c += ' mceToolbarEndListBox';
 
-		this._convertToXML(n, b);
+		h += dom.createHTML('td', {'class' : c}, dom.createHTML('span', null, '<!-- IE -->'));
 
-		if (this.isIE)
-			return this.xmlDoc.xml;
-		else
-			return new XMLSerializer().serializeToString(this.xmlDoc);
-	},
+		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>');
+	}
+});
 
-	_convertToXML : function(n, xn) {
-		var xd, el, i, l, cn, at, no, hc = false;
+(function(tinymce) {
+	var Dispatcher = tinymce.util.Dispatcher, each = tinymce.each;
 
-		if (tinyMCE.isRealIE && this._isDuplicate(n))
-			return;
+	tinymce.create('tinymce.AddOnManager', {
+		AddOnManager : function() {
+			var self = this;
 
-		xd = this.xmlDoc;
+			self.items = [];
+			self.urls = {};
+			self.lookup = {};
+			self.onAdd = new Dispatcher(self);
+		},
 
-		switch (n.nodeType) {
-			case 1: // Element
-				hc = n.hasChildNodes();
+		get : function(n) {
+			return this.lookup[n];
+		},
 
-				el = xd.createElement(n.nodeName.toLowerCase());
+		requireLangPack : function(n) {
+			var s = tinymce.settings;
 
-				at = n.attributes;
-				for (i=at.length-1; i>-1; i--) {
-					no = at[i];
+			if (s && s.language)
+				tinymce.ScriptLoader.add(this.urls[n] + '/langs/' + s.language + '.js');
+		},
 
-					if (no.specified && no.nodeValue)
-						el.setAttribute(no.nodeName.toLowerCase(), no.nodeValue);
-				}
+		add : function(id, o) {
+			this.items.push(o);
+			this.lookup[id] = o;
+			this.onAdd.dispatch(this, id, o);
 
-				if (!hc && !this.closeElementsRe.test(n.nodeName))
-					el.appendChild(xd.createTextNode(""));
+			return o;
+		},
 
-				xn = xn.appendChild(el);
-				break;
+		load : function(n, u, cb, s) {
+			var t = this;
 
-			case 3: // Text
-				xn.appendChild(xd.createTextNode(n.nodeValue));
+			if (t.urls[n])
 				return;
 
-			case 8: // Comment
-				xn.appendChild(xd.createComment(n.nodeValue));
-				return;
-		}
+			if (u.indexOf('/') != 0 && u.indexOf('://') == -1)
+				u = tinymce.baseURL + '/' +  u;
 
-		if (hc) {
-			cn = n.childNodes;
+			t.urls[n] = u.substring(0, u.lastIndexOf('/'));
 
-			for (i=0, l=cn.length; i<l; i++)
-				this._convertToXML(cn[i], xn);
+			if (!t.lookup[n])
+				tinymce.ScriptLoader.add(u, cb, s);
 		}
-	},
+	});
 
-	serializeNodeAsHTML : function(n, inn) {
-		var en, no, h = '', i, l, t, st, r, cn, va = false, f = false, at, hc, cr, nn;
+	// Create plugin and theme managers
+	tinymce.PluginManager = new tinymce.AddOnManager();
+	tinymce.ThemeManager = new tinymce.AddOnManager();
+}(tinymce));
 
-		if (!this.rulesDone)
-			this._setupRules(); // Will initialize cleanup rules
+(function(tinymce) {
+	// Shorten names
+	var each = tinymce.each, extend = tinymce.extend,
+		DOM = tinymce.DOM, Event = tinymce.dom.Event,
+		ThemeManager = tinymce.ThemeManager, PluginManager = tinymce.PluginManager,
+		explode = tinymce.explode,
+		Dispatcher = tinymce.util.Dispatcher, undefined, instanceCounter = 0;
 
-		if (tinyMCE.isRealIE && this._isDuplicate(n))
-			return '';
+	// Setup some URLs where the editor API is located and where the document is
+	tinymce.documentBaseURL = window.location.href.replace(/[\?#].*$/, '').replace(/[\/\\][^\/]+$/, '');
+	if (!/[\/\\]$/.test(tinymce.documentBaseURL))
+		tinymce.documentBaseURL += '/';
 
-		// Skip non valid child elements
-		if (n.parentNode && this.childRules != null) {
-			cr = this.childRules[n.parentNode.nodeName];
+	tinymce.baseURL = new tinymce.util.URI(tinymce.documentBaseURL).toAbsolute(tinymce.baseURL);
 
-			if (typeof(cr) != "undefined" && !cr.test(n.nodeName)) {
-				st = true;
-				t = null;
-			}
-		}
+	tinymce.baseURI = new tinymce.util.URI(tinymce.baseURL);
 
-		switch (n.nodeType) {
-			case 1: // Element
-				hc = n.hasChildNodes();
+	// Add before unload listener
+	// This was required since IE was leaking memory if you added and removed beforeunload listeners
+	// with attachEvent/detatchEvent so this only adds one listener and instances can the attach to the onBeforeUnload event
+	tinymce.onBeforeUnload = new Dispatcher(tinymce);
 
-				if (st)
-					break;
+	// Must be on window or IE will leak if the editor is placed in frame or iframe
+	Event.add(window, 'beforeunload', function(e) {
+		tinymce.onBeforeUnload.dispatch(tinymce, e);
+	});
 
-				nn = n.nodeName;
+	tinymce.onAddEditor = new Dispatcher(tinymce);
 
-				if (tinyMCE.isRealIE) {
-					// MSIE sometimes produces <//tag>
-					if (n.nodeName.indexOf('/') != -1)
-						break;
+	tinymce.onRemoveEditor = new Dispatcher(tinymce);
 
-					// MSIE has it's NS in a separate attrib
-					if (n.scopeName && n.scopeName != 'HTML')
-						nn = n.scopeName.toUpperCase() + ':' + nn.toUpperCase();
-				} else if (tinyMCE.isOpera && nn.indexOf(':') > 0)
-					nn = nn.toUpperCase();
+	tinymce.EditorManager = extend(tinymce, {
+		editors : [],
 
-				// Convert fonts to spans
-				if (this.settings.convert_fonts_to_spans) {
-					// On get content FONT -> SPAN
-					if (this.settings.on_save && nn == 'FONT')
-						nn = 'SPAN';
+		i18n : {},
 
-					// On insert content SPAN -> FONT
-					if (!this.settings.on_save && nn == 'SPAN')
-						nn = 'FONT';
+		activeEditor : null,
+
+		init : function(s) {
+			var t = this, pl, sl = tinymce.ScriptLoader, e, el = [], ed;
+
+			function execCallback(se, n, s) {
+				var f = se[n];
+
+				if (!f)
+					return;
+
+				if (tinymce.is(f, 'string')) {
+					s = f.replace(/\.\w+$/, '');
+					s = s ? tinymce.resolve(s) : 0;
+					f = tinymce.resolve(f);
 				}
 
-				if (this.vElementsRe.test(nn) && (!this.iveRe || !this.iveRe.test(nn)) && !inn) {
-					va = true;
+				return f.apply(s || this, Array.prototype.slice.call(arguments, 2));
+			};
 
-					r = this.rules[nn];
-					if (!r) {
-						at = this.rules;
-						for (no in at) {
-							if (at[no] && at[no].validRe.test(nn)) {
-								r = at[no];
-								break;
-							}
-						}
-					}
+			s = extend({
+				theme : "simple",
+				language : "en"
+			}, s);
 
-					en = r.isWild ? nn.toLowerCase() : r.oTagName;
-					f = r.fill;
+			t.settings = s;
 
-					if (r.removeEmpty && !hc)
-						return "";
+			// Legacy call
+			Event.add(document, 'init', function() {
+				var l, co;
 
-					t = '<' + en;
+				execCallback(s, 'onpageload');
 
-					if (r.vAttribsReIsWild) {
-						// Serialize wildcard attributes
-						at = n.attributes;
-						for (i=at.length-1; i>-1; i--) {
-							no = at[i];
-							if (no.specified && r.vAttribsRe.test(no.nodeName))
-								t += this._serializeAttribute(n, r, no.nodeName);
-						}
-					} else {
-						// Serialize specific attributes
-						for (i=r.vAttribs.length-1; i>-1; i--)
-							t += this._serializeAttribute(n, r, r.vAttribs[i]);
-					}
+				switch (s.mode) {
+					case "exact":
+						l = s.elements || '';
 
-					// Serialize mce_ atts
-					if (!this.settings.on_save) {
-						at = this.mceAttribs;
+						if(l.length > 0) {
+							each(explode(l), function(v) {
+								if (DOM.get(v)) {
+									ed = new tinymce.Editor(v, s);
+									el.push(ed);
+									ed.render(1);
+								} else {
+									each(document.forms, function(f) {
+										each(f.elements, function(e) {
+											if (e.name === v) {
+												v = 'mce_editor_' + instanceCounter++;
+												DOM.setAttrib(e, 'id', v);
 
-						for (no in at) {
-							if (at[no])
-								t += this._serializeAttribute(n, r, at[no]);
+												ed = new tinymce.Editor(v, s);
+												el.push(ed);
+												ed.render(1);
+											}
+										});
+									});
+								}
+							});
 						}
-					}
+						break;
 
-					// Check for required attribs
-					if (r.reqAttribsRe && !t.match(r.reqAttribsRe))
-						t = null;
+					case "textareas":
+					case "specific_textareas":
+						function hasClass(n, c) {
+							return c.constructor === RegExp ? c.test(n.className) : DOM.hasClass(n, c);
+						};
 
-					// Close these
-					if (t != null && this.closeElementsRe.test(nn))
-						return t + ' />';
+						each(DOM.select('textarea'), function(v) {
+							if (s.editor_deselector && hasClass(v, s.editor_deselector))
+								return;
 
-					if (t != null)
-						h += t + '>';
+							if (!s.editor_selector || hasClass(v, s.editor_selector)) {
+								// Can we use the name
+								e = DOM.get(v.name);
+								if (!v.id && !e)
+									v.id = v.name;
 
-					if (this.isIE && this.codeElementsRe.test(nn))
-						h += n.innerHTML;
+								// Generate unique name if missing or already exists
+								if (!v.id || t.get(v.id))
+									v.id = DOM.uniqueId();
+
+								ed = new tinymce.Editor(v.id, s);
+								el.push(ed);
+								ed.render(1);
+							}
+						});
+						break;
 				}
-			break;
 
-			case 3: // Text
-				if (st)
-					break;
+				// Call onInit when all editors are initialized
+				if (s.oninit) {
+					l = co = 0;
 
-				if (n.parentNode && this.codeElementsRe.test(n.parentNode.nodeName))
-					return this.isIE ? '' : n.nodeValue;
+					each(el, function(ed) {
+						co++;
 
-				return this.xmlEncode(n.nodeValue);
+						if (!ed.initialized) {
+							// Wait for it
+							ed.onInit.add(function() {
+								l++;
 
-			case 8: // Comment
-				if (st)
-					break;
+								// All done
+								if (l == co)
+									execCallback(s, 'oninit');
+							});
+						} else
+							l++;
 
-				return "<!--" + this._trimComment(n.nodeValue) + "-->";
-		}
+						// All done
+						if (l == co)
+							execCallback(s, 'oninit');					
+					});
+				}
+			});
+		},
 
-		if (hc) {
-			cn = n.childNodes;
+		get : function(id) {
+			if (id === undefined)
+				return this.editors;
 
-			for (i=0, l=cn.length; i<l; i++)
-				h += this.serializeNodeAsHTML(cn[i]);
-		}
+			return this.editors[id];
+		},
 
-		// Fill empty nodes
-		if (f && !hc)
-			h += this.fillStr;
+		getInstanceById : function(id) {
+			return this.get(id);
+		},
 
-		// End element
-		if (t != null && va)
-			h += '</' + en + '>';
+		add : function(editor) {
+			var self = this, editors = self.editors;
 
-		return h;
-	},
+			// Add named and index editor instance
+			editors[editor.id] = editor;
+			editors.push(editor);
 
-	_serializeAttribute : function(n, r, an) {
-		var av = '', t, os = this.settings.on_save;
+			self._setActive(editor);
+			self.onAddEditor.dispatch(self, editor);
 
-		if (os && (an.indexOf('mce_') == 0 || an.indexOf('_moz') == 0))
-			return '';
 
-		if (os && this.mceAttribs[an])
-			av = this._getAttrib(n, this.mceAttribs[an]);
+			return editor;
+		},
 
-		if (av.length == 0)
-			av = this._getAttrib(n, an);
+		remove : function(editor) {
+			var t = this, i, editors = t.editors;
 
-		if (av.length == 0 && r.defaultAttribs && (t = r.defaultAttribs[an])) {
-			av = t;
+			// Not in the collection
+			if (!editors[editor.id])
+				return null;
 
-			if (av == "mce_empty")
-				return " " + an + '=""';
-		}
+			delete editors[editor.id];
 
-		if (r.forceAttribs && (t = r.forceAttribs[an]))
-			av = t;
+			for (i = 0; i < editors.length; i++) {
+				if (editors[i] == editor) {
+					editors.splice(i, 1);
+					break;
+				}
+			}
 
-		if (os && av.length != 0 && /^(src|href|longdesc)$/.test(an))
-			av = this._urlConverter(this, n, av);
+			// Select another editor since the active one was removed
+			if (t.activeEditor == editor)
+				t._setActive(editors[0]);
 
-		if (av.length != 0 && r.validAttribValues && r.validAttribValues[an] && !r.validAttribValues[an].test(av))
-			return "";
+			editor.destroy();
+			t.onRemoveEditor.dispatch(t, editor);
 
-		if (av.length != 0 && av == "{$uid}")
-			av = "uid_" + (this.idCount++);
+			return editor;
+		},
 
-		if (av.length != 0) {
-			if (an.indexOf('on') != 0)
-				av = this.xmlEncode(av, 1);
+		execCommand : function(c, u, v) {
+			var t = this, ed = t.get(v), w;
 
-			return " " + an + "=" + '"' + av + '"';
-		}
+			// Manager commands
+			switch (c) {
+				case "mceFocus":
+					ed.focus();
+					return true;
 
-		return "";
-	},
+				case "mceAddEditor":
+				case "mceAddControl":
+					if (!t.get(v))
+						new tinymce.Editor(v, t.settings).render();
 
-	formatHTML : function(h) {
-		var s = this.settings, p = '', i = 0, li = 0, o = '', l;
+					return true;
 
-		// Replace BR in pre elements to \n
-		h = h.replace(/<pre([^>]*)>(.*?)<\/pre>/gi, function (a, b, c) {
-			c = c.replace(/<br\s*\/>/gi, '\n');
-			return '<pre' + b + '>' + c + '</pre>';
-		});
+				case "mceAddFrameControl":
+					w = v.window;
 
-		h = h.replace(/\r/g, ''); // Windows sux, isn't carriage return a thing of the past :)
-		h = '\n' + h;
-		h = h.replace(new RegExp('\\n\\s+', 'gi'), '\n'); // Remove previous formatting
-		h = h.replace(this.nlBeforeRe, '\n<$1$2>');
-		h = h.replace(this.nlAfterRe, '<$1$2>\n');
-		h = h.replace(this.nlBeforeAfterRe, '\n<$1$2$3>\n');
-		h += '\n';
+					// Add tinyMCE global instance and tinymce namespace to specified window
+					w.tinyMCE = tinyMCE;
+					w.tinymce = tinymce;
 
-		//tinyMCE.debug(h);
+					tinymce.DOM.doc = w.document;
+					tinymce.DOM.win = w;
 
-		while ((i = h.indexOf('\n', i + 1)) != -1) {
-			if ((l = h.substring(li + 1, i)).length != 0) {
-				if (this.ouRe.test(l) && p.length >= s.indent_levels)
-					p = p.substring(s.indent_levels);
+					ed = new tinymce.Editor(v.element_id, v);
+					ed.render();
 
-				o += p + l + '\n';
-	
-				if (this.inRe.test(l))
-					p += this.inStr;
+					// Fix IE memory leaks
+					if (tinymce.isIE) {
+						function clr() {
+							ed.destroy();
+							w.detachEvent('onunload', clr);
+							w = w.tinyMCE = w.tinymce = null; // IE leak
+						};
+
+						w.attachEvent('onunload', clr);
+					}
+
+					v.page_window = null;
+
+					return true;
+
+				case "mceRemoveEditor":
+				case "mceRemoveControl":
+					if (ed)
+						ed.remove();
+
+					return true;
+
+				case 'mceToggleEditor':
+					if (!ed) {
+						t.execCommand('mceAddControl', 0, v);
+						return true;
+					}
+
+					if (ed.isHidden())
+						ed.show();
+					else
+						ed.hide();
+
+					return true;
 			}
 
-			li = i;
-		}
+			// Run command on active editor
+			if (t.activeEditor)
+				return t.activeEditor.execCommand(c, u, v);
 
-		//tinyMCE.debug(h);
+			return false;
+		},
 
-		return o;
-	},
+		execInstanceCommand : function(id, c, u, v) {
+			var ed = this.get(id);
 
-	xmlEncode : function(s) {
-		var cl = this, re = this.xmlEncodeRe;
+			if (ed)
+				return ed.execCommand(c, u, v);
 
-		if (!this.entitiesDone)
-			this._setupEntities(); // Will intialize lookup table
+			return false;
+		},
 
-		switch (this.settings.entity_encoding) {
-			case "raw":
-				return tinyMCE.xmlEncode(s);
+		triggerSave : function() {
+			each(this.editors, function(e) {
+				e.save();
+			});
+		},
 
-			case "named":
-				return s.replace(re, function (c) {
-					var b = cl.entities[c.charCodeAt(0)];
+		addI18n : function(p, o) {
+			var lo, i18n = this.i18n;
 
-					return b ? '&' + b + ';' : c;
+			if (!tinymce.is(p, 'string')) {
+				each(p, function(o, lc) {
+					each(o, function(o, g) {
+						each(o, function(o, k) {
+							if (g === 'common')
+								i18n[lc + '.' + k] = o;
+							else
+								i18n[lc + '.' + g + '.' + k] = o;
+						});
+					});
 				});
+			} else {
+				each(o, function(o, k) {
+					i18n[p + '.' + k] = o;
+				});
+			}
+		},
 
-			case "numeric":
-				return s.replace(re, function (c) {
-					return '&#' + c.charCodeAt(0) + ';';
-				});
+		// Private methods
+
+		_setActive : function(editor) {
+			this.selectedInstance = this.activeEditor = editor;
 		}
+	});
+})(tinymce);
 
-		return s;
-	},
+(function(tinymce) {
+	// Shorten these names
+	var DOM = tinymce.DOM, Event = tinymce.dom.Event, extend = tinymce.extend,
+		Dispatcher = tinymce.util.Dispatcher, each = tinymce.each, isGecko = tinymce.isGecko,
+		isIE = tinymce.isIE, isWebKit = tinymce.isWebKit, is = tinymce.is,
+		ThemeManager = tinymce.ThemeManager, PluginManager = tinymce.PluginManager,
+		inArray = tinymce.inArray, grep = tinymce.grep, explode = tinymce.explode;
 
-	split : function(re, s) {
-		var i, l, o = [], c = s.split(re);
+	tinymce.create('tinymce.Editor', {
+		Editor : function(id, s) {
+			var t = this;
 
-		for (i=0, l=c.length; i<l; i++) {
-			if (c[i] !== '')
-				o[i] = c[i];
-		}
+			t.id = t.editorId = id;
 
-		return o;
-	},
+			t.execCommands = {};
+			t.queryStateCommands = {};
+			t.queryValueCommands = {};
 
-	_trimComment : function(s) {
-		// Remove mce_src, mce_href
-		s = s.replace(new RegExp('\\smce_src=\"[^\"]*\"', 'gi'), "");
-		s = s.replace(new RegExp('\\smce_href=\"[^\"]*\"', 'gi'), "");
+			t.isNotDirty = false;
 
-		return s;
-	},
+			t.plugins = {};
 
-	_getAttrib : function(e, n, d) {
-		var v, ex, nn;
+			// Add events to the editor
+			each([
+				'onPreInit',
 
-		if (typeof(d) == "undefined")
-			d = "";
+				'onBeforeRenderUI',
 
-		if (!e || e.nodeType != 1)
-			return d;
+				'onPostRender',
 
-		try {
-			v = e.getAttribute(n, 0);
-		} catch (ex) {
-			// IE 7 may cast exception on invalid attributes
-			v = e.getAttribute(n, 2);
-		}
+				'onInit',
 
-		if (n == "class" && !v)
-			v = e.className;
+				'onRemove',
 
-		if (this.isIE) {
-			if (n == "http-equiv")
-				v = e.httpEquiv;
+				'onActivate',
 
-			nn = e.nodeName;
+				'onDeactivate',
 
-			// Skip the default values that IE returns
-			if (nn == "FORM" && n == "enctype" && v == "application/x-www-form-urlencoded")
-				v = "";
+				'onClick',
 
-			if (nn == "INPUT" && n == "size" && v == "20")
-				v = "";
+				'onEvent',
 
-			if (nn == "INPUT" && n == "maxlength" && v == "2147483647")
-				v = "";
+				'onMouseUp',
 
-			// Images
-			if (n == "width" || n == "height")
-				v = e.getAttribute(n, 2);
-		}
+				'onMouseDown',
 
-		if (n == 'style' && v) {
-			if (!tinyMCE.isOpera)
-				v = e.style.cssText;
+				'onDblClick',
 
-			v = tinyMCE.serializeStyle(tinyMCE.parseStyle(v));
-		}
+				'onKeyDown',
 
-		if (this.settings.on_save && n.indexOf('on') != -1 && this.settings.on_save && v && v !== '')
-			v = tinyMCE.cleanupEventStr(v);
+				'onKeyUp',
 
-		return (v && v !== '') ? '' + v : d;
-	},
+				'onKeyPress',
 
-	_urlConverter : function(c, n, v) {
-		if (!c.settings.on_save)
-			return tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings.base_href, v);
-		else if (tinyMCE.getParam('convert_urls')) {
-			if (!this.urlConverter)
-				this.urlConverter = eval(tinyMCE.settings.urlconverter_callback);
+				'onContextMenu',
 
-			return this.urlConverter(v, n, true);
-		}
+				'onSubmit',
 
-		return v;
-	},
+				'onReset',
 
-	_arrayToRe : function(a, op, be, af) {
-		var i, r;
+				'onPaste',
 
-		op = typeof(op) == "undefined" ? "gi" : op;
-		be = typeof(be) == "undefined" ? "^(" : be;
-		af = typeof(af) == "undefined" ? ")$" : af;
+				'onPreProcess',
 
-		r = be;
+				'onPostProcess',
 
-		for (i=0; i<a.length; i++)
-			r += this._wildcardToRe(a[i]) + (i != a.length-1 ? "|" : "");
+				'onBeforeSetContent',
 
-		r += af;
+				'onBeforeGetContent',
 
-		return new RegExp(r, op);
-	},
+				'onSetContent',
 
-	_wildcardToRe : function(s) {
-		s = s.replace(/\?/g, '(\\S?)');
-		s = s.replace(/\+/g, '(\\S+)');
-		s = s.replace(/\*/g, '(\\S*)');
+				'onGetContent',
 
-		return s;
-	},
+				'onLoadContent',
 
-	_setupEntities : function() {
-		var n, a, i, s = this.settings;
+				'onSaveContent',
 
-		// Setup entities
-		if (s.entity_encoding == "named") {
-			n = tinyMCE.clearArray([]);
-			a = this.split(',', s.entities);
-			for (i=0; i<a.length; i+=2)
-				n[a[i]] = a[i+1];
+				'onNodeChange',
 
-			this.entities = n;
-		}
+				'onChange',
 
-		this.entitiesDone = true;
-	},
+				'onBeforeExecCommand',
 
-	_setupRules : function() {
-		var s = this.settings;
+				'onExecCommand',
 
-		// Setup default rule
-		this.addRuleStr(s.valid_elements);
-		this.addRuleStr(s.extended_valid_elements);
-		this.addChildRemoveRuleStr(s.valid_child_elements);
+				'onUndo',
 
-		this.rulesDone = true;
-	},
+				'onRedo',
 
-	_isDuplicate : function(n) {
-		var i, l, sn;
+				'onVisualAid',
 
-		if (!this.settings.fix_content_duplication)
-			return false;
+				'onSetProgressState'
+			], function(e) {
+				t[e] = new Dispatcher(t);
+			});
 
-		if (tinyMCE.isRealIE && n.nodeType == 1) {
-			// Mark elements
-			if (n.mce_serialized == this.serializationId)
-				return true;
+			t.settings = s = extend({
+				id : id,
+				language : 'en',
+				docs_language : 'en',
+				theme : 'simple',
+				skin : 'default',
+				delta_width : 0,
+				delta_height : 0,
+				popup_css : '',
+				plugins : '',
+				document_base_url : tinymce.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 : tinymce.isIE6 ? '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">' : '<!DOCTYPE>', // Use old doctype on IE 6 to avoid horizontal scroll
+				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|*],p
 aram[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
+			}, s);
 
-			n.setAttribute('mce_serialized', this.serializationId);
-		} else {
-			sn = this.serializedNodes;
+			t.documentBaseURI = new tinymce.util.URI(s.document_base_url || tinymce.documentBaseURL, {
+				base_uri : tinyMCE.baseURI
+			});
 
-			// Search lookup table for text nodes  and comments
-			for (i=0, l = sn.length; i<l; i++) {
-				if (sn[i] == n)
-					return true;
+			t.baseURI = tinymce.baseURI;
+
+			// Call setup
+			t.execCallback('setup', t);
+		},
+
+		render : function(nst) {
+			var t = this, s = t.settings, id = t.id, sl = tinymce.ScriptLoader;
+
+			// Page is not loaded yet, wait for it
+			if (!Event.domLoaded) {
+				Event.add(document, 'init', function() {
+					t.render();
+				});
+				return;
 			}
 
-			sn.push(n);
-		}
+			tinyMCE.settings = s;
 
-		return false;
-	}
+			// Element not found, then skip initialization
+			if (!t.getElement())
+				return;
 
-	};
+			// Is a iPad/iPhone, then skip initialization. We need to sniff here since the
+			// browser says it has contentEditable support but there is no visible caret
+			// We will remove this check ones Apple implements full contentEditable support
+			if (tinymce.isIDevice)
+				return;
 
-/* file:jscripts/tiny_mce/classes/TinyMCE_DOMUtils.class.js */
+			// Add hidden input for non input elements inside form elements
+			if (!/TEXTAREA|INPUT/i.test(t.getElement().nodeName) && s.hidden_input && DOM.getParent(id, 'form'))
+				DOM.insertAfter(DOM.create('input', {type : 'hidden', name : id}), id);
 
-tinyMCE.add(TinyMCE_Engine, {
-	createTagHTML : function(tn, a, h) {
-		var o = '', f = tinyMCE.xmlEncode, n;
+			if (tinymce.WindowManager)
+				t.windowManager = new tinymce.WindowManager(t);
 
-		o = '<' + tn;
+			if (s.encoding == 'xml') {
+				t.onGetContent.add(function(ed, o) {
+					if (o.save)
+						o.content = DOM.encode(o.content);
+				});
+			}
 
-		if (a) {
-			for (n in a) {
-				if (typeof(a[n]) != 'function' && a[n] != null)
-					o += ' ' + f(n) + '="' + f('' + a[n]) + '"';
+			if (s.add_form_submit_trigger) {
+				t.onSubmit.addToTop(function() {
+					if (t.initialized) {
+						t.save();
+						t.isNotDirty = 1;
+					}
+				});
 			}
-		}
 
-		o += !h ? ' />' : '>' + h + '</' + tn + '>';
+			if (s.add_unload_trigger) {
+				t._beforeUnload = tinyMCE.onBeforeUnload.add(function() {
+					if (t.initialized && !t.destroyed && !t.isHidden())
+						t.save({format : 'raw', no_events : true});
+				});
+			}
 
-		return o;
-	},
+			tinymce.addUnload(t.destroy, t);
 
-	createTag : function(d, tn, a, h) {
-		var o = d.createElement(tn), n;
+			if (s.submit_patch) {
+				t.onBeforeRenderUI.add(function() {
+					var n = t.getElement().form;
 
-		if (a) {
-			for (n in a) {
-				if (typeof(a[n]) != 'function' && a[n] != null)
-					tinyMCE.setAttrib(o, n, a[n]);
+					if (!n)
+						return;
+
+					// Already patched
+					if (n._mceOldSubmit)
+						return;
+
+					// Check page uses id="submit" or name="submit" for it's submit button
+					if (!n.submit.nodeType && !n.submit.length) {
+						t.formElement = n;
+						n._mceOldSubmit = n.submit;
+						n.submit = function() {
+							// Save all instances
+							tinymce.triggerSave();
+							t.isNotDirty = 1;
+
+							return t.formElement._mceOldSubmit(t.formElement);
+						};
+					}
+
+					n = null;
+				});
 			}
-		}
 
-		if (h)
-			o.innerHTML = h;
+			// Load scripts
+			function loadScripts() {
+				if (s.language)
+					sl.add(tinymce.baseURL + '/langs/' + s.language + '.js');
 
-		return o;
-	},
+				if (s.theme && s.theme.charAt(0) != '-' && !ThemeManager.urls[s.theme])
+					ThemeManager.load(s.theme, 'themes/' + s.theme + '/editor_template' + tinymce.suffix + '.js');
 
-	getElementByAttributeValue : function(n, e, a, v) {
-		return (n = this.getElementsByAttributeValue(n, e, a, v)).length == 0 ? null : n[0];
-	},
+				each(explode(s.plugins), function(p) {
+					if (p && p.charAt(0) != '-' && !PluginManager.urls[p]) {
+						// Skip safari plugin, since it is removed as of 3.3b1
+						if (p == 'safari')
+							return;
 
-	getElementsByAttributeValue : function(n, e, a, v) {
-		var i, nl = n.getElementsByTagName(e), o = [];
+						PluginManager.load(p, 'plugins/' + p + '/editor_plugin' + tinymce.suffix + '.js');
+					}
+				});
 
-		for (i=0; i<nl.length; i++) {
-			if (tinyMCE.getAttrib(nl[i], a).indexOf(v) != -1)
-				o[o.length] = nl[i];
-		}
+				// Init when que is loaded
+				sl.loadQueue(function() {
+					if (!t.removed)
+						t.init();
+				});
+			};
 
-		return o;
-	},
+			loadScripts();
+		},
 
-	isBlockElement : function(n) {
-		return n != null && n.nodeType == 1 && this.blockRegExp.test(n.nodeName);
-	},
+		init : function() {
+			var n, t = this, s = t.settings, w, h, e = t.getElement(), o, ti, u, bi, bc, re;
 
-	getParentBlockElement : function(n, r) {
-		return this.getParentNode(n, function(n) {
-			return tinyMCE.isBlockElement(n);
-		}, r);
+			tinymce.add(t);
 
-		return null;
-	},
+			if (s.theme) {
+				s.theme = s.theme.replace(/-/, '');
+				o = ThemeManager.get(s.theme);
+				t.theme = new o();
 
-	insertAfter : function(n, r){
-		if (r.nextSibling)
-			r.parentNode.insertBefore(n, r.nextSibling);
-		else
-			r.parentNode.appendChild(n);
-	},
+				if (t.theme.init && s.init_theme)
+					t.theme.init(t, ThemeManager.urls[s.theme] || tinymce.documentBaseURL.replace(/\/$/, ''));
+			}
 
-	setInnerHTML : function(e, h) {
-		var i, nl, n;
+			// Create all plugins
+			each(explode(s.plugins.replace(/\-/g, '')), function(p) {
+				var c = PluginManager.get(p), u = PluginManager.urls[p] || tinymce.documentBaseURL.replace(/\/$/, ''), po;
 
-		// Convert all strong/em to b/i in Gecko
-		if (tinyMCE.isGecko) {
-			h = h.replace(/<embed([^>]*)>/gi, '<tmpembed$1>');
-			h = h.replace(/<em([^>]*)>/gi, '<i$1>');
-			h = h.replace(/<tmpembed([^>]*)>/gi, '<embed$1>');
-			h = h.replace(/<strong([^>]*)>/gi, '<b$1>');
-			h = h.replace(/<\/strong>/gi, '</b>');
-			h = h.replace(/<\/em>/gi, '</i>');
-		}
+				if (c) {
+					po = new c(t, u);
 
-		if (tinyMCE.isRealIE) {
-			// Since MSIE handles invalid HTML better that valid XHTML we
-			// need to make some things invalid. <hr /> gets converted to <hr>.
-			h = h.replace(/\s\/>/g, '>');
+					t.plugins[p] = po;
 
-			// Since MSIE auto generated emtpy P tags some times we must tell it to keep the real ones
-			h = h.replace(/<p([^>]*)>\u00A0?<\/p>/gi, '<p$1 mce_keep="true">&nbsp;</p>'); // Keep empty paragraphs
-			h = h.replace(/<p([^>]*)>\s*&nbsp;\s*<\/p>/gi, '<p$1 mce_keep="true">&nbsp;</p>'); // Keep empty paragraphs
-			h = h.replace(/<p([^>]*)>\s+<\/p>/gi, '<p$1 mce_keep="true">&nbsp;</p>'); // Keep empty paragraphs
+					if (po.init)
+						po.init(t, u);
+				}
+			});
 
-			// Remove first comment
-			e.innerHTML = tinyMCE.uniqueTag + h;
-			e.firstChild.removeNode(true);
+			// Setup popup CSS path(s)
+			if (s.popup_css !== false) {
+				if (s.popup_css)
+					s.popup_css = t.documentBaseURI.toAbsolute(s.popup_css);
+				else
+					s.popup_css = t.baseURI.toAbsolute("themes/" + s.theme + "/skins/" + s.skin + "/dialog.css");
+			}
 
-			// Remove weird auto generated empty paragraphs unless it's supposed to be there
-			nl = e.getElementsByTagName("p");
-			for (i=nl.length-1; i>=0; i--) {
-				n = nl[i];
+			if (s.popup_css_add)
+				s.popup_css += ',' + t.documentBaseURI.toAbsolute(s.popup_css_add);
 
-				if (n.nodeName == 'P' && !n.hasChildNodes() && !n.mce_keep)
-					n.parentNode.removeChild(n);
+			t.controlManager = new tinymce.ControlManager(t);
+
+			if (s.custom_undo_redo) {
+				// Add initial undo level
+				t.onBeforeExecCommand.add(function(ed, cmd, ui, val, a) {
+					if (cmd != 'Undo' && cmd != 'Redo' && cmd != 'mceRepaint' && (!a || !a.skip_undo)) {
+						if (!t.undoManager.hasUndo())
+							t.undoManager.add();
+					}
+				});
+
+				t.onExecCommand.add(function(ed, cmd, ui, val, a) {
+					if (cmd != 'Undo' && cmd != 'Redo' && cmd != 'mceRepaint' && (!a || !a.skip_undo))
+						t.undoManager.add();
+				});
 			}
-		} else {
-			h = this.fixGeckoBaseHREFBug(1, e, h);
-			e.innerHTML = h;
-			this.fixGeckoBaseHREFBug(2, e, h);
-		}
-	},
 
-	getOuterHTML : function(e) {
-		var d;
+			t.onExecCommand.add(function(ed, c) {
+				// Don't refresh the select lists until caret move
+				if (!/^(FontName|FontSize)$/.test(c))
+					t.nodeChanged();
+			});
 
-		if (tinyMCE.isIE)
-			return e.outerHTML;
+			// Remove ghost selections on images and tables in Gecko
+			if (isGecko) {
+				function repaint(a, o) {
+					if (!o || !o.initial)
+						t.execCommand('mceRepaint');
+				};
 
-		d = e.ownerDocument.createElement("body");
-		d.appendChild(e.cloneNode(true));
+				t.onUndo.add(repaint);
+				t.onRedo.add(repaint);
+				t.onSetContent.add(repaint);
+			}
 
-		return d.innerHTML;
-	},
+			// Enables users to override the control factory
+			t.onBeforeRenderUI.dispatch(t, t.controlManager);
 
-	setOuterHTML : function(e, h, d) {
-		var d = typeof(d) == "undefined" ? e.ownerDocument : d, i, nl, t;
+			// Measure box
+			if (s.render_ui) {
+				w = s.width || e.style.width || e.offsetWidth;
+				h = s.height || e.style.height || e.offsetHeight;
+				t.orgDisplay = e.style.display;
+				re = /^[0-9\.]+(|px)$/i;
 
-		if (tinyMCE.isIE && e.nodeType == 1)
-			e.outerHTML = h;
-		else {
-			t = d.createElement("body");
-			t.innerHTML = h;
+				if (re.test('' + w))
+					w = Math.max(parseInt(w) + (o.deltaWidth || 0), 100);
 
-			for (i=0, nl=t.childNodes; i<nl.length; i++)
-				e.parentNode.insertBefore(nl[i].cloneNode(true), e);
+				if (re.test('' + h))
+					h = Math.max(parseInt(h) + (o.deltaHeight || 0), 100);
 
-			e.parentNode.removeChild(e);
-		}
-	},
+				// Render UI
+				o = t.theme.renderUI({
+					targetNode : e,
+					width : w,
+					height : h,
+					deltaWidth : s.delta_width,
+					deltaHeight : s.delta_height
+				});
 
-	_getElementById : function(id, d) {
-		var e, i, j, f;
+				t.editorContainer = o.editorContainer;
+			}
 
-		if (typeof(d) == "undefined")
-			d = document;
 
-		e = d.getElementById(id);
-		if (!e) {
-			f = d.forms;
+			// User specified a document.domain value
+			if (document.domain && location.hostname != document.domain)
+				tinymce.relaxedDomain = document.domain;
 
-			for (i=0; i<f.length; i++) {
-				for (j=0; j<f[i].elements.length; j++) {
-					if (f[i].elements[j].name == id) {
-						e = f[i].elements[j];
-						break;
-					}
+			// Resize editor
+			DOM.setStyles(o.sizeContainer || o.editorContainer, {
+				width : w,
+				height : h
+			});
+
+			h = (o.iframeHeight || h) + (typeof(h) == 'number' ? (o.deltaHeight || 0) : '');
+			if (h < 100)
+				h = 100;
+
+			t.iframeHTML = s.doctype + '<html><head xmlns="http://www.w3.org/1999/xhtml">';
+
+			// We only need to override paths if we have to
+			// IE has a bug where it remove site absolute urls to relative ones if this is specified
+			if (s.document_base_url != tinymce.documentBaseURL)
+				t.iframeHTML += '<base href="' + t.documentBaseURI.getURI() + '" />';
+
+			t.iframeHTML += '<meta http-equiv="X-UA-Compatible" content="IE=7" /><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />';
+
+			if (tinymce.relaxedDomain)
+				t.iframeHTML += '<script type="text/javascript">document.domain = "' + tinymce.relaxedDomain + '";</script>';
+
+			bi = s.body_id || 'tinymce';
+			if (bi.indexOf('=') != -1) {
+				bi = t.getParam('body_id', '', 'hash');
+				bi = bi[t.id] || bi;
+			}
+
+			bc = s.body_class || '';
+			if (bc.indexOf('=') != -1) {
+				bc = t.getParam('body_class', '', 'hash');
+				bc = bc[t.id] || '';
+			}
+
+			t.iframeHTML += '</head><body id="' + bi + '" class="mceContentBody ' + bc + '"></body></html>';
+
+			// Domain relaxing enabled, then set document domain
+			if (tinymce.relaxedDomain) {
+				// We need to write the contents here in IE since multiple writes messes up refresh button and back button
+				if (isIE || (tinymce.isOpera && parseFloat(opera.version()) >= 9.5))
+					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();})()';
+				else if (tinymce.isOpera)
+					u = 'javascript:(function(){document.open();document.domain="' + document.domain + '";document.close();ed.setupIframe();})()';					
+			}
+
+			// Create iframe
+			n = DOM.add(o.iframeContainer, 'iframe', {
+				id : t.id + "_ifr",
+				src : u || 'javascript:""', // Workaround for HTTPS warning in IE6/7
+				frameBorder : '0',
+				style : {
+					width : '100%',
+					height : h
 				}
+			});
+
+			t.contentAreaContainer = o.iframeContainer;
+			DOM.get(o.editorContainer).style.display = t.orgDisplay;
+			DOM.get(t.id).style.display = 'none';
+
+			if (!isIE || !tinymce.relaxedDomain)
+				t.setupIframe();
+
+			e = n = o = null; // Cleanup
+		},
+
+		setupIframe : function() {
+			var t = this, s = t.settings, e = DOM.get(t.id), d = t.getDoc(), h, b;
+
+			// Setup iframe body
+			if (!isIE || !tinymce.relaxedDomain) {
+				d.open();
+				d.write(t.iframeHTML);
+				d.close();
 			}
-		}
 
-		return e;
-	},
+			// Design mode needs to be added here Ctrl+A will fail otherwise
+			if (!isIE) {
+				try {
+					if (!s.readonly)
+						d.designMode = 'On';
+				} catch (ex) {
+					// Will fail on Gecko if the editor is placed in an hidden container element
+					// The design mode will be set ones the editor is focused
+				}
+			}
 
-	getNodeTree : function(n, na, t, nn) {
-		return this.selectNodes(n, function(n) {
-			return (!t || n.nodeType == t) && (!nn || n.nodeName == nn);
-		}, na ? na : []);
-	},
+			// IE needs to use contentEditable or it will display non secure items for HTTPS
+			if (isIE) {
+				// It will not steal focus if we hide it while setting contentEditable
+				b = t.getBody();
+				DOM.hide(b);
 
-	getParentElement : function(n, na, f, r) {
-		var re = na ? new RegExp('^(' + na.toUpperCase().replace(/,/g, '|') + ')$') : 0, v;
+				if (!s.readonly)
+					b.contentEditable = true;
 
-		// Compatiblity with old scripts where f param was a attribute string
-		if (f && typeof(f) == 'string')
-			return this.getParentElement(n, na, function(no) {return tinyMCE.getAttrib(no, f) !== '';});
+				DOM.show(b);
+			}
 
-		return this.getParentNode(n, function(n) {
-			return ((n.nodeType == 1 && !re) || (re && re.test(n.nodeName))) && (!f || f(n));
-		}, r);
-	},
+			t.dom = new tinymce.dom.DOMUtils(t.getDoc(), {
+				keep_values : true,
+				url_converter : t.convertURL,
+				url_converter_scope : t,
+				hex_colors : s.force_hex_style_colors,
+				class_filter : s.class_filter,
+				update_styles : 1,
+				fix_ie_paragraphs : 1,
+				valid_styles : s.valid_styles
+			});
 
-	getParentNode : function(n, f, r) {
-		while (n) {
-			if (n == r)
-				return null;
+			t.schema = new tinymce.dom.Schema();
 
-			if (f(n))
-				return n;
+			t.serializer = new tinymce.dom.Serializer(extend(s, {
+				valid_elements : s.verify_html === false ? '*[*]' : s.valid_elements,
+				dom : t.dom,
+				schema : t.schema
+			}));
 
-			n = n.parentNode;
-		}
+			t.selection = new tinymce.dom.Selection(t.dom, t.getWin(), t.serializer);
 
-		return null;
-	},
+			t.formatter = new tinymce.Formatter(this);
 
-	getAttrib : function(elm, name, dv) {
-		var v;
+			// Register default formats
+			t.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'}}
+				],
 
-		if (typeof(dv) == "undefined")
-			dv = "";
+				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'}}
+				],
 
-		// Not a element
-		if (!elm || elm.nodeType != 1)
-			return dv;
+				alignright : [
+					{selector : 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li', styles : {textAlign : 'right'}},
+					{selector : 'img,table', styles : {'float' : 'right'}}
+				],
 
-		try {
-			v = elm.getAttribute(name, 0);
-		} catch (ex) {
-			// IE 7 may cast exception on invalid attributes
-			v = elm.getAttribute(name, 2);
-		}
+				alignfull : [
+					{selector : 'p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li', styles : {textAlign : 'justify'}}
+				],
 
-		// Try className for class attrib
-		if (name == "class" && !v)
-			v = elm.className;
+				bold : [
+					{inline : 'strong'},
+					{inline : 'span', styles : {fontWeight : 'bold'}},
+					{inline : 'b'}
+				],
 
-		// Workaround for a issue with Firefox 1.5rc2+
-		if (tinyMCE.isGecko) {
-			if (name == "src" && elm.src != null && elm.src !== '')
-				v = elm.src;
+				italic : [
+					{inline : 'em'},
+					{inline : 'span', styles : {fontStyle : 'italic'}},
+					{inline : 'i'}
+				],
 
-			// Workaround for a issue with Firefox 1.5rc2+
-			if (name == "href" && elm.href != null && elm.href !== '')
-				v = elm.href;
-		} else if (tinyMCE.isIE) {
-			switch (name) {
-				case "http-equiv":
-					v = elm.httpEquiv;
-					break;
+				underline : [
+					{inline : 'span', styles : {textDecoration : 'underline'}, exact : true},
+					{inline : 'u'}
+				],
 
-				case "width":
-				case "height":
-					v = elm.getAttribute(name, 2);
-					break;
-			}
-		}
+				strikethrough : [
+					{inline : 'span', styles : {textDecoration : 'line-through'}, exact : true},
+					{inline : 'u'}
+				],
 
-		if (name == "style" && !tinyMCE.isOpera)
-			v = elm.style.cssText;
+				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'},
 
-		return (v && v !== '') ? v : dv;
-	},
+				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}
+				]
+			});
 
-	setAttrib : function(el, name, va, fix) {
-		if (typeof(va) == "number" && va != null)
-			va = "" + va;
+			// Register default block formats
+			each('p h1 h2 h3 h4 h5 h6 div address pre div code dt dd samp'.split(/\s/), function(name) {
+				t.formatter.register(name, {block : name, remove : 'all'});
+			});
 
-		if (fix) {
-			if (va == null)
-				va = "";
+			// Register user defined formats
+			t.formatter.register(t.settings.formats);
 
-			va = va.replace(/[^0-9%]/g, '');
-		}
+			t.undoManager = new tinymce.UndoManager(t);
 
-		if (name == "style")
-			el.style.cssText = va;
+			// Pass through
+			t.undoManager.onAdd.add(function(um, l) {
+				if (!l.initial)
+					return t.onChange.dispatch(t, l, um);
+			});
 
-		if (name == "class")
-			el.className = va;
+			t.undoManager.onUndo.add(function(um, l) {
+				return t.onUndo.dispatch(t, l, um);
+			});
 
-		if (va != null && va !== '' && va != -1)
-			el.setAttribute(name, va);
-		else
-			el.removeAttribute(name);
-	},
+			t.undoManager.onRedo.add(function(um, l) {
+				return t.onRedo.dispatch(t, l, um);
+			});
 
-	setStyleAttrib : function(e, n, v) {
-		e.style[n] = v;
+			t.forceBlocks = new tinymce.ForceBlocks(t, {
+				forced_root_block : s.forced_root_block
+			});
 
-		// Style attrib deleted in IE
-		if (tinyMCE.isIE && v == null || v == '') {
-			v = tinyMCE.serializeStyle(tinyMCE.parseStyle(e.style.cssText));
-			e.style.cssText = v;
-			e.setAttribute("style", v);
-		}
-	},
+			t.editorCommands = new tinymce.EditorCommands(t);
 
-	switchClass : function(ei, c) {
-		var e;
+			// Pass through
+			t.serializer.onPreProcess.add(function(se, o) {
+				return t.onPreProcess.dispatch(t, o, se);
+			});
 
-		if (tinyMCE.switchClassCache[ei])
-			e = tinyMCE.switchClassCache[ei];
-		else
-			e = tinyMCE.switchClassCache[ei] = document.getElementById(ei);
+			t.serializer.onPostProcess.add(function(se, o) {
+				return t.onPostProcess.dispatch(t, o, se);
+			});
 
-		if (e) {
-			// Keep tile mode
-			if (tinyMCE.settings.button_tile_map && e.className && e.className.indexOf('mceTiledButton') == 0)
-				c = 'mceTiledButton ' + c;
+			t.onPreInit.dispatch(t);
 
-			e.className = c;
-		}
-	},
+			if (!s.gecko_spellcheck)
+				t.getBody().spellcheck = 0;
 
-	getAbsPosition : function(n, cn) {
-		var l = 0, t = 0;
+			if (!s.readonly)
+				t._addEvents();
 
-		while (n && n != cn) {
-			l += n.offsetLeft;
-			t += n.offsetTop;
-			n = n.offsetParent;
-		}
+			t.controlManager.onPostRender.dispatch(t, t.controlManager);
+			t.onPostRender.dispatch(t);
 
-		return {absLeft : l, absTop : t};
-	},
+			if (s.directionality)
+				t.getBody().dir = s.directionality;
 
-	prevNode : function(e, n) {
-		var a = n.split(','), i;
+			if (s.nowrap)
+				t.getBody().style.whiteSpace = "nowrap";
 
-		while ((e = e.previousSibling) != null) {
-			for (i=0; i<a.length; i++) {
-				if (e.nodeName == a[i])
-					return e;
+			if (s.custom_elements) {
+				function handleCustom(ed, o) {
+					each(explode(s.custom_elements), function(v) {
+						var n;
+
+						if (v.indexOf('~') === 0) {
+							v = v.substring(1);
+							n = 'span';
+						} else
+							n = 'div';
+
+						o.content = o.content.replace(new RegExp('<(' + v + ')([^>]*)>', 'g'), '<' + n + ' _mce_name="$1"$2>');
+						o.content = o.content.replace(new RegExp('</(' + v + ')>', 'g'), '</' + n + '>');
+					});
+				};
+
+				t.onBeforeSetContent.add(handleCustom);
+				t.onPostProcess.add(function(ed, o) {
+					if (o.set)
+						handleCustom(ed, o);
+				});
 			}
-		}
 
-		return null;
-	},
+			if (s.handle_node_change_callback) {
+				t.onNodeChange.add(function(ed, cm, n) {
+					t.execCallback('handle_node_change_callback', t.id, n, -1, -1, true, t.selection.isCollapsed());
+				});
+			}
 
-	nextNode : function(e, n) {
-		var a = n.split(','), i;
+			if (s.save_callback) {
+				t.onSaveContent.add(function(ed, o) {
+					var h = t.execCallback('save_callback', t.id, o.content, t.getBody());
 
-		while ((e = e.nextSibling) != null) {
-			for (i=0; i<a.length; i++) {
-				if (e.nodeName == a[i])
-					return e;
+					if (h)
+						o.content = h;
+				});
 			}
-		}
 
-		return null;
-	},
+			if (s.onchange_callback) {
+				t.onChange.add(function(ed, l) {
+					t.execCallback('onchange_callback', t, l);
+				});
+			}
 
-	selectElements : function(n, na, f) {
-		var i, a = [], nl, x;
+			if (s.convert_newlines_to_brs) {
+				t.onBeforeSetContent.add(function(ed, o) {
+					if (o.initial)
+						o.content = o.content.replace(/\r?\n/g, '<br />');
+				});
+			}
 
-		for (x=0, na = na.split(','); x<na.length; x++)
-			for (i=0, nl = n.getElementsByTagName(na[x]); i<nl.length; i++)
-				(!f || f(nl[i])) && a.push(nl[i]);
+			if (s.fix_nesting && isIE) {
+				t.onBeforeSetContent.add(function(ed, o) {
+					o.content = t._fixNesting(o.content);
+				});
+			}
 
-		return a;
-	},
+			if (s.preformatted) {
+				t.onPostProcess.add(function(ed, o) {
+					o.content = o.content.replace(/^\s*<pre.*?>/, '');
+					o.content = o.content.replace(/<\/pre>\s*$/, '');
 
-	selectNodes : function(n, f, a) {
-		var i;
+					if (o.set)
+						o.content = '<pre class="mceItemHidden">' + o.content + '</pre>';
+				});
+			}
 
-		if (!a)
-			a = [];
+			if (s.verify_css_classes) {
+				t.serializer.attribValueFilter = function(n, v) {
+					var s, cl;
 
-		if (f(n))
-			a[a.length] = n;
+					if (n == 'class') {
+						// Build regexp for classes
+						if (!t.classesRE) {
+							cl = t.dom.getClasses();
 
-		if (n.hasChildNodes()) {
-			for (i=0; i<n.childNodes.length; i++)
-				tinyMCE.selectNodes(n.childNodes[i], f, a);
-		}
+							if (cl.length > 0) {
+								s = '';
 
-		return a;
-	},
+								each (cl, function(o) {
+									s += (s ? '|' : '') + o['class'];
+								});
 
-	addCSSClass : function(e, c, b) {
-		var o = this.removeCSSClass(e, c);
-		return e.className = b ? c + (o !== '' ? (' ' + o) : '') : (o !== '' ? (o + ' ') : '') + c;
-	},
+								t.classesRE = new RegExp('(' + s + ')', 'gi');
+							}
+						}
 
-	removeCSSClass : function(e, c) {
-		c = e.className.replace(new RegExp("(^|\\s+)" + c + "(\\s+|$)"), ' ');
-		return e.className = c != ' ' ? c : '';
-	},
+						return !t.classesRE || /(\bmceItem\w+\b|\bmceTemp\w+\b)/g.test(v) || t.classesRE.test(v) ? v : '';
+					}
 
-	hasCSSClass : function(n, c) {
-		return new RegExp('\\b' + c + '\\b', 'g').test(n.className);
-	},
+					return v;
+				};
+			}
 
-	renameElement : function(e, n, d) {
-		var ne, i, ar;
+			if (s.cleanup_callback) {
+				t.onBeforeSetContent.add(function(ed, o) {
+					o.content = t.execCallback('cleanup_callback', 'insert_to_editor', o.content, o);
+				});
 
-		d = typeof(d) == "undefined" ? tinyMCE.selectedInstance.getDoc() : d;
+				t.onPreProcess.add(function(ed, o) {
+					if (o.set)
+						t.execCallback('cleanup_callback', 'insert_to_editor_dom', o.node, o);
 
-		if (e) {
-			ne = d.createElement(n);
+					if (o.get)
+						t.execCallback('cleanup_callback', 'get_from_editor_dom', o.node, o);
+				});
 
-			ar = e.attributes;
-			for (i=ar.length-1; i>-1; i--) {
-				if (ar[i].specified && ar[i].nodeValue)
-					ne.setAttribute(ar[i].nodeName.toLowerCase(), ar[i].nodeValue);
+				t.onPostProcess.add(function(ed, o) {
+					if (o.set)
+						o.content = t.execCallback('cleanup_callback', 'insert_to_editor', o.content, o);
+
+					if (o.get)						
+						o.content = t.execCallback('cleanup_callback', 'get_from_editor', o.content, o);
+				});
 			}
 
-			ar = e.childNodes;
-			for (i=0; i<ar.length; i++)
-				ne.appendChild(ar[i].cloneNode(true));
+			if (s.save_callback) {
+				t.onGetContent.add(function(ed, o) {
+					if (o.save)
+						o.content = t.execCallback('save_callback', t.id, o.content, t.getBody());
+				});
+			}
 
-			e.parentNode.replaceChild(ne, e);
-		}
-	},
+			if (s.handle_event_callback) {
+				t.onEvent.add(function(ed, e, o) {
+					if (t.execCallback('handle_event_callback', e, ed, o) === false)
+						Event.cancel(e);
+				});
+			}
 
-	getViewPort : function(w) {
-		var d = w.document, m = d.compatMode == 'CSS1Compat', b = d.body, de = d.documentElement;
+			// Add visual aids when new contents is added
+			t.onSetContent.add(function() {
+				t.addVisual(t.getBody());
+			});
 
-		return {
-			left : w.pageXOffset || (m ? de.scrollLeft : b.scrollLeft),
-			top : w.pageYOffset || (m ? de.scrollTop : b.scrollTop),
-			width : w.innerWidth || (m ? de.clientWidth : b.clientWidth),
-			height : w.innerHeight || (m ? de.clientHeight : b.clientHeight)
-		};
-	},
+			// Remove empty contents
+			if (s.padd_empty_editor) {
+				t.onPostProcess.add(function(ed, o) {
+					o.content = o.content.replace(/^(<p[^>]*>(&nbsp;|&#160;|\s|\u00a0|)<\/p>[\r\n]*|<br \/>[\r\n]*)$/, '');
+				});
+			}
 
-	getStyle : function(n, na, d) {
-		if (!n)
-			return false;
+			if (isGecko) {
+				// Fix gecko link bug, when a link is placed at the end of block elements there is
+				// no way to move the caret behind the link. This fix adds a bogus br element after the link
+				function fixLinks(ed, o) {
+					each(ed.dom.select('a'), function(n) {
+						var pn = n.parentNode;
 
-		// Gecko
-		if (tinyMCE.isGecko && n.ownerDocument.defaultView) {
-			try {
-				return n.ownerDocument.defaultView.getComputedStyle(n, null).getPropertyValue(na);
-			} catch (n) {
-				// Old safari might fail
-				return null;
+						if (ed.dom.isBlock(pn) && pn.lastChild === n)
+							ed.dom.add(pn, 'br', {'_mce_bogus' : 1});
+					});
+				};
+
+				t.onExecCommand.add(function(ed, cmd) {
+					if (cmd === 'CreateLink')
+						fixLinks(ed);
+				});
+
+				t.onSetContent.add(t.selection.onSetContent.add(fixLinks));
+
+				if (!s.readonly) {
+					try {
+						// Design mode must be set here once again to fix a bug where
+						// Ctrl+A/Delete/Backspace didn't work if the editor was added using mceAddControl then removed then added again
+						d.designMode = 'Off';
+						d.designMode = 'On';
+					} catch (ex) {
+						// Will fail on Gecko if the editor is placed in an hidden container element
+						// The design mode will be set ones the editor is focused
+					}
+				}
 			}
-		}
 
-		// Camelcase it, if needed
-		na = na.replace(/-(\D)/g, function(a, b){
-			return b.toUpperCase();
-		});
+			// A small timeout was needed since firefox will remove. Bug: #1838304
+			setTimeout(function () {
+				if (t.removed)
+					return;
 
-		// IE & Opera
-		if (n.currentStyle)
-			return n.currentStyle[na];
+				t.load({initial : true, format : (s.cleanup_on_startup ? 'html' : 'raw')});
+				t.startContent = t.getContent({format : 'raw'});
+				t.initialized = true;
 
-		return false;
-	}
+				t.onInit.dispatch(t);
+				t.execCallback('setupcontent_callback', t.id, t.getBody(), t.getDoc());
+				t.execCallback('init_instance_callback', t);
+				t.focus(true);
+				t.nodeChanged({initial : 1});
 
-	});
+				// Load specified content CSS last
+				if (s.content_css) {
+					tinymce.each(explode(s.content_css), function(u) {
+						t.dom.loadCSS(t.documentBaseURI.toAbsolute(u));
+					});
+				}
 
-/* file:jscripts/tiny_mce/classes/TinyMCE_URL.class.js */
+				// Handle auto focus
+				if (s.auto_focus) {
+					setTimeout(function () {
+						var ed = tinymce.get(s.auto_focus);
 
-tinyMCE.add(TinyMCE_Engine, {
-	parseURL : function(url_str) {
-		var urlParts = [], i, pos, lastPos, chr;
+						ed.selection.select(ed.getBody(), 1);
+						ed.selection.collapse(1);
+						ed.getWin().focus();
+					}, 100);
+				}
+			}, 1);
+	
+			e = null;
+		},
 
-		if (url_str) {
-			// Parse protocol part
-			pos = url_str.indexOf('://');
-			if (pos != -1) {
-				urlParts.protocol = url_str.substring(0, pos);
-				lastPos = pos + 3;
+
+		focus : function(sf) {
+			var oed, t = this, ce = t.settings.content_editable, ieRng, controlElm, doc = t.getDoc();
+
+			if (!sf) {
+				// Get selected control element
+				ieRng = t.selection.getRng();
+				if (ieRng.item) {
+					controlElm = ieRng.item(0);
+				}
+
+				// Is not content editable
+				if (!ce)
+					t.getWin().focus();
+
+				// Restore selected control element
+				// This is needed when for example an image is selected within a
+				// layer a call to focus will then remove the control selection
+				if (controlElm && controlElm.ownerDocument == doc) {
+					ieRng = doc.body.createControlRange();
+					ieRng.addElement(controlElm);
+					ieRng.select();
+				}
+
 			}
 
-			// Find port or path start
-			for (i=lastPos; i<url_str.length; i++) {
-				chr = url_str.charAt(i);
+			if (tinymce.activeEditor != t) {
+				if ((oed = tinymce.activeEditor) != null)
+					oed.onDeactivate.dispatch(oed, t);
 
-				if (chr == ':')
-					break;
+				t.onActivate.dispatch(t, oed);
+			}
 
-				if (chr == '/')
-					break;
+			tinymce._setActive(t);
+		},
+
+		execCallback : function(n) {
+			var t = this, f = t.settings[n], s;
+
+			if (!f)
+				return;
+
+			// Look through lookup
+			if (t.callbackLookup && (s = t.callbackLookup[n])) {
+				f = s.func;
+				s = s.scope;
 			}
-			pos = i;
 
-			// Get host
-			urlParts.host = url_str.substring(lastPos, pos);
+			if (is(f, 'string')) {
+				s = f.replace(/\.\w+$/, '');
+				s = s ? tinymce.resolve(s) : 0;
+				f = tinymce.resolve(f);
+				t.callbackLookup = t.callbackLookup || {};
+				t.callbackLookup[n] = {func : f, scope : s};
+			}
 
-			// Get port
-			urlParts.port = "";
-			lastPos = pos;
-			if (url_str.charAt(pos) == ':') {
-				pos = url_str.indexOf('/', lastPos);
-				urlParts.port = url_str.substring(lastPos+1, pos);
+			return f.apply(s || t, Array.prototype.slice.call(arguments, 1));
+		},
+
+		translate : function(s) {
+			var c = this.settings.language || 'en', i18n = tinymce.i18n;
+
+			if (!s)
+				return '';
+
+			return i18n[c + '.' + s] || s.replace(/{\#([^}]+)\}/g, function(a, b) {
+				return i18n[c + '.' + b] || '{#' + b + '}';
+			});
+		},
+
+		getLang : function(n, dv) {
+			return tinymce.i18n[(this.settings.language || 'en') + '.' + n] || (is(dv) ? dv : '{#' + n + '}');
+		},
+
+		getParam : function(n, dv, ty) {
+			var tr = tinymce.trim, v = is(this.settings[n]) ? this.settings[n] : dv, o;
+
+			if (ty === 'hash') {
+				o = {};
+
+				if (is(v, 'string')) {
+					each(v.indexOf('=') > 0 ? v.split(/[;,](?![^=;,]*(?:[;,]|$))/) : v.split(','), function(v) {
+						v = v.split('=');
+
+						if (v.length > 1)
+							o[tr(v[0])] = tr(v[1]);
+						else
+							o[tr(v[0])] = tr(v);
+					});
+				} else
+					o = v;
+
+				return o;
 			}
 
-			// Get path
-			lastPos = pos;
-			pos = url_str.indexOf('?', lastPos);
+			return v;
+		},
 
-			if (pos == -1)
-				pos = url_str.indexOf('#', lastPos);
+		nodeChanged : function(o) {
+			var t = this, s = t.selection, n = (isIE ? s.getNode() : s.getStart()) || t.getBody();
 
-			if (pos == -1)
-				pos = url_str.length;
+			// Fix for bug #1896577 it seems that this can not be fired while the editor is loading
+			if (t.initialized) {
+				o = o || {};
+				n = isIE && n.ownerDocument != t.getDoc() ? t.getBody() : n; // Fix for IE initial state
 
-			urlParts.path = url_str.substring(lastPos, pos);
+				// Get parents and add them to object
+				o.parents = [];
+				t.dom.getParent(n, function(node) {
+					if (node.nodeName == 'BODY')
+						return true;
 
-			// Get query
-			lastPos = pos;
-			if (url_str.charAt(pos) == '?') {
-				pos = url_str.indexOf('#');
-				pos = (pos == -1) ? url_str.length : pos;
-				urlParts.query = url_str.substring(lastPos+1, pos);
+					o.parents.push(node);
+				});
+
+				t.onNodeChange.dispatch(
+					t,
+					o ? o.controlManager || t.controlManager : t.controlManager,
+					n,
+					s.isCollapsed(),
+					o
+				);
 			}
+		},
 
-			// Get anchor
-			lastPos = pos;
-			if (url_str.charAt(pos) == '#') {
-				pos = url_str.length;
-				urlParts.anchor = url_str.substring(lastPos+1, pos);
+		addButton : function(n, s) {
+			var t = this;
+
+			t.buttons = t.buttons || {};
+			t.buttons[n] = s;
+		},
+
+		addCommand : function(n, f, s) {
+			this.execCommands[n] = {func : f, scope : s || this};
+		},
+
+		addQueryStateHandler : function(n, f, s) {
+			this.queryStateCommands[n] = {func : f, scope : s || this};
+		},
+
+		addQueryValueHandler : function(n, f, s) {
+			this.queryValueCommands[n] = {func : f, scope : s || this};
+		},
+
+		addShortcut : function(pa, desc, cmd_func, sc) {
+			var t = this, c;
+
+			if (!t.settings.custom_shortcuts)
+				return false;
+
+			t.shortcuts = t.shortcuts || {};
+
+			if (is(cmd_func, 'string')) {
+				c = cmd_func;
+
+				cmd_func = function() {
+					t.execCommand(c, false, null);
+				};
 			}
-		}
 
-		return urlParts;
-	},
+			if (is(cmd_func, 'object')) {
+				c = cmd_func;
 
-	serializeURL : function(up) {
-		var o = "";
+				cmd_func = function() {
+					t.execCommand(c[0], c[1], c[2]);
+				};
+			}
 
-		if (up.protocol)
-			o += up.protocol + "://";
+			each(explode(pa), function(pa) {
+				var o = {
+					func : cmd_func,
+					scope : sc || this,
+					desc : desc,
+					alt : false,
+					ctrl : false,
+					shift : false
+				};
 
-		if (up.host)
-			o += up.host;
+				each(explode(pa, '+'), function(v) {
+					switch (v) {
+						case 'alt':
+						case 'ctrl':
+						case 'shift':
+							o[v] = true;
+							break;
 
-		if (up.port)
-			o += ":" + up.port;
+						default:
+							o.charCode = v.charCodeAt(0);
+							o.keyCode = v.toUpperCase().charCodeAt(0);
+					}
+				});
 
-		if (up.path)
-			o += up.path;
+				t.shortcuts[(o.ctrl ? 'ctrl' : '') + ',' + (o.alt ? 'alt' : '') + ',' + (o.shift ? 'shift' : '') + ',' + o.keyCode] = o;
+			});
 
-		if (up.query)
-			o += "?" + up.query;
+			return true;
+		},
 
-		if (up.anchor)
-			o += "#" + up.anchor;
+		execCommand : function(cmd, ui, val, a) {
+			var t = this, s = 0, o, st;
 
-		return o;
-	},
+			if (!/^(mceAddUndoLevel|mceEndUndoLevel|mceBeginUndoLevel|mceRepaint|SelectAll)$/.test(cmd) && (!a || !a.skip_focus))
+				t.focus();
 
-	convertAbsoluteURLToRelativeURL : function(base_url, url_to_relative) {
-		var baseURL = this.parseURL(base_url), targetURL = this.parseURL(url_to_relative);
-		var i, strTok1, strTok2, breakPoint = 0, outPath = "", forceSlash = false;
-		var fileName, pos;
+			o = {};
+			t.onBeforeExecCommand.dispatch(t, cmd, ui, val, o);
+			if (o.terminate)
+				return false;
 
-		if (targetURL.path == '')
-			targetURL.path = "/";
-		else
-			forceSlash = true;
+			// Command callback
+			if (t.execCallback('execcommand_callback', t.id, t.selection.getNode(), cmd, ui, val)) {
+				t.onExecCommand.dispatch(t, cmd, ui, val, a);
+				return true;
+			}
 
-		// Crop away last path part
-		base_url = baseURL.path.substring(0, baseURL.path.lastIndexOf('/'));
-		strTok1 = base_url.split('/');
-		strTok2 = targetURL.path.split('/');
+			// Registred commands
+			if (o = t.execCommands[cmd]) {
+				st = o.func.call(o.scope, ui, val);
 
-		if (strTok1.length >= strTok2.length) {
-			for (i=0; i<strTok1.length; i++) {
-				if (i >= strTok2.length || strTok1[i] != strTok2[i]) {
-					breakPoint = i + 1;
-					break;
+				// Fall through on true
+				if (st !== true) {
+					t.onExecCommand.dispatch(t, cmd, ui, val, a);
+					return st;
 				}
 			}
-		}
 
-		if (strTok1.length < strTok2.length) {
-			for (i=0; i<strTok2.length; i++) {
-				if (i >= strTok1.length || strTok1[i] != strTok2[i]) {
-					breakPoint = i + 1;
-					break;
+			// Plugin commands
+			each(t.plugins, function(p) {
+				if (p.execCommand && p.execCommand(cmd, ui, val)) {
+					t.onExecCommand.dispatch(t, cmd, ui, val, a);
+					s = 1;
+					return false;
 				}
+			});
+
+			if (s)
+				return true;
+
+			// Theme commands
+			if (t.theme && t.theme.execCommand && t.theme.execCommand(cmd, ui, val)) {
+				t.onExecCommand.dispatch(t, cmd, ui, val, a);
+				return true;
 			}
-		}
 
-		if (breakPoint == 1)
-			return targetURL.path;
+			// Execute global commands
+			if (tinymce.GlobalCommands.execCommand(t, cmd, ui, val)) {
+				t.onExecCommand.dispatch(t, cmd, ui, val, a);
+				return true;
+			}
 
-		for (i=0; i<(strTok1.length-(breakPoint-1)); i++)
-			outPath += "../";
+			// Editor commands
+			if (t.editorCommands.execCommand(cmd, ui, val)) {
+				t.onExecCommand.dispatch(t, cmd, ui, val, a);
+				return true;
+			}
 
-		for (i=breakPoint-1; i<strTok2.length; i++) {
-			if (i != (breakPoint-1))
-				outPath += "/" + strTok2[i];
-			else
-				outPath += strTok2[i];
-		}
+			// Browser commands
+			t.getDoc().execCommand(cmd, ui, val);
+			t.onExecCommand.dispatch(t, cmd, ui, val, a);
+		},
 
-		targetURL.protocol = null;
-		targetURL.host = null;
-		targetURL.port = null;
-		targetURL.path = outPath == '' && forceSlash ? "/" : outPath;
+		queryCommandState : function(cmd) {
+			var t = this, o, s;
 
-		// Remove document prefix from local anchors
-		fileName = baseURL.path;
+			// Is hidden then return undefined
+			if (t._isHidden())
+				return;
 
-		if ((pos = fileName.lastIndexOf('/')) != -1)
-			fileName = fileName.substring(pos + 1);
+			// Registred commands
+			if (o = t.queryStateCommands[cmd]) {
+				s = o.func.call(o.scope);
 
-		// Is local anchor
-		if (fileName == targetURL.path && targetURL.anchor !== '')
-			targetURL.path = "";
+				// Fall though on true
+				if (s !== true)
+					return s;
+			}
 
-		// If empty and not local anchor force filename or slash
-		if (targetURL.path == '' && !targetURL.anchor)
-			targetURL.path = fileName !== '' ? fileName : "/";
+			// Registred commands
+			o = t.editorCommands.queryCommandState(cmd);
+			if (o !== -1)
+				return o;
 
-		return this.serializeURL(targetURL);
-	},
+			// Browser commands
+			try {
+				return this.getDoc().queryCommandState(cmd);
+			} catch (ex) {
+				// Fails sometimes see bug: 1896577
+			}
+		},
 
-	convertRelativeToAbsoluteURL : function(base_url, relative_url) {
-		var baseURL = this.parseURL(base_url), baseURLParts, relURLParts, newRelURLParts, numBack, relURL = this.parseURL(relative_url), i;
-		var len, absPath, start, end, newBaseURLParts;
+		queryCommandValue : function(c) {
+			var t = this, o, s;
 
-		if (relative_url == '' || relative_url.indexOf('://') != -1 || /^(mailto:|javascript:|#|\/)/.test(relative_url))
-			return relative_url;
+			// Is hidden then return undefined
+			if (t._isHidden())
+				return;
 
-		// Split parts
-		baseURLParts = baseURL.path.split('/');
-		relURLParts = relURL.path.split('/');
+			// Registred commands
+			if (o = t.queryValueCommands[c]) {
+				s = o.func.call(o.scope);
 
-		// Remove empty chunks
-		newBaseURLParts = [];
-		for (i=baseURLParts.length-1; i>=0; i--) {
-			if (baseURLParts[i].length == 0)
-				continue;
+				// Fall though on true
+				if (s !== true)
+					return s;
+			}
 
-			newBaseURLParts[newBaseURLParts.length] = baseURLParts[i];
-		}
-		baseURLParts = newBaseURLParts.reverse();
+			// Registred commands
+			o = t.editorCommands.queryCommandValue(c);
+			if (is(o))
+				return o;
 
-		// Merge relURLParts chunks
-		newRelURLParts = [];
-		numBack = 0;
-		for (i=relURLParts.length-1; i>=0; i--) {
-			if (relURLParts[i].length == 0 || relURLParts[i] == ".")
-				continue;
+			// Browser commands
+			try {
+				return this.getDoc().queryCommandValue(c);
+			} catch (ex) {
+				// Fails sometimes see bug: 1896577
+			}
+		},
 
-			if (relURLParts[i] == '..') {
-				numBack++;
-				continue;
+		show : function() {
+			var t = this;
+
+			DOM.show(t.getContainer());
+			DOM.hide(t.id);
+			t.load();
+		},
+
+		hide : function() {
+			var t = this, d = t.getDoc();
+
+			// Fixed bug where IE has a blinking cursor left from the editor
+			if (isIE && d)
+				d.execCommand('SelectAll');
+
+			// We must save before we hide so Safari doesn't crash
+			t.save();
+			DOM.hide(t.getContainer());
+			DOM.setStyle(t.id, 'display', t.orgDisplay);
+		},
+
+		isHidden : function() {
+			return !DOM.isHidden(this.id);
+		},
+
+		setProgressState : function(b, ti, o) {
+			this.onSetProgressState.dispatch(this, b, ti, o);
+
+			return b;
+		},
+
+		load : function(o) {
+			var t = this, e = t.getElement(), h;
+
+			if (e) {
+				o = o || {};
+				o.load = true;
+
+				// Double encode existing entities in the value
+				h = t.setContent(is(e.value) ? e.value : e.innerHTML, o);
+				o.element = e;
+
+				if (!o.no_events)
+					t.onLoadContent.dispatch(t, o);
+
+				o.element = e = null;
+
+				return h;
 			}
+		},
 
-			if (numBack > 0) {
-				numBack--;
-				continue;
+		save : function(o) {
+			var t = this, e = t.getElement(), h, f;
+
+			if (!e || !t.initialized)
+				return;
+
+			o = o || {};
+			o.save = true;
+
+			// Add undo level will trigger onchange event
+			if (!o.no_events) {
+				t.undoManager.typing = 0;
+				t.undoManager.add();
 			}
 
-			newRelURLParts[newRelURLParts.length] = relURLParts[i];
-		}
+			o.element = e;
+			h = o.content = t.getContent(o);
 
-		relURLParts = newRelURLParts.reverse();
+			if (!o.no_events)
+				t.onSaveContent.dispatch(t, o);
 
-		// Remove end from absolute path
-		len = baseURLParts.length-numBack;
-		absPath = (len <= 0 ? "" : "/") + baseURLParts.slice(0, len).join('/') + "/" + relURLParts.join('/');
-		start = "";
-		end = "";
+			h = o.content;
 
-		// Build output URL
-		relURL.protocol = baseURL.protocol;
-		relURL.host = baseURL.host;
-		relURL.port = baseURL.port;
+			if (!/TEXTAREA|INPUT/i.test(e.nodeName)) {
+				e.innerHTML = h;
 
-		// Re-add trailing slash if it's removed
-		if (relURL.path.charAt(relURL.path.length-1) == "/")
-			absPath += "/";
+				// Update hidden form element
+				if (f = DOM.getParent(t.id, 'form')) {
+					each(f.elements, function(e) {
+						if (e.name == t.id) {
+							e.value = h;
+							return false;
+						}
+					});
+				}
+			} else
+				e.value = h;
 
-		relURL.path = absPath;
+			o.element = e = null;
 
-		return this.serializeURL(relURL);
-	},
+			return h;
+		},
 
-	convertURL : function(url, node, on_save) {
-		var dl = document.location, start, portPart, urlParts, baseUrlParts, tmpUrlParts, curl;
-		var prot = dl.protocol, host = dl.hostname, port = dl.port;
+		setContent : function(h, o) {
+			var t = this;
 
-		// Pass through file protocol
-		if (prot == "file:")
-			return url;
+			o = o || {};
+			o.format = o.format || 'html';
+			o.set = true;
+			o.content = h;
 
-		// Something is wrong, remove weirdness
-		url = tinyMCE.regexpReplace(url, '(http|https):///', '/');
+			if (!o.no_events)
+				t.onBeforeSetContent.dispatch(t, o);
 
-		// Mailto link or anchor (Pass through)
-		if (url.indexOf('mailto:') != -1 || url.indexOf('javascript:') != -1 || /^[ \t\r\n\+]*[#\?]/.test(url))
-			return url;
+			// Padd empty content in Gecko and Safari. Commands will otherwise fail on the content
+			// It will also be impossible to place the caret in the editor unless there is a BR element present
+			if (!tinymce.isIE && (h.length === 0 || /^\s+$/.test(h))) {
+				o.content = t.dom.setHTML(t.getBody(), '<br _mce_bogus="1" />');
+				o.format = 'raw';
+			}
 
-		// Fix relative/Mozilla
-		if (!tinyMCE.isIE && !on_save && url.indexOf("://") == -1 && url.charAt(0) != '/')
-			return tinyMCE.settings.base_href + url;
+			o.content = t.dom.setHTML(t.getBody(), tinymce.trim(o.content));
 
-		// Handle relative URLs
-		if (on_save && tinyMCE.getParam('relative_urls')) {
-			curl = tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings.base_href, url);
-			if (curl.charAt(0) == '/')
-				curl = tinyMCE.settings.document_base_prefix + curl;
+			if (o.format != 'raw' && t.settings.cleanup) {
+				o.getInner = true;
+				o.content = t.dom.setHTML(t.getBody(), t.serializer.serialize(t.getBody(), o));
+			}
 
-			urlParts = tinyMCE.parseURL(curl);
-			tmpUrlParts = tinyMCE.parseURL(tinyMCE.settings.document_base_url);
+			if (!o.no_events)
+				t.onSetContent.dispatch(t, o);
 
-			// Force relative
-			if (urlParts.host == tmpUrlParts.host && (urlParts.port == tmpUrlParts.port))
-				return tinyMCE.convertAbsoluteURLToRelativeURL(tinyMCE.settings.document_base_url, curl);
-		}
+			return o.content;
+		},
 
-		// Handle absolute URLs
-		if (!tinyMCE.getParam('relative_urls')) {
-//			urlParts = tinyMCE.parseURL(url);
-//			baseUrlParts = tinyMCE.parseURL(tinyMCE.settings.base_href);
+		getContent : function(o) {
+			var t = this, h;
 
-			// Force absolute URLs from relative URLs
-			url = tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings.base_href, url);
+			o = o || {};
+			o.format = o.format || 'html';
+			o.get = true;
 
-                // jondaley removed: I don't know what the TinyMCE folks thought
-                // this was doing, but it doesn't work for us
-                // All local and remote URLs with a # are broken with this code
-			// If anchor and path is the same page
-//			if (urlParts.anchor && urlParts.path == baseUrlParts.path)
-//				return "#" + urlParts.anchor;
-		}
+			if (!o.no_events)
+				t.onBeforeGetContent.dispatch(t, o);
 
-		// Remove current domain
-		if (tinyMCE.getParam('remove_script_host')) {
-			start = "";
-			portPart = "";
+			if (o.format != 'raw' && t.settings.cleanup) {
+				o.getInner = true;
+				h = t.serializer.serialize(t.getBody(), o);
+			} else
+				h = t.getBody().innerHTML;
 
-			if (port !== '')
-				portPart = ":" + port;
+			h = h.replace(/^\s*|\s*$/g, '');
+			o.content = h;
 
-			start = prot + "//" + host + portPart + "/";
+			if (!o.no_events)
+				t.onGetContent.dispatch(t, o);
 
-			if (url.indexOf(start) == 0)
-				url = url.substring(start.length-1);
-		}
+			return o.content;
+		},
 
-		return url;
-	},
+		isDirty : function() {
+			var t = this;
 
-	convertAllRelativeURLs : function(body) {
-		var i, elms, src, href, mhref, msrc;
+			return tinymce.trim(t.startContent) != tinymce.trim(t.getContent({format : 'raw', no_events : 1})) && !t.isNotDirty;
+		},
 
-		// Convert all image URL:s to absolute URL
-		elms = body.getElementsByTagName("img");
-		for (i=0; i<elms.length; i++) {
-			src = tinyMCE.getAttrib(elms[i], 'src');
+		getContainer : function() {
+			var t = this;
 
-			msrc = tinyMCE.getAttrib(elms[i], 'mce_src');
-			if (msrc !== '')
-				src = msrc;
+			if (!t.container)
+				t.container = DOM.get(t.editorContainer || t.id + '_parent');
 
-			if (src !== '') {
-				src = tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings.base_href, src);
-				elms[i].setAttribute("src", src);
+			return t.container;
+		},
+
+		getContentAreaContainer : function() {
+			return this.contentAreaContainer;
+		},
+
+		getElement : function() {
+			return DOM.get(this.settings.content_element || this.id);
+		},
+
+		getWin : function() {
+			var t = this, e;
+
+			if (!t.contentWindow) {
+				e = DOM.get(t.id + "_ifr");
+
+				if (e)
+					t.contentWindow = e.contentWindow;
 			}
-		}
 
-		// Convert all link URL:s to absolute URL
-		elms = body.getElementsByTagName("a");
-		for (i=0; i<elms.length; i++) {
-			href = tinyMCE.getAttrib(elms[i], 'href');
+			return t.contentWindow;
+		},
 
-			mhref = tinyMCE.getAttrib(elms[i], 'mce_href');
-			if (mhref !== '')
-				href = mhref;
+		getDoc : function() {
+			var t = this, w;
 
-			if (href && href !== '') {
-				href = tinyMCE.convertRelativeToAbsoluteURL(tinyMCE.settings.base_href, href);
-				elms[i].setAttribute("href", href);
+			if (!t.contentDocument) {
+				w = t.getWin();
+
+				if (w)
+					t.contentDocument = w.document;
 			}
-		}
-	}
 
-	});
+			return t.contentDocument;
+		},
 
-/* file:jscripts/tiny_mce/classes/TinyMCE_Array.class.js */
+		getBody : function() {
+			return this.bodyElement || this.getDoc().body;
+		},
 
-tinyMCE.add(TinyMCE_Engine, {
-	clearArray : function(a) {
-		var n;
+		convertURL : function(u, n, e) {
+			var t = this, s = t.settings;
 
-		for (n in a)
-			a[n] = null;
+			// Use callback instead
+			if (s.urlconverter_callback)
+				return t.execCallback('urlconverter_callback', u, e, true, n);
 
-		return a;
-	},
+			// Don't convert link href since thats the CSS files that gets loaded into the editor also skip local file URLs
+			if (!s.convert_urls || (e && e.nodeName == 'LINK') || u.indexOf('file:') === 0)
+				return u;
 
-	explode : function(d, s) {
-		var ar = s.split(d), oar = [], i;
+			// Convert to relative
+			if (s.relative_urls)
+				return t.documentBaseURI.toRelative(u);
 
-		for (i = 0; i<ar.length; i++) {
-			if (ar[i] !== '')
-				oar[oar.length] = ar[i];
-		}
+			// Convert to absolute
+			u = t.documentBaseURI.toAbsolute(u, s.remove_script_host);
 
-		return oar;
-	}
-});
+			return u;
+		},
 
-/* file:jscripts/tiny_mce/classes/TinyMCE_Event.class.js */
+		addVisual : function(e) {
+			var t = this, s = t.settings;
 
-tinyMCE.add(TinyMCE_Engine, {
-	_setEventsEnabled : function(node, state) {
-		var evs, x, y, elms, i, event;
-		var events = ['onfocus','onblur','onclick','ondblclick',
-					'onmousedown','onmouseup','onmouseover','onmousemove',
-					'onmouseout','onkeypress','onkeydown','onkeydown','onkeyup'];
+			e = e || t.getBody();
 
-		evs = tinyMCE.settings.event_elements.split(',');
-		for (y=0; y<evs.length; y++){
-			elms = node.getElementsByTagName(evs[y]);
-			for (i=0; i<elms.length; i++) {
-				event = "";
+			if (!is(t.hasVisual))
+				t.hasVisual = s.visual;
 
-				for (x=0; x<events.length; x++) {
-					if ((event = tinyMCE.getAttrib(elms[i], events[x])) !== '') {
-						event = tinyMCE.cleanupEventStr("" + event);
+			each(t.dom.select('table,a', e), function(e) {
+				var v;
 
-						if (!state)
-							event = "return true;" + event;
-						else
-							event = event.replace(/^return true;/gi, '');
+				switch (e.nodeName) {
+					case 'TABLE':
+						v = t.dom.getAttrib(e, 'border');
 
-						elms[i].removeAttribute(events[x]);
-						elms[i].setAttribute(events[x], event);
-					}
+						if (!v || v == '0') {
+							if (t.hasVisual)
+								t.dom.addClass(e, s.visual_table_class);
+							else
+								t.dom.removeClass(e, s.visual_table_class);
+						}
+
+						return;
+
+					case 'A':
+						v = t.dom.getAttrib(e, 'name');
+
+						if (v) {
+							if (t.hasVisual)
+								t.dom.addClass(e, 'mceItemAnchor');
+							else
+								t.dom.removeClass(e, 'mceItemAnchor');
+						}
+
+						return;
 				}
+			});
+
+			t.onVisualAid.dispatch(t, e, t.hasVisual);
+		},
+
+		remove : function() {
+			var t = this, e = t.getContainer();
+
+			t.removed = 1; // Cancels post remove event execution
+			t.hide();
+
+			t.execCallback('remove_instance_callback', t);
+			t.onRemove.dispatch(t);
+
+			// Clear all execCommand listeners this is required to avoid errors if the editor was removed inside another command
+			t.onExecCommand.listeners = [];
+
+			tinymce.remove(t);
+			DOM.remove(e);
+		},
+
+		destroy : function(s) {
+			var t = this;
+
+			// One time is enough
+			if (t.destroyed)
+				return;
+
+			if (!s) {
+				tinymce.removeUnload(t.destroy);
+				tinyMCE.onBeforeUnload.remove(t._beforeUnload);
+
+				// Manual destroy
+				if (t.theme && t.theme.destroy)
+					t.theme.destroy();
+
+				// Destroy controls, selection and dom
+				t.controlManager.destroy();
+				t.selection.destroy();
+				t.dom.destroy();
+
+				// Remove all events
+
+				// Don't clear the window or document if content editable
+				// is enabled since other instances might still be present
+				if (!t.settings.content_editable) {
+					Event.clear(t.getWin());
+					Event.clear(t.getDoc());
+				}
+
+				Event.clear(t.getBody());
+				Event.clear(t.formElement);
 			}
-		}
-	},
 
-	_eventPatch : function(editor_id) {
-		var n, inst, win, e;
+			if (t.formElement) {
+				t.formElement.submit = t.formElement._mceOldSubmit;
+				t.formElement._mceOldSubmit = null;
+			}
 
-		// Remove odd, error
-		if (typeof(tinyMCE) == "undefined")
-			return true;
+			t.contentAreaContainer = t.formElement = t.container = t.settings.content_element = t.bodyElement = t.contentDocument = t.contentWindow = null;
 
-		try {
-			// Try selected instance first
-			if (tinyMCE.selectedInstance) {
-				win = tinyMCE.selectedInstance.getWin();
+			if (t.selection)
+				t.selection = t.selection.win = t.selection.dom = t.selection.dom.doc = null;
 
-				if (win && win.event) {
-					e = win.event;
+			t.destroyed = 1;
+		},
 
-					if (!e.target)
-						e.target = e.srcElement;
+		// Internal functions
 
-					TinyMCE_Engine.prototype.handleEvent(e);
+		_addEvents : function() {
+			// 'focus', 'blur', 'dblclick', 'beforedeactivate', submit, reset
+			var t = this, i, s = t.settings, lo = {
+				mouseup : 'onMouseUp',
+				mousedown : 'onMouseDown',
+				click : 'onClick',
+				keyup : 'onKeyUp',
+				keydown : 'onKeyDown',
+				keypress : 'onKeyPress',
+				submit : 'onSubmit',
+				reset : 'onReset',
+				contextmenu : 'onContextMenu',
+				dblclick : 'onDblClick',
+				paste : 'onPaste' // Doesn't work in all browsers yet
+			};
+
+			function eventHandler(e, o) {
+				var ty = e.type;
+
+				// Don't fire events when it's removed
+				if (t.removed)
 					return;
+
+				// Generic event handler
+				if (t.onEvent.dispatch(t, e, o) !== false) {
+					// Specific event handler
+					t[lo[e.fakeType || e.type]].dispatch(t, e, o);
 				}
+			};
+
+			// Add DOM events
+			each(lo, function(v, k) {
+				switch (k) {
+					case 'contextmenu':
+						if (tinymce.isOpera) {
+							// Fake contextmenu on Opera
+							t.dom.bind(t.getBody(), 'mousedown', function(e) {
+								if (e.ctrlKey) {
+									e.fakeType = 'contextmenu';
+									eventHandler(e);
+								}
+							});
+						} else
+							t.dom.bind(t.getBody(), k, eventHandler);
+						break;
+
+					case 'paste':
+						t.dom.bind(t.getBody(), k, function(e) {
+							eventHandler(e);
+						});
+						break;
+
+					case 'submit':
+					case 'reset':
+						t.dom.bind(t.getElement().form || DOM.getParent(t.id, 'form'), k, eventHandler);
+						break;
+
+					default:
+						t.dom.bind(s.content_editable ? t.getBody() : t.getDoc(), k, eventHandler);
+				}
+			});
+
+			t.dom.bind(s.content_editable ? t.getBody() : (isGecko ? t.getDoc() : t.getWin()), 'focus', function(e) {
+				t.focus(true);
+			});
+
+
+			// Fixes bug where a specified document_base_uri could result in broken images
+			// This will also fix drag drop of images in Gecko
+			if (tinymce.isGecko) {
+				// Convert all images to absolute URLs
+/*				t.onSetContent.add(function(ed, o) {
+					each(ed.dom.select('img'), function(e) {
+						var v;
+
+						if (v = e.getAttribute('_mce_src'))
+							e.src = t.documentBaseURI.toAbsolute(v);
+					})
+				});*/
+
+				t.dom.bind(t.getDoc(), 'DOMNodeInserted', function(e) {
+					var v;
+
+					e = e.target;
+
+					if (e.nodeType === 1 && e.nodeName === 'IMG' && (v = e.getAttribute('_mce_src')))
+						e.src = t.documentBaseURI.toAbsolute(v);
+				});
 			}
 
-			// Search for it
-			for (n in tinyMCE.instances) {
-				inst = tinyMCE.instances[n];
+			// Set various midas options in Gecko
+			if (isGecko) {
+				function setOpts() {
+					var t = this, d = t.getDoc(), s = t.settings;
 
-				if (!tinyMCE.isInstance(inst))
-					continue;
+					if (isGecko && !s.readonly) {
+						if (t._isHidden()) {
+							try {
+								if (!s.content_editable)
+									d.designMode = 'On';
+							} catch (ex) {
+								// Fails if it's hidden
+							}
+						}
 
-				inst.select();
-				win = inst.getWin();
+						try {
+							// Try new Gecko method
+							d.execCommand("styleWithCSS", 0, false);
+						} catch (ex) {
+							// Use old method
+							if (!t._isHidden())
+								try {d.execCommand("useCSS", 0, true);} catch (ex) {}
+						}
 
-				if (win && win.event) {
-					e = win.event;
+						if (!s.table_inline_editing)
+							try {d.execCommand('enableInlineTableEditing', false, false);} catch (ex) {}
 
-					if (!e.target)
-						e.target = e.srcElement;
+						if (!s.object_resizing)
+							try {d.execCommand('enableObjectResizing', false, false);} catch (ex) {}
+					}
+				};
 
-					TinyMCE_Engine.prototype.handleEvent(e);
-					return;
+				t.onBeforeExecCommand.add(setOpts);
+				t.onMouseDown.add(setOpts);
+			}
+
+			// Workaround for bug, http://bugs.webkit.org/show_bug.cgi?id=12250
+			// WebKit can't even do simple things like selecting an image
+			// This also fixes so it's possible to select mceItemAnchors
+			if (tinymce.isWebKit) {
+				t.onClick.add(function(ed, e) {
+					e = e.target;
+
+					// Needs tobe the setBaseAndExtend or it will fail to select floated images
+					if (e.nodeName == 'IMG' || (e.nodeName == 'A' && t.dom.hasClass(e, 'mceItemAnchor')))
+						t.selection.getSel().setBaseAndExtent(e, 0, e, 1);
+				});
+			}
+
+			// Add node change handlers
+			t.onMouseUp.add(t.nodeChanged);
+			//t.onClick.add(t.nodeChanged);
+			t.onKeyUp.add(function(ed, e) {
+				var c = e.keyCode;
+
+				if ((c >= 33 && c <= 36) || (c >= 37 && c <= 40) || c == 13 || c == 45 || c == 46 || c == 8 || (tinymce.isMac && (c == 91 || c == 93)) || e.ctrlKey)
+					t.nodeChanged();
+			});
+
+			// Add reset handler
+			t.onReset.add(function() {
+				t.setContent(t.startContent, {format : 'raw'});
+			});
+
+			// Add shortcuts
+			if (s.custom_shortcuts) {
+				if (s.custom_undo_redo_keyboard_shortcuts) {
+					t.addShortcut('ctrl+z', t.getLang('undo_desc'), 'Undo');
+					t.addShortcut('ctrl+y', t.getLang('redo_desc'), 'Redo');
 				}
+
+				// Add default shortcuts for gecko
+				t.addShortcut('ctrl+b', t.getLang('bold_desc'), 'Bold');
+				t.addShortcut('ctrl+i', t.getLang('italic_desc'), 'Italic');
+				t.addShortcut('ctrl+u', t.getLang('underline_desc'), 'Underline');
+
+				// BlockFormat shortcuts keys
+				for (i=1; i<=6; i++)
+					t.addShortcut('ctrl+' + i, '', ['FormatBlock', false, 'h' + i]);
+
+				t.addShortcut('ctrl+7', '', ['FormatBlock', false, '<p>']);
+				t.addShortcut('ctrl+8', '', ['FormatBlock', false, '<div>']);
+				t.addShortcut('ctrl+9', '', ['FormatBlock', false, '<address>']);
+
+				function find(e) {
+					var v = null;
+
+					if (!e.altKey && !e.ctrlKey && !e.metaKey)
+						return v;
+
+					each(t.shortcuts, function(o) {
+						if (tinymce.isMac && o.ctrl != e.metaKey)
+							return;
+						else if (!tinymce.isMac && o.ctrl != e.ctrlKey)
+							return;
+
+						if (o.alt != e.altKey)
+							return;
+
+						if (o.shift != e.shiftKey)
+							return;
+
+						if (e.keyCode == o.keyCode || (e.charCode && e.charCode == o.charCode)) {
+							v = o;
+							return false;
+						}
+					});
+
+					return v;
+				};
+
+				t.onKeyUp.add(function(ed, e) {
+					var o = find(e);
+
+					if (o)
+						return Event.cancel(e);
+				});
+
+				t.onKeyPress.add(function(ed, e) {
+					var o = find(e);
+
+					if (o)
+						return Event.cancel(e);
+				});
+
+				t.onKeyDown.add(function(ed, e) {
+					var o = find(e);
+
+					if (o) {
+						o.func.call(o.scope);
+						return Event.cancel(e);
+					}
+				});
 			}
-		} catch (ex) {
-			// Ignore error if iframe is pointing to external URL
-		}
-	},
 
-	findEvent : function(e) {
-		var n, inst;
+			if (tinymce.isIE) {
+				// Fix so resize will only update the width and height attributes not the styles of an image
+				// It will also block mceItemNoResize items
+				t.dom.bind(t.getDoc(), 'controlselect', function(e) {
+					var re = t.resizeInfo, cb;
 
-		if (e)
-			return e;
+					e = e.target;
 
-		for (n in tinyMCE.instances) {
-			inst = tinyMCE.instances[n];
+					// Don't do this action for non image elements
+					if (e.nodeName !== 'IMG')
+						return;
 
-			if (tinyMCE.isInstance(inst) && inst.getWin().event)
-				return inst.getWin().event;
-		}
+					if (re)
+						t.dom.unbind(re.node, re.ev, re.cb);
 
-		return null;
-	},
+					if (!t.dom.hasClass(e, 'mceItemNoResize')) {
+						ev = 'resizeend';
+						cb = t.dom.bind(e, ev, function(e) {
+							var v;
 
-	unloadHandler : function() {
-		tinyMCE.triggerSave(true, true);
-	},
+							e = e.target;
 
-	addEventHandlers : function(inst) {
-		this.setEventHandlers(inst, 1);
-	},
+							if (v = t.dom.getStyle(e, 'width')) {
+								t.dom.setAttrib(e, 'width', v.replace(/[^0-9%]+/g, ''));
+								t.dom.setStyle(e, 'width', '');
+							}
 
-	setEventHandlers : function(inst, s) {
-		var doc = inst.getDoc(), ie, ot, i, f = s ? tinyMCE.addEvent : tinyMCE.removeEvent;
+							if (v = t.dom.getStyle(e, 'height')) {
+								t.dom.setAttrib(e, 'height', v.replace(/[^0-9%]+/g, ''));
+								t.dom.setStyle(e, 'height', '');
+							}
+						});
+					} else {
+						ev = 'resizestart';
+						cb = t.dom.bind(e, 'resizestart', Event.cancel, Event);
+					}
 
-		ie = ['keypress', 'keyup', 'keydown', 'click', 'mouseup', 'mousedown', 'controlselect', 'dblclick'];
-		ot = ['keypress', 'keyup', 'keydown', 'click', 'mouseup', 'mousedown', 'focus', 'blur', 'dragdrop'];
+					re = t.resizeInfo = {
+						node : e,
+						ev : ev,
+						cb : cb
+					};
+				});
 
-		inst.switchSettings();
+				t.onKeyDown.add(function(ed, e) {
+					switch (e.keyCode) {
+						case 8:
+							// Fix IE control + backspace browser bug
+							if (t.selection.getRng().item) {
+								ed.dom.remove(t.selection.getRng().item(0));
+								return Event.cancel(e);
+							}
+					}
+				});
 
-		if (tinyMCE.isIE) {
-			for (i=0; i<ie.length; i++)
-				f(doc, ie[i], TinyMCE_Engine.prototype._eventPatch);
-		} else {
-			for (i=0; i<ot.length; i++)
-				f(doc, ot[i], tinyMCE.handleEvent);
+				/*if (t.dom.boxModel) {
+					t.getBody().style.height = '100%';
 
-			// Force designmode
-			try {
-				doc.designMode = "On";
-			} catch (e) {
-				// Ignore
+					Event.add(t.getWin(), 'resize', function(e) {
+						var docElm = t.getDoc().documentElement;
+
+						docElm.style.height = (docElm.offsetHeight - 10) + 'px';
+					});
+				}*/
 			}
-		}
-	},
 
-	onMouseMove : function() {
-		var inst, lh;
+			if (tinymce.isOpera) {
+				t.onClick.add(function(ed, e) {
+					Event.prevent(e);
+				});
+			}
 
-		// Fix for IE7 bug where it's not restoring hover on anchors correctly
-		if (tinyMCE.lastHover) {
-			lh = tinyMCE.lastHover;
+			// Add custom undo/redo handlers
+			if (s.custom_undo_redo) {
+				function addUndo() {
+					t.undoManager.typing = 0;
+					t.undoManager.add();
+				};
 
-			// Call out on menus and refresh class on normal buttons
-			if (lh.className.indexOf('mceMenu') != -1)
-				tinyMCE._menuButtonEvent('out', lh);
-			else
-				lh.className = lh.className;
+				t.dom.bind(t.getDoc(), 'focusout', function(e) {
+					if (!t.removed && t.undoManager.typing)
+						addUndo();
+				});
 
-			tinyMCE.lastHover = null;
-		}
+				t.onKeyUp.add(function(ed, e) {
+					if ((e.keyCode >= 33 && e.keyCode <= 36) || (e.keyCode >= 37 && e.keyCode <= 40) || e.keyCode == 13 || e.keyCode == 45 || e.ctrlKey)
+						addUndo();
+				});
 
-		if (!tinyMCE.hasMouseMoved) {
-			inst = tinyMCE.selectedInstance;
+				t.onKeyDown.add(function(ed, e) {
+					var rng, parent, bookmark;
 
-			// Workaround for bug #1437457 (Odd MSIE bug)
-			if (inst.isFocused) {
-				inst.undoBookmark = inst.selection.getBookmark();
-				tinyMCE.hasMouseMoved = true;
+					// IE has a really odd bug where the DOM might include an node that doesn't have
+					// a proper structure. If you try to access nodeValue it would throw an illegal value exception.
+					// This seems to only happen when you delete contents and it seems to be avoidable if you refresh the element
+					// after you delete contents from it. See: #3008923
+					if (isIE && e.keyCode == 46) {
+						rng = t.selection.getRng();
+
+						if (rng.parentElement) {
+							parent = rng.parentElement();
+
+							// Select next word when ctrl key is used in combo with delete
+							if (e.ctrlKey) {
+								rng.moveEnd('word', 1);
+								rng.select();
+							}
+
+							// Delete contents
+							t.selection.getSel().clear();
+
+							// Check if we are within the same parent
+							if (rng.parentElement() == parent) {
+								bookmark = t.selection.getBookmark();
+
+								try {
+									// Update the HTML and hopefully it will remove the artifacts
+									parent.innerHTML = parent.innerHTML;
+								} catch (ex) {
+									// And since it's IE it can sometimes produce an unknown runtime error
+								}
+
+								// Restore the caret position
+								t.selection.moveToBookmark(bookmark);
+							}
+
+							// Block the default delete behavior since it might be broken
+							e.preventDefault();
+							return;
+						}
+					}
+
+					// Is caracter positon keys
+					if ((e.keyCode >= 33 && e.keyCode <= 36) || (e.keyCode >= 37 && e.keyCode <= 40) || e.keyCode == 13 || e.keyCode == 45) {
+						if (t.undoManager.typing)
+							addUndo();
+
+						return;
+					}
+
+					if (!t.undoManager.typing) {
+						t.undoManager.add();
+						t.undoManager.typing = 1;
+					}
+				});
+
+				t.onMouseDown.add(function() {
+					if (t.undoManager.typing)
+						addUndo();
+				});
 			}
-		}
+		},
 
-	//	tinyMCE.cancelEvent(inst.getWin().event);
-	//	return false;
-	},
+		_isHidden : function() {
+			var s;
 
-	cancelEvent : function(e) {
-		if (!e)
-			return false;
+			if (!isGecko)
+				return 0;
 
-		if (tinyMCE.isIE) {
-			e.returnValue = false;
-			e.cancelBubble = true;
-		} else {
-			e.preventDefault();
-			e.stopPropagation && e.stopPropagation();
+			// Weird, wheres that cursor selection?
+			s = this.selection.getSel();
+			return (!s || !s.rangeCount || s.rangeCount == 0);
+		},
+
+		// Fix for bug #1867292
+		_fixNesting : function(s) {
+			var d = [], i;
+
+			s = s.replace(/<(\/)?([^\s>]+)[^>]*?>/g, function(a, b, c) {
+				var e;
+
+				// Handle end element
+				if (b === '/') {
+					if (!d.length)
+						return '';
+
+					if (c !== d[d.length - 1].tag) {
+						for (i=d.length - 1; i>=0; i--) {
+							if (d[i].tag === c) {
+								d[i].close = 1;
+								break;
+							}
+						}
+
+						return '';
+					} else {
+						d.pop();
+
+						if (d.length && d[d.length - 1].close) {
+							a = a + '</' + d[d.length - 1].tag + '>';
+							d.pop();
+						}
+					}
+				} else {
+					// Ignore these
+					if (/^(br|hr|input|meta|img|link|param)$/i.test(c))
+						return a;
+
+					// Ignore closed ones
+					if (/\/>$/.test(a))
+						return a;
+
+					d.push({tag : c}); // Push start element
+				}
+
+				return a;
+			});
+
+			// End all open tags
+			for (i=d.length - 1; i>=0; i--)
+				s += '</' + d[i].tag + '>';
+
+			return s;
 		}
+	});
+})(tinymce);
 
-		return false;
-	},
+(function(tinymce) {
+	// Added for compression purposes
+	var each = tinymce.each, undefined, TRUE = true, FALSE = false;
 
-	addEvent : function(o, n, h) {
-		// Add cleanup for all non unload events
-		if (n != 'unload') {
-			function clean() {
-				var ex;
+	tinymce.EditorCommands = function(editor) {
+		var dom = editor.dom,
+			selection = editor.selection,
+			commands = {state: {}, exec : {}, value : {}},
+			settings = editor.settings,
+			bookmark;
 
+		function execCommand(command, ui, value) {
+			var func;
+
+			command = command.toLowerCase();
+			if (func = commands.exec[command]) {
+				func(command, ui, value);
+				return TRUE;
+			}
+
+			return FALSE;
+		};
+
+		function queryCommandState(command) {
+			var func;
+
+			command = command.toLowerCase();
+			if (func = commands.state[command])
+				return func(command);
+
+			return -1;
+		};
+
+		function queryCommandValue(command) {
+			var func;
+
+			command = command.toLowerCase();
+			if (func = commands.value[command])
+				return func(command);
+
+			return FALSE;
+		};
+
+		function addCommands(command_list, type) {
+			type = type || 'exec';
+
+			each(command_list, function(callback, command) {
+				each(command.toLowerCase().split(','), function(command) {
+					commands[type][command] = callback;
+				});
+			});
+		};
+
+		// Expose public methods
+		tinymce.extend(this, {
+			execCommand : execCommand,
+			queryCommandState : queryCommandState,
+			queryCommandValue : queryCommandValue,
+			addCommands : addCommands
+		});
+
+		// Private methods
+
+		function execNativeCommand(command, ui, value) {
+			if (ui === undefined)
+				ui = FALSE;
+
+			if (value === undefined)
+				value = null;
+
+			return editor.getDoc().execCommand(command, ui, value);
+		};
+
+		function isFormatMatch(name) {
+			return editor.formatter.match(name);
+		};
+
+		function toggleFormat(name, value) {
+			editor.formatter.toggle(name, value ? {value : value} : undefined);
+		};
+
+		function storeSelection(type) {
+			bookmark = selection.getBookmark(type);
+		};
+
+		function restoreSelection() {
+			selection.moveToBookmark(bookmark);
+		};
+
+		// Add execCommand overrides
+		addCommands({
+			// Ignore these, added for compatibility
+			'mceResetDesignMode,mceBeginUndoLevel' : function() {},
+
+			// Add undo manager logic
+			'mceEndUndoLevel,mceAddUndoLevel' : function() {
+				editor.undoManager.add();
+			},
+
+			'Cut,Copy,Paste' : function(command) {
+				var doc = editor.getDoc(), failed;
+
+				// Try executing the native command
 				try {
-					tinyMCE.removeEvent(o, n, h);
-					tinyMCE.removeEvent(window, 'unload', clean);
-					o = n = h = null;
+					execNativeCommand(command);
 				} catch (ex) {
-					// IE may produce access denied exception on unload
+					// Command failed
+					failed = TRUE;
 				}
+
+				// Present alert message about clipboard access not being available
+				if (failed || !doc.queryCommandSupported(command)) {
+					if (tinymce.isGecko) {
+						editor.windowManager.confirm(editor.getLang('clipboard_msg'), function(state) {
+							if (state)
+								open('http://www.mozilla.org/editor/midasdemo/securityprefs.html', '_blank');
+						});
+					} else
+						editor.windowManager.alert(editor.getLang('clipboard_no_support'));
+				}
+			},
+
+			// Override unlink command
+			unlink : function(command) {
+				if (selection.isCollapsed())
+					selection.select(selection.getNode());
+
+				execNativeCommand(command);
+				selection.collapse(FALSE);
+			},
+
+			// Override justify commands to use the text formatter engine
+			'JustifyLeft,JustifyCenter,JustifyRight,JustifyFull' : function(command) {
+				var align = command.substring(7);
+
+				// Remove all other alignments first
+				each('left,center,right,full'.split(','), function(name) {
+					if (align != name)
+						editor.formatter.remove('align' + name);
+				});
+
+				toggleFormat('align' + align);
+			},
+
+			// Override list commands to fix WebKit bug
+			'InsertUnorderedList,InsertOrderedList' : function(command) {
+				var listElm, listParent;
+
+				execNativeCommand(command);
+
+				// WebKit produces lists within block elements so we need to split them
+				// we will replace the native list creation logic to custom logic later on
+				// TODO: Remove this when the list creation logic is removed
+				listElm = dom.getParent(selection.getNode(), 'ol,ul');
+				if (listElm) {
+					listParent = listElm.parentNode;
+
+					// If list is within a text block then split that block
+					if (/^(H[1-6]|P|ADDRESS|PRE)$/.test(listParent.nodeName)) {
+						storeSelection();
+						dom.split(listParent, listElm);
+						restoreSelection();
+					}
+				}
+			},
+
+			// Override commands to use the text formatter engine
+			'Bold,Italic,Underline,Strikethrough' : function(command) {
+				toggleFormat(command);
+			},
+
+			// Override commands to use the text formatter engine
+			'ForeColor,HiliteColor,FontName' : function(command, ui, value) {
+				toggleFormat(command, value);
+			},
+
+			FontSize : function(command, ui, value) {
+				var fontClasses, fontSizes;
+
+				// Convert font size 1-7 to styles
+				if (value >= 1 && value <= 7) {
+					fontSizes = tinymce.explode(settings.font_size_style_values);
+					fontClasses = tinymce.explode(settings.font_size_classes);
+
+					if (fontClasses)
+						value = fontClasses[value - 1] || value;
+					else
+						value = fontSizes[value - 1] || value;
+				}
+
+				toggleFormat(command, value);
+			},
+
+			RemoveFormat : function(command) {
+				editor.formatter.remove(command);
+			},
+
+			mceBlockQuote : function(command) {
+				toggleFormat('blockquote');
+			},
+
+			FormatBlock : function(command, ui, value) {
+				return toggleFormat(value || 'p');
+			},
+
+			mceCleanup : function() {
+				var bookmark = selection.getBookmark();
+
+				editor.setContent(editor.getContent({cleanup : TRUE}), {cleanup : TRUE});
+
+				selection.moveToBookmark(bookmark);
+			},
+
+			mceRemoveNode : function(command, ui, value) {
+				var node = value || selection.getNode();
+
+				// Make sure that the body node isn't removed
+				if (node != editor.getBody()) {
+					storeSelection();
+					editor.dom.remove(node, TRUE);
+					restoreSelection();
+				}
+			},
+
+			mceSelectNodeDepth : function(command, ui, value) {
+				var counter = 0;
+
+				dom.getParent(selection.getNode(), function(node) {
+					if (node.nodeType == 1 && counter++ == value) {
+						selection.select(node);
+						return FALSE;
+					}
+				}, editor.getBody());
+			},
+
+			mceSelectNode : function(command, ui, value) {
+				selection.select(value);
+			},
+
+			mceInsertContent : function(command, ui, value) {
+				selection.setContent(value);
+			},
+
+			mceInsertRawHTML : function(command, ui, value) {
+				selection.setContent('tiny_mce_marker');
+				editor.setContent(editor.getContent().replace(/tiny_mce_marker/g, function() { return value }));
+			},
+
+			mceSetContent : function(command, ui, value) {
+				editor.setContent(value);
+			},
+
+			'Indent,Outdent' : function(command) {
+				var intentValue, indentUnit, value;
+
+				// Setup indent level
+				intentValue = settings.indentation;
+				indentUnit = /[a-z%]+$/i.exec(intentValue);
+				intentValue = parseInt(intentValue);
+
+				if (!queryCommandState('InsertUnorderedList') && !queryCommandState('InsertOrderedList')) {
+					each(selection.getSelectedBlocks(), function(element) {
+						if (command == 'outdent') {
+							value = Math.max(0, parseInt(element.style.paddingLeft || 0) - intentValue);
+							dom.setStyle(element, 'paddingLeft', value ? value + indentUnit : '');
+						} else
+							dom.setStyle(element, 'paddingLeft', (parseInt(element.style.paddingLeft || 0) + intentValue) + indentUnit);
+					});
+				} else
+					execNativeCommand(command);
+			},
+
+			mceRepaint : function() {
+				var bookmark;
+
+				if (tinymce.isGecko) {
+					try {
+						storeSelection(TRUE);
+
+						if (selection.getSel())
+							selection.getSel().selectAllChildren(editor.getBody());
+
+						selection.collapse(TRUE);
+						restoreSelection();
+					} catch (ex) {
+						// Ignore
+					}
+				}
+			},
+
+			mceToggleFormat : function(command, ui, value) {
+				editor.formatter.toggle(value);
+			},
+
+			InsertHorizontalRule : function() {
+				selection.setContent('<hr />');
+			},
+
+			mceToggleVisualAid : function() {
+				editor.hasVisual = !editor.hasVisual;
+				editor.addVisual();
+			},
+
+			mceReplaceContent : function(command, ui, value) {
+				selection.setContent(value.replace(/\{\$selection\}/g, selection.getContent({format : 'text'})));
+			},
+
+			mceInsertLink : function(command, ui, value) {
+				var link = dom.getParent(selection.getNode(), 'a');
+
+				if (tinymce.is(value, 'string'))
+					value = {href : value};
+
+				if (!link) {
+					execNativeCommand('CreateLink', FALSE, 'javascript:mctmp(0);');
+					each(dom.select('a[href=javascript:mctmp(0);]'), function(link) {
+						dom.setAttribs(link, value);
+					});
+				} else {
+					if (value.href)
+						dom.setAttribs(link, value);
+					else
+						editor.dom.remove(link, TRUE);
+				}
+			},
+			
+			selectAll : function() {
+				var root = dom.getRoot(), rng = dom.createRng();
+
+				rng.setStart(root, 0);
+				rng.setEnd(root, root.childNodes.length);
+
+				editor.selection.setRng(rng);
 			}
+		});
 
-			// Add memory cleaner
-			tinyMCE.addEvent(window, 'unload', clean);
-		}
+		// Add queryCommandState overrides
+		addCommands({
+			// Override justify commands
+			'JustifyLeft,JustifyCenter,JustifyRight,JustifyFull' : function(command) {
+				return isFormatMatch('align' + command.substring(7));
+			},
 
-		if (o.attachEvent)
-			o.attachEvent("on" + n, h);
-		else
-			o.addEventListener(n, h, false);
-	},
+			'Bold,Italic,Underline,Strikethrough' : function(command) {
+				return isFormatMatch(command);
+			},
 
-	removeEvent : function(o, n, h) {
-		if (o.detachEvent)
-			o.detachEvent("on" + n, h);
-		else
-			o.removeEventListener(n, h, false);
-	},
+			mceBlockQuote : function() {
+				return isFormatMatch('blockquote');
+			},
 
-	addSelectAccessibility : function(e, s, w) {
-		// Add event handlers 
-		if (!s._isAccessible) {
-			s.onkeydown = tinyMCE.accessibleEventHandler;
-			s.onblur = tinyMCE.accessibleEventHandler;
-			s._isAccessible = true;
-			s._win = w;
-		}
+			Outdent : function() {
+				var node;
 
-		return false;
-	},
+				if (settings.inline_styles) {
+					if ((node = dom.getParent(selection.getStart(), dom.isBlock)) && parseInt(node.style.paddingLeft) > 0)
+						return TRUE;
 
-	accessibleEventHandler : function(e) {
-		var elm, win = this._win;
+					if ((node = dom.getParent(selection.getEnd(), dom.isBlock)) && parseInt(node.style.paddingLeft) > 0)
+						return TRUE;
+				}
 
-		e = tinyMCE.isIE ? win.event : e;
-		elm = tinyMCE.isIE ? e.srcElement : e.target;
+				return queryCommandState('InsertUnorderedList') || queryCommandState('InsertOrderedList') || (!settings.inline_styles && !!dom.getParent(selection.getNode(), 'BLOCKQUOTE'));
+			},
 
-		// Unpiggyback onchange on blur
-		if (e.type == "blur") {
-			if (elm.oldonchange) {
-				elm.onchange = elm.oldonchange;
-				elm.oldonchange = null;
+			'InsertUnorderedList,InsertOrderedList' : function(command) {
+				return dom.getParent(selection.getNode(), command == 'insertunorderedlist' ? 'UL' : 'OL');
 			}
+		}, 'state');
 
-			return true;
-		}
+		// Add queryCommandValue overrides
+		addCommands({
+			'FontSize,FontName' : function(command) {
+				var value = 0, parent;
 
-		// Piggyback onchange
-		if (elm.nodeName == "SELECT" && !elm.oldonchange) {
-			elm.oldonchange = elm.onchange;
-			elm.onchange = null;
-		}
+				if (parent = dom.getParent(selection.getNode(), 'span')) {
+					if (command == 'fontsize')
+						value = parent.style.fontSize;
+					else
+						value = parent.style.fontFamily.replace(/, /g, ',').replace(/[\'\"]/g, '').toLowerCase();
+				}
 
-		// Execute onchange and remove piggyback
-		if (e.keyCode == 13 || e.keyCode == 32) {
-			elm.onchange = elm.oldonchange;
-			elm.onchange();
-			elm.oldonchange = null;
+				return value;
+			}
+		}, 'value');
 
-			tinyMCE.cancelEvent(e);
-			return false;
+		// Add undo manager logic
+		if (settings.custom_undo_redo) {
+			addCommands({
+				Undo : function() {
+					editor.undoManager.undo();
+				},
+
+				Redo : function() {
+					editor.undoManager.redo();
+				}
+			});
 		}
+	};
+})(tinymce);
+(function(tinymce) {
+	var Dispatcher = tinymce.util.Dispatcher;
 
-		return true;
-	},
+	tinymce.UndoManager = function(editor) {
+		var self, index = 0, data = [];
 
-	_resetIframeHeight : function() {
-		var ife;
+		function getContent() {
+			return tinymce.trim(editor.getContent({format : 'raw', no_events : 1}));
+		};
 
-		if (tinyMCE.isRealIE) {
-			ife = tinyMCE.selectedInstance.iframeElement;
+		return self = {
+			typing : 0,
 
-	/*		if (ife._oldWidth) {
-				ife.style.width = ife._oldWidth;
-				ife.width = ife._oldWidth;
-			}*/
+			onAdd : new Dispatcher(self),
+			onUndo : new Dispatcher(self),
+			onRedo : new Dispatcher(self),
 
-			if (ife._oldHeight) {
-				ife.style.height = ife._oldHeight;
-				ife.height = ife._oldHeight;
+			add : function(level) {
+				var i, settings = editor.settings, lastLevel;
+
+				level = level || {};
+				level.content = getContent();
+
+				// Add undo level if needed
+				lastLevel = data[index];
+				if (lastLevel && lastLevel.content == level.content) {
+					if (index > 0 || data.length == 1)
+						return null;
+				}
+
+				// Time to compress
+				if (settings.custom_undo_redo_levels) {
+					if (data.length > settings.custom_undo_redo_levels) {
+						for (i = 0; i < data.length - 1; i++)
+							data[i] = data[i + 1];
+
+						data.length--;
+						index = data.length;
+					}
+				}
+
+				// Get a non intrusive normalized bookmark
+				level.bookmark = editor.selection.getBookmark(2, true);
+
+				// Crop array if needed
+				if (index < data.length - 1) {
+					// Treat first level as initial
+					if (index == 0)
+						data = [];
+					else
+						data.length = index + 1;
+				}
+
+				data.push(level);
+				index = data.length - 1;
+
+				self.onAdd.dispatch(self, level);
+				editor.isNotDirty = 0;
+
+				return level;
+			},
+
+			undo : function() {
+				var level, i;
+
+				if (self.typing) {
+					self.add();
+					self.typing = 0;
+				}
+
+				if (index > 0) {
+					level = data[--index];
+
+					editor.setContent(level.content, {format : 'raw'});
+					editor.selection.moveToBookmark(level.bookmark);
+
+					self.onUndo.dispatch(self, level);
+				}
+
+				return level;
+			},
+
+			redo : function() {
+				var level;
+
+				if (index < data.length - 1) {
+					level = data[++index];
+
+					editor.setContent(level.content, {format : 'raw'});
+					editor.selection.moveToBookmark(level.bookmark);
+
+					self.onRedo.dispatch(self, level);
+				}
+
+				return level;
+			},
+
+			clear : function() {
+				data = [];
+				index = self.typing = 0;
+			},
+
+			hasUndo : function() {
+				return index > 0 || self.typing;
+			},
+
+			hasRedo : function() {
+				return index < data.length - 1;
 			}
-		}
-	}
+		};
+	};
+})(tinymce);
 
-	});
+(function(tinymce) {
+	// Shorten names
+	var Event = tinymce.dom.Event,
+		isIE = tinymce.isIE,
+		isGecko = tinymce.isGecko,
+		isOpera = tinymce.isOpera,
+		each = tinymce.each,
+		extend = tinymce.extend,
+		TRUE = true,
+		FALSE = false;
 
-/* file:jscripts/tiny_mce/classes/TinyMCE_Selection.class.js */
+	function cloneFormats(node) {
+		var clone, temp, inner;
 
-function TinyMCE_Selection(inst) {
-	this.instance = inst;
-};
+		do {
+			if (/^(SPAN|STRONG|B|EM|I|FONT|STRIKE|U)$/.test(node.nodeName)) {
+				if (clone) {
+					temp = node.cloneNode(false);
+					temp.appendChild(clone);
+					clone = temp;
+				} else {
+					clone = inner = node.cloneNode(false);
+				}
 
-TinyMCE_Selection.prototype = {
-	getSelectedHTML : function() {
-		var inst = this.instance, e, r = this.getRng(), h;
+				clone.removeAttribute('id');
+			}
+		} while (node = node.parentNode);
 
-		if (!r)
-			return null;
+		if (clone)
+			return {wrapper : clone, inner : inner};
+	};
 
-		e = document.createElement("body");
+	// Checks if the selection/caret is at the end of the specified block element
+	function isAtEnd(rng, par) {
+		var rng2 = par.ownerDocument.createRange();
 
-		if (r.cloneContents)
-			e.appendChild(document.importNode(r.cloneContents(), true));
-		else if (typeof(r.item) != 'undefined' || typeof(r.htmlText) != 'undefined')
-			e.innerHTML = r.item ? r.item(0).outerHTML : r.htmlText;
-		else
-			e.innerHTML = r.toString(); // Failed, use text for now
+		rng2.setStart(rng.endContainer, rng.endOffset);
+		rng2.setEndAfter(par);
 
-		h = tinyMCE._cleanupHTML(inst, inst.contentDocument, inst.settings, e, e, false, true, false);
+		// Get number of characters to the right of the cursor if it's zero then we are at the end and need to merge the next block element
+		return rng2.cloneContents().textContent.length == 0;
+	};
 
-		// When editing always use fonts internaly
-		//if (tinyMCE.getParam("convert_fonts_to_spans"))
-		//	tinyMCE.convertSpansToFonts(inst.getDoc());
+	function isEmpty(n) {
+		n = n.innerHTML;
 
-		return h;
-	},
+		n = n.replace(/<(img|hr|table|input|select|textarea)[ \>]/gi, '-'); // Keep these convert them to - chars
+		n = n.replace(/<[^>]+>/g, ''); // Remove all tags
 
-	getSelectedText : function() {
-		var inst = this.instance, d, r, s, t;
+		return n.replace(/[ \u00a0\t\r\n]+/g, '') == '';
+	};
 
-		if (tinyMCE.isIE) {
-			d = inst.getDoc();
+	function splitList(selection, dom, li) {
+		var listBlock, block;
 
-			if (d.selection.type == "Text") {
-				r = d.selection.createRange();
-				t = r.text;
-			} else
-				t = '';
-		} else {
-			s = this.getSel();
+		if (isEmpty(li)) {
+			listBlock = dom.getParent(li, 'ul,ol');
 
-			if (s && s.toString)
-				t = s.toString();
-			else
-				t = '';
+			if (!dom.getParent(listBlock.parentNode, 'ul,ol')) {
+				dom.split(listBlock, li);
+				block = dom.create('p', 0, '<br _mce_bogus="1" />');
+				dom.replace(block, li);
+				selection.select(block, 1);
+			}
+
+			return FALSE;
 		}
 
-		return t;
-	},
+		return TRUE;
+	};
 
-	getBookmark : function(simple) {
-		var inst = this.instance, rng = this.getRng(), doc = inst.getDoc(), b = inst.getBody();
-		var trng, sx, sy, xx = -999999999, vp = inst.getViewPort();
-		var sp, le, s, e, nl, i, si, ei, w;
+	tinymce.create('tinymce.ForceBlocks', {
+		ForceBlocks : function(ed) {
+			var t = this, s = ed.settings, elm;
 
-		sx = vp.left;
-		sy = vp.top;
+			t.editor = ed;
+			t.dom = ed.dom;
+			elm = (s.forced_root_block || 'p').toLowerCase();
+			s.element = elm.toUpperCase();
 
-		if (simple)
-			return {rng : rng, scrollX : sx, scrollY : sy};
+			ed.onPreInit.add(t.setup, t);
 
-		if (tinyMCE.isRealIE) {
-			if (rng.item) {
-				e = rng.item(0);
+			t.reOpera = new RegExp('(\\u00a0|&#160;|&nbsp;)<\/' + elm + '>', 'gi');
+			t.rePadd = new RegExp('<p( )([^>]+)><\\\/p>|<p( )([^>]+)\\\/>|<p( )([^>]+)>\\s+<\\\/p>|<p><\\\/p>|<p\\\/>|<p>\\s+<\\\/p>'.replace(/p/g, elm), 'gi');
+			t.reNbsp2BR1 = new RegExp('<p( )([^>]+)>[\\s\\u00a0]+<\\\/p>|<p>[\\s\\u00a0]+<\\\/p>'.replace(/p/g, elm), 'gi');
+			t.reNbsp2BR2 = new RegExp('<%p()([^>]+)>(&nbsp;|&#160;)<\\\/%p>|<%p>(&nbsp;|&#160;)<\\\/%p>'.replace(/%p/g, elm), 'gi');
+			t.reBR2Nbsp = new RegExp('<p( )([^>]+)>\\s*<br \\\/>\\s*<\\\/p>|<p>\\s*<br \\\/>\\s*<\\\/p>'.replace(/p/g, elm), 'gi');
 
-				nl = b.getElementsByTagName(e.nodeName);
-				for (i=0; i<nl.length; i++) {
-					if (e == nl[i]) {
-						sp = i;
-						break;
-					}
+			function padd(ed, o) {
+				if (isOpera)
+					o.content = o.content.replace(t.reOpera, '</' + elm + '>');
+
+				o.content = o.content.replace(t.rePadd, '<' + elm + '$1$2$3$4$5$6>\u00a0</' + elm + '>');
+
+				if (!isIE && !isOpera && o.set) {
+					// Use &nbsp; instead of BR in padded paragraphs
+					o.content = o.content.replace(t.reNbsp2BR1, '<' + elm + '$1$2><br /></' + elm + '>');
+					o.content = o.content.replace(t.reNbsp2BR2, '<' + elm + '$1$2><br /></' + elm + '>');
+				} else
+					o.content = o.content.replace(t.reBR2Nbsp, '<' + elm + '$1$2>\u00a0</' + elm + '>');
+			};
+
+			ed.onBeforeSetContent.add(padd);
+			ed.onPostProcess.add(padd);
+
+			if (s.forced_root_block) {
+				ed.onInit.add(t.forceRoots, t);
+				ed.onSetContent.add(t.forceRoots, t);
+				ed.onBeforeGetContent.add(t.forceRoots, t);
+			}
+		},
+
+		setup : function() {
+			var t = this, ed = t.editor, s = ed.settings, dom = ed.dom, selection = ed.selection;
+
+			// Force root blocks when typing and when getting output
+			if (s.forced_root_block) {
+				ed.onBeforeExecCommand.add(t.forceRoots, t);
+				ed.onKeyUp.add(t.forceRoots, t);
+				ed.onPreProcess.add(t.forceRoots, t);
+			}
+
+			if (s.force_br_newlines) {
+				// Force IE to produce BRs on enter
+				if (isIE) {
+					ed.onKeyPress.add(function(ed, e) {
+						var n;
+
+						if (e.keyCode == 13 && selection.getNode().nodeName != 'LI') {
+							selection.setContent('<br id="__" /> ', {format : 'raw'});
+							n = dom.get('__');
+							n.removeAttribute('id');
+							selection.select(n);
+							selection.collapse();
+							return Event.cancel(e);
+						}
+					});
 				}
+			}
 
-				return {
-					tag : e.nodeName,
-					index : sp,
-					scrollX : sx,
-					scrollY : sy
-				};
-			} else {
-				trng = doc.body.createTextRange();
-				trng.moveToElementText(inst.getBody());
-				trng.collapse(true);
-				bp = Math.abs(trng.move('character', xx));
+			if (s.force_p_newlines) {
+				if (!isIE) {
+					ed.onKeyPress.add(function(ed, e) {
+						if (e.keyCode == 13 && !e.shiftKey && !t.insertPara(e))
+							Event.cancel(e);
+					});
+				} else {
+					// Ungly hack to for IE to preserve the formatting when you press
+					// enter at the end of a block element with formatted contents
+					// This logic overrides the browsers default logic with
+					// custom logic that enables us to control the output
+					tinymce.addUnload(function() {
+						t._previousFormats = 0; // Fix IE leak
+					});
 
-				trng = rng.duplicate();
-				trng.collapse(true);
-				sp = Math.abs(trng.move('character', xx));
+					ed.onKeyPress.add(function(ed, e) {
+						t._previousFormats = 0;
 
-				trng = rng.duplicate();
-				trng.collapse(false);
-				le = Math.abs(trng.move('character', xx)) - sp;
+						// Clone the current formats, this will later be applied to the new block contents
+						if (e.keyCode == 13 && !e.shiftKey && ed.selection.isCollapsed() && s.keep_styles)
+							t._previousFormats = cloneFormats(ed.selection.getStart());
+					});
 
-				return {
-					start : sp - bp,
-					length : le,
-					scrollX : sx,
-					scrollY : sy
-				};
+					ed.onKeyUp.add(function(ed, e) {
+						// Let IE break the element and the wrap the new caret location in the previous formats
+						if (e.keyCode == 13 && !e.shiftKey) {
+							var parent = ed.selection.getStart(), fmt = t._previousFormats;
+
+							// Parent is an empty block
+							if (!parent.hasChildNodes() && fmt) {
+								parent = dom.getParent(parent, dom.isBlock);
+
+								if (parent && parent.nodeName != 'LI') {
+									parent.innerHTML = '';
+
+									if (t._previousFormats) {
+										parent.appendChild(fmt.wrapper);
+										fmt.inner.innerHTML = '\uFEFF';
+									} else
+										parent.innerHTML = '\uFEFF';
+
+									selection.select(parent, 1);
+									ed.getDoc().execCommand('Delete', false, null);
+									t._previousFormats = 0;
+								}
+							}
+						}
+					});
+				}
+
+				if (isGecko) {
+					ed.onKeyDown.add(function(ed, e) {
+						if ((e.keyCode == 8 || e.keyCode == 46) && !e.shiftKey)
+							t.backspaceDelete(e, e.keyCode == 8);
+					});
+				}
 			}
-		} else {
-			s = this.getSel();
-			e = this.getFocusElement();
 
-			if (!s)
-				return null;
+			// Workaround for missing shift+enter support, http://bugs.webkit.org/show_bug.cgi?id=16973
+			if (tinymce.isWebKit) {
+				function insertBr(ed) {
+					var rng = selection.getRng(), br, div = dom.create('div', null, ' '), divYPos, vpHeight = dom.getViewPort(ed.getWin()).h;
 
-			if (e && e.nodeName == 'IMG') {
-				/*nl = b.getElementsByTagName('IMG');
-				for (i=0; i<nl.length; i++) {
-					if (e == nl[i]) {
-						sp = i;
-						break;
+					// Insert BR element
+					rng.insertNode(br = dom.create('br'));
+
+					// Place caret after BR
+					rng.setStartAfter(br);
+					rng.setEndAfter(br);
+					selection.setRng(rng);
+
+					// Could not place caret after BR then insert an nbsp entity and move the caret
+					if (selection.getSel().focusNode == br.previousSibling) {
+						selection.select(dom.insertAfter(dom.doc.createTextNode('\u00a0'), br));
+						selection.collapse(TRUE);
 					}
-				}*/
 
-				return {
-					start : -1,
-					end : -1,
-					index : sp,
-					scrollX : sx,
-					scrollY : sy
+					// Create a temporary DIV after the BR and get the position as it
+					// seems like getPos() returns 0 for text nodes and BR elements.
+					dom.insertAfter(div, br);
+					divYPos = dom.getPos(div).y;
+					dom.remove(div);
+
+					// Scroll to new position, scrollIntoView can't be used due to bug: http://bugs.webkit.org/show_bug.cgi?id=16117
+					if (divYPos > vpHeight) // It is not necessary to scroll if the DIV is inside the view port.
+						ed.getWin().scrollTo(0, divYPos);
 				};
+
+				ed.onKeyPress.add(function(ed, e) {
+					if (e.keyCode == 13 && (e.shiftKey || (s.force_br_newlines && !dom.getParent(selection.getNode(), 'h1,h2,h3,h4,h5,h6,ol,ul')))) {
+						insertBr(ed);
+						Event.cancel(e);
+					}
+				});
 			}
 
-			// Caret or selection
-			if (s.anchorNode == s.focusNode && s.anchorOffset == s.focusOffset) {
-				e = this._getPosText(b, s.anchorNode, s.focusNode);
+			// Padd empty inline elements within block elements
+			// For example: <p><strong><em></em></strong></p> becomes <p><strong><em>&nbsp;</em></strong></p>
+			ed.onPreProcess.add(function(ed, o) {
+				each(dom.select('p,h1,h2,h3,h4,h5,h6,div', o.node), function(p) {
+					if (isEmpty(p)) {
+						each(dom.select('span,em,strong,b,i', o.node), function(n) {
+							if (!n.hasChildNodes()) {
+								n.appendChild(ed.getDoc().createTextNode('\u00a0'));
+								return FALSE; // Break the loop one padding is enough
+							}
+						});
+					}
+				});
+			});
 
-				if (!e)
-					return {scrollX : sx, scrollY : sy};
+			// IE specific fixes
+			if (isIE) {
+				// Replaces IE:s auto generated paragraphs with the specified element name
+				if (s.element != 'P') {
+					ed.onKeyPress.add(function(ed, e) {
+						t.lastElm = selection.getNode().nodeName;
+					});
 
-				return {
-					start : e.start + s.anchorOffset,
-					end : e.end + s.focusOffset,
-					scrollX : sx,
-					scrollY : sy
-				};
-			} else {
-				e = this._getPosText(b, rng.startContainer, rng.endContainer);
+					ed.onKeyUp.add(function(ed, e) {
+						var bl, n = selection.getNode(), b = ed.getBody();
 
-				if (!e)
-					return {scrollX : sx, scrollY : sy};
+						if (b.childNodes.length === 1 && n.nodeName == 'P') {
+							n = dom.rename(n, s.element);
+							selection.select(n);
+							selection.collapse();
+							ed.nodeChanged();
+						} else if (e.keyCode == 13 && !e.shiftKey && t.lastElm != 'P') {
+							bl = dom.getParent(n, 'p');
 
-				return {
-					start : e.start + rng.startOffset,
-					end : e.end + rng.endOffset,
-					scrollX : sx,
-					scrollY : sy
-				};
+							if (bl) {
+								dom.rename(bl, s.element);
+								ed.nodeChanged();
+							}
+						}
+					});
+				}
 			}
-		}
+		},
 
-		return null;
-	},
+		find : function(n, t, s) {
+			var ed = this.editor, w = ed.getDoc().createTreeWalker(n, 4, null, FALSE), c = -1;
 
-	moveToBookmark : function(bookmark) {
-		var inst = this.instance, rng, nl, i, ex, b = inst.getBody(), sd;
-		var doc = inst.getDoc(), win = inst.getWin(), sel = this.getSel();
+			while (n = w.nextNode()) {
+				c++;
 
-		if (!bookmark)
-			return false;
+				// Index by node
+				if (t == 0 && n == s)
+					return c;
 
-		if (tinyMCE.isSafari && bookmark.rng) {
-			sel.setBaseAndExtent(bookmark.rng.startContainer, bookmark.rng.startOffset, bookmark.rng.endContainer, bookmark.rng.endOffset);
-			return true;
-		}
+				// Node by index
+				if (t == 1 && c == s)
+					return n;
+			}
 
-		if (tinyMCE.isRealIE) {
-			if (bookmark.rng) {
-				try {
-					bookmark.rng.select();
-				} catch (ex) {
-					// Ignore
+			return -1;
+		},
+
+		forceRoots : function(ed, e) {
+			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;
+			var nx, bl, bp, sp, le, nl = b.childNodes, i, n, eid;
+
+			// Fix for bug #1863847
+			//if (e && e.keyCode == 13)
+			//	return TRUE;
+
+			// Wrap non blocks into blocks
+			for (i = nl.length - 1; i >= 0; i--) {
+				nx = nl[i];
+
+				// Ignore internal elements
+				if (nx.nodeType === 1 && nx.getAttribute('_mce_type')) {
+					bl = null;
+					continue;
 				}
 
-				return true;
+				// Is text or non block element
+				if (nx.nodeType === 3 || (!t.dom.isBlock(nx) && nx.nodeType !== 8 && !/^(script|mce:script|style|mce:style)$/i.test(nx.nodeName))) {
+					if (!bl) {
+						// Create new block but ignore whitespace
+						if (nx.nodeType != 3 || /[^\s]/g.test(nx.nodeValue)) {
+							// Store selection
+							if (si == -2 && r) {
+								if (!isIE) {
+									// If selection is element then mark it
+									if (r.startContainer.nodeType == 1 && (n = r.startContainer.childNodes[r.startOffset]) && n.nodeType == 1) {
+										// Save the id of the selected element
+										eid = n.getAttribute("id");
+										n.setAttribute("id", "__mce");
+									} else {
+										// If element is inside body, might not be the case in contentEdiable mode
+										if (ed.dom.getParent(r.startContainer, function(e) {return e === b;})) {
+											so = r.startOffset;
+											eo = r.endOffset;
+											si = t.find(b, 0, r.startContainer);
+											ei = t.find(b, 0, r.endContainer);
+										}
+									}
+								} else {
+									// Force control range into text range
+									if (r.item) {
+										tr = d.body.createTextRange();
+										tr.moveToElementText(r.item(0));
+										r = tr;
+									}
+
+									tr = d.body.createTextRange();
+									tr.moveToElementText(b);
+									tr.collapse(1);
+									bp = tr.move('character', c) * -1;
+
+									tr = r.duplicate();
+									tr.collapse(1);
+									sp = tr.move('character', c) * -1;
+
+									tr = r.duplicate();
+									tr.collapse(0);
+									le = (tr.move('character', c) * -1) - sp;
+
+									si = sp - bp;
+									ei = le;
+								}
+							}
+
+							// Uses replaceChild instead of cloneNode since it removes selected attribute from option elements on IE
+							// See: http://support.microsoft.com/kb/829907
+							bl = ed.dom.create(ed.settings.forced_root_block);
+							nx.parentNode.replaceChild(bl, nx);
+							bl.appendChild(nx);
+						}
+					} else {
+						if (bl.hasChildNodes())
+							bl.insertBefore(nx, bl.firstChild);
+						else
+							bl.appendChild(nx);
+					}
+				} else
+					bl = null; // Time to create new block
 			}
 
-			win.focus();
+			// Restore selection
+			if (si != -2) {
+				if (!isIE) {
+					bl = b.getElementsByTagName(ed.settings.element)[0];
+					r = d.createRange();
 
-			if (bookmark.tag) {
-				rng = b.createControlRange();
+					// Select last location or generated block
+					if (si != -1)
+						r.setStart(t.find(b, 1, si), so);
+					else
+						r.setStart(bl, 0);
 
-				nl = b.getElementsByTagName(bookmark.tag);
+					// Select last location or generated block
+					if (ei != -1)
+						r.setEnd(t.find(b, 1, ei), eo);
+					else
+						r.setEnd(bl, 0);
 
-				if (nl.length > bookmark.index) {
+					if (s) {
+						s.removeAllRanges();
+						s.addRange(r);
+					}
+				} else {
 					try {
-						rng.addElement(nl[bookmark.index]);
+						r = s.createRange();
+						r.moveToElementText(b);
+						r.collapse(1);
+						r.moveStart('character', si);
+						r.moveEnd('character', ei);
+						r.select();
 					} catch (ex) {
-						// Might be thrown if the node no longer exists
+						// Ignore
 					}
 				}
+			} else if (!isIE && (n = ed.dom.get('__mce'))) {
+				// Restore the id of the selected element
+				if (eid)
+					n.setAttribute('id', eid);
+				else
+					n.removeAttribute('id');
+
+				// Move caret before selected element
+				r = d.createRange();
+				r.setStartBefore(n);
+				r.setEndBefore(n);
+				se.setRng(r);
+			}
+		},
+
+		getParentBlock : function(n) {
+			var d = this.dom;
+
+			return d.getParent(n, d.isBlock);
+		},
+
+		insertPara : function(e) {
+			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;
+			var rb, ra, dir, sn, so, en, eo, sb, eb, bn, bef, aft, sc, ec, n, vp = dom.getViewPort(ed.getWin()), y, ch, car;
+
+			// If root blocks are forced then use Operas default behavior since it's really good
+// Removed due to bug: #1853816
+//			if (se.forced_root_block && isOpera)
+//				return TRUE;
+
+			// Setup before range
+			rb = d.createRange();
+
+			// If is before the first block element and in body, then move it into first block element
+			rb.setStart(s.anchorNode, s.anchorOffset);
+			rb.collapse(TRUE);
+
+			// Setup after range
+			ra = d.createRange();
+
+			// If is before the first block element and in body, then move it into first block element
+			ra.setStart(s.focusNode, s.focusOffset);
+			ra.collapse(TRUE);
+
+			// Setup start/end points
+			dir = rb.compareBoundaryPoints(rb.START_TO_END, ra) < 0;
+			sn = dir ? s.anchorNode : s.focusNode;
+			so = dir ? s.anchorOffset : s.focusOffset;
+			en = dir ? s.focusNode : s.anchorNode;
+			eo = dir ? s.focusOffset : s.anchorOffset;
+
+			// If selection is in empty table cell
+			if (sn === en && /^(TD|TH)$/.test(sn.nodeName)) {
+				if (sn.firstChild.nodeName == 'BR')
+					dom.remove(sn.firstChild); // Remove BR
+
+				// Create two new block elements
+				if (sn.childNodes.length == 0) {
+					ed.dom.add(sn, se.element, null, '<br />');
+					aft = ed.dom.add(sn, se.element, null, '<br />');
+				} else {
+					n = sn.innerHTML;
+					sn.innerHTML = '';
+					ed.dom.add(sn, se.element, null, n);
+					aft = ed.dom.add(sn, se.element, null, '<br />');
+				}
+
+				// Move caret into the last one
+				r = d.createRange();
+				r.selectNodeContents(aft);
+				r.collapse(1);
+				ed.selection.setRng(r);
+
+				return FALSE;
+			}
+
+			// If the caret is in an invalid location in FF we need to move it into the first block
+			if (sn == b && en == b && b.firstChild && ed.dom.isBlock(b.firstChild)) {
+				sn = en = sn.firstChild;
+				so = eo = 0;
+				rb = d.createRange();
+				rb.setStart(sn, 0);
+				ra = d.createRange();
+				ra.setStart(en, 0);
+			}
+
+			// Never use body as start or end node
+			sn = sn.nodeName == "HTML" ? d.body : sn; // Fix for Opera bug: https://bugs.opera.com/show_bug.cgi?id=273224&comments=yes
+			sn = sn.nodeName == "BODY" ? sn.firstChild : sn;
+			en = en.nodeName == "HTML" ? d.body : en; // Fix for Opera bug: https://bugs.opera.com/show_bug.cgi?id=273224&comments=yes
+			en = en.nodeName == "BODY" ? en.firstChild : en;
+
+			// Get start and end blocks
+			sb = t.getParentBlock(sn);
+			eb = t.getParentBlock(en);
+			bn = sb ? sb.nodeName : se.element; // Get block name to create
+
+			// Return inside list use default browser behavior
+			if (n = t.dom.getParent(sb, 'li,pre')) {
+				if (n.nodeName == 'LI')
+					return splitList(ed.selection, t.dom, n);
+
+				return TRUE;
+			}
+
+			// If caption or absolute layers then always generate new blocks within
+			if (sb && (sb.nodeName == 'CAPTION' || /absolute|relative|fixed/gi.test(dom.getStyle(sb, 'position', 1)))) {
+				bn = se.element;
+				sb = null;
+			}
+
+			// If caption or absolute layers then always generate new blocks within
+			if (eb && (eb.nodeName == 'CAPTION' || /absolute|relative|fixed/gi.test(dom.getStyle(sb, 'position', 1)))) {
+				bn = se.element;
+				eb = null;
+			}
+
+			// Use P instead
+			if (/(TD|TABLE|TH|CAPTION)/.test(bn) || (sb && bn == "DIV" && /left|right/gi.test(dom.getStyle(sb, 'float', 1)))) {
+				bn = se.element;
+				sb = eb = null;
+			}
+
+			// Setup new before and after blocks
+			bef = (sb && sb.nodeName == bn) ? sb.cloneNode(0) : ed.dom.create(bn);
+			aft = (eb && eb.nodeName == bn) ? eb.cloneNode(0) : ed.dom.create(bn);
+
+			// Remove id from after clone
+			aft.removeAttribute('id');
+
+			// Is header and cursor is at the end, then force paragraph under
+			if (/^(H[1-6])$/.test(bn) && isAtEnd(r, sb))
+				aft = ed.dom.create(se.element);
+
+			// Find start chop node
+			n = sc = sn;
+			do {
+				if (n == b || n.nodeType == 9 || t.dom.isBlock(n) || /(TD|TABLE|TH|CAPTION)/.test(n.nodeName))
+					break;
+
+				sc = n;
+			} while ((n = n.previousSibling ? n.previousSibling : n.parentNode));
+
+			// Find end chop node
+			n = ec = en;
+			do {
+				if (n == b || n.nodeType == 9 || t.dom.isBlock(n) || /(TD|TABLE|TH|CAPTION)/.test(n.nodeName))
+					break;
+
+				ec = n;
+			} while ((n = n.nextSibling ? n.nextSibling : n.parentNode));
+
+			// Place first chop part into before block element
+			if (sc.nodeName == bn)
+				rb.setStart(sc, 0);
+			else
+				rb.setStartBefore(sc);
+
+			rb.setEnd(sn, so);
+			bef.appendChild(rb.cloneContents() || d.createTextNode('')); // Empty text node needed for Safari
+
+			// Place secnd chop part within new block element
+			try {
+				ra.setEndAfter(ec);
+			} catch(ex) {
+				//console.debug(s.focusNode, s.focusOffset);
+			}
+
+			ra.setStart(en, eo);
+			aft.appendChild(ra.cloneContents() || d.createTextNode('')); // Empty text node needed for Safari
+
+			// Create range around everything
+			r = d.createRange();
+			if (!sc.previousSibling && sc.parentNode.nodeName == bn) {
+				r.setStartBefore(sc.parentNode);
 			} else {
-				// Try/catch needed since this operation breaks when TinyMCE is placed in hidden divs/tabs
-				try {
-					// Incorrect bookmark
-					if (bookmark.start < 0)
-						return true;
+				if (rb.startContainer.nodeName == bn && rb.startOffset == 0)
+					r.setStartBefore(rb.startContainer);
+				else
+					r.setStart(rb.startContainer, rb.startOffset);
+			}
 
-					rng = inst.getSel().createRange();
-					rng.moveToElementText(inst.getBody());
-					rng.collapse(true);
-					rng.moveStart('character', bookmark.start);
-					rng.moveEnd('character', bookmark.length);
-				} catch (ex) {
-					return true;
+			if (!ec.nextSibling && ec.parentNode.nodeName == bn)
+				r.setEndAfter(ec.parentNode);
+			else
+				r.setEnd(ra.endContainer, ra.endOffset);
+
+			// Delete and replace it with new block elements
+			r.deleteContents();
+
+			if (isOpera)
+				ed.getWin().scrollTo(0, vp.y);
+
+			// Never wrap blocks in blocks
+			if (bef.firstChild && bef.firstChild.nodeName == bn)
+				bef.innerHTML = bef.firstChild.innerHTML;
+
+			if (aft.firstChild && aft.firstChild.nodeName == bn)
+				aft.innerHTML = aft.firstChild.innerHTML;
+
+			// Padd empty blocks
+			if (isEmpty(bef))
+				bef.innerHTML = '<br />';
+
+			function appendStyles(e, en) {
+				var nl = [], nn, n, i;
+
+				e.innerHTML = '';
+
+				// Make clones of style elements
+				if (se.keep_styles) {
+					n = en;
+					do {
+						// We only want style specific elements
+						if (/^(SPAN|STRONG|B|EM|I|FONT|STRIKE|U)$/.test(n.nodeName)) {
+							nn = n.cloneNode(FALSE);
+							dom.setAttrib(nn, 'id', ''); // Remove ID since it needs to be unique
+							nl.push(nn);
+						}
+					} while (n = n.parentNode);
 				}
+
+				// Append style elements to aft
+				if (nl.length > 0) {
+					for (i = nl.length - 1, nn = e; i >= 0; i--)
+						nn = nn.appendChild(nl[i]);
+
+					// Padd most inner style element
+					nl[0].innerHTML = isOpera ? '&nbsp;' : '<br />'; // Extra space for Opera so that the caret can move there
+					return nl[0]; // Move caret to most inner element
+				} else
+					e.innerHTML = isOpera ? '&nbsp;' : '<br />'; // Extra space for Opera so that the caret can move there
+			};
+
+			// Fill empty afterblook with current style
+			if (isEmpty(aft))
+				car = appendStyles(aft, en);
+
+			// Opera needs this one backwards for older versions
+			if (isOpera && parseFloat(opera.version()) < 9.5) {
+				r.insertNode(bef);
+				r.insertNode(aft);
+			} else {
+				r.insertNode(aft);
+				r.insertNode(bef);
 			}
 
-			rng.select();
+			// Normalize
+			aft.normalize();
+			bef.normalize();
 
-			win.scrollTo(bookmark.scrollX, bookmark.scrollY);
-			return true;
-		}
+			function first(n) {
+				return d.createTreeWalker(n, NodeFilter.SHOW_TEXT, null, FALSE).nextNode() || n;
+			};
 
-		if (tinyMCE.isGecko || tinyMCE.isOpera) {
-			if (!sel)
-				return false;
+			// Move cursor and scroll into view
+			r = d.createRange();
+			r.selectNodeContents(isGecko ? first(car || aft) : car || aft);
+			r.collapse(1);
+			s.removeAllRanges();
+			s.addRange(r);
 
-			if (bookmark.rng) {
-				sel.removeAllRanges();
-				sel.addRange(bookmark.rng);
+			// 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
+			y = ed.dom.getPos(aft).y;
+			ch = aft.clientHeight;
+
+			// Is element within viewport
+			if (y < vp.y || y + ch > vp.y + vp.h) {
+				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
+				//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));
 			}
 
-			if (bookmark.start != -1 && bookmark.end != -1) {
-				try {
-					sd = this._getTextPos(b, bookmark.start, bookmark.end);
-					rng = doc.createRange();
-					rng.setStart(sd.startNode, sd.startOffset);
-					rng.setEnd(sd.endNode, sd.endOffset);
-					sel.removeAllRanges();
-					sel.addRange(rng);
+			return FALSE;
+		},
 
-					if (!tinyMCE.isOpera)
-						win.focus();
-				} catch (ex) {
-					// Ignore
+		backspaceDelete : function(e, bs) {
+			var t = this, ed = t.editor, b = ed.getBody(), dom = ed.dom, n, se = ed.selection, r = se.getRng(), sc = r.startContainer, n, w, tn, walker;
+
+			// Delete when caret is behind a element doesn't work correctly on Gecko see #3011651
+			if (!bs && r.collapsed && sc.nodeType == 1 && r.startOffset == sc.childNodes.length) {
+				walker = new tinymce.dom.TreeWalker(sc.lastChild, sc);
+
+				// Walk the dom backwards until we find a text node
+				for (n = sc.lastChild; n; n = walker.prev()) {
+					if (n.nodeType == 3) {
+						r.setStart(n, n.nodeValue.length);
+						r.collapse(true);
+						se.setRng(r);
+						return;
+					}
 				}
 			}
 
-			/*
-			if (typeof(bookmark.index) != 'undefined') {
-				tinyMCE.selectElements(b, 'IMG', function (n) {
-					if (bookmark.index-- == 0) {
-						// Select image in Gecko here
+			// The caret sometimes gets stuck in Gecko if you delete empty paragraphs
+			// This workaround removes the element by hand and moves the caret to the previous element
+			if (sc && ed.dom.isBlock(sc) && !/^(TD|TH)$/.test(sc.nodeName) && bs) {
+				if (sc.childNodes.length == 0 || (sc.childNodes.length == 1 && sc.firstChild.nodeName == 'BR')) {
+					// Find previous block element
+					n = sc;
+					while ((n = n.previousSibling) && !ed.dom.isBlock(n)) ;
+
+					if (n) {
+						if (sc != b.firstChild) {
+							// Find last text node
+							w = ed.dom.doc.createTreeWalker(n, NodeFilter.SHOW_TEXT, null, FALSE);
+							while (tn = w.nextNode())
+								n = tn;
+
+							// Place caret at the end of last text node
+							r = ed.getDoc().createRange();
+							r.setStart(n, n.nodeValue ? n.nodeValue.length : 0);
+							r.setEnd(n, n.nodeValue ? n.nodeValue.length : 0);
+							se.setRng(r);
+
+							// Remove the target container
+							ed.dom.remove(sc);
+						}
+
+						return Event.cancel(e);
 					}
+				}
+			}
+		}
+	});
+})(tinymce);
 
-					return false;
+(function(tinymce) {
+	// Shorten names
+	var DOM = tinymce.DOM, Event = tinymce.dom.Event, each = tinymce.each, extend = tinymce.extend;
+
+	tinymce.create('tinymce.ControlManager', {
+		ControlManager : function(ed, s) {
+			var t = this, i;
+
+			s = s || {};
+			t.editor = ed;
+			t.controls = {};
+			t.onAdd = new tinymce.util.Dispatcher(t);
+			t.onPostRender = new tinymce.util.Dispatcher(t);
+			t.prefix = s.prefix || ed.id + '_';
+			t._cls = {};
+
+			t.onPostRender.add(function() {
+				each(t.controls, function(c) {
+					c.postRender();
 				});
-			}
-			*/
+			});
+		},
 
-			win.scrollTo(bookmark.scrollX, bookmark.scrollY);
-			return true;
-		}
+		get : function(id) {
+			return this.controls[this.prefix + id] || this.controls[id];
+		},
 
-		return false;
-	},
+		setActive : function(id, s) {
+			var c = null;
 
-	_getPosText : function(r, sn, en) {
-		var w = document.createTreeWalker(r, NodeFilter.SHOW_TEXT, null, false), n, p = 0, d = {};
+			if (c = this.get(id))
+				c.setActive(s);
 
-		while ((n = w.nextNode()) != null) {
-			if (n == sn)
-				d.start = p;
+			return c;
+		},
 
-			if (n == en) {
-				d.end = p;
-				return d;
+		setDisabled : function(id, s) {
+			var c = null;
+
+			if (c = this.get(id))
+				c.setDisabled(s);
+
+			return c;
+		},
+
+		add : function(c) {
+			var t = this;
+
+			if (c) {
+				t.controls[c.id] = c;
+				t.onAdd.dispatch(c, t);
 			}
 
-			p += n.nodeValue ? n.nodeValue.length : 0;
-		}
+			return c;
+		},
 
-		return null;
-	},
+		createControl : function(n) {
+			var c, t = this, ed = t.editor;
 
-	_getTextPos : function(r, sp, ep) {
-		var w = document.createTreeWalker(r, NodeFilter.SHOW_TEXT, null, false), n, p = 0, d = {};
+			each(ed.plugins, function(p) {
+				if (p.createControl) {
+					c = p.createControl(n, t);
 
-		while ((n = w.nextNode()) != null) {
-			p += n.nodeValue ? n.nodeValue.length : 0;
+					if (c)
+						return false;
+				}
+			});
 
-			if (p >= sp && !d.startNode) {
-				d.startNode = n;
-				d.startOffset = sp - (p - n.nodeValue.length);
+			switch (n) {
+				case "|":
+				case "separator":
+					return t.createSeparator();
 			}
 
-			if (p >= ep) {
-				d.endNode = n;
-				d.endOffset = ep - (p - n.nodeValue.length);
+			if (!c && ed.buttons && (c = ed.buttons[n]))
+				return t.createButton(n, c);
 
-				return d;
+			return t.add(c);
+		},
+
+		createDropMenu : function(id, s, cc) {
+			var t = this, ed = t.editor, c, bm, v, cls;
+
+			s = extend({
+				'class' : 'mceDropDown',
+				constrain : ed.settings.constrain_menus
+			}, s);
+
+			s['class'] = s['class'] + ' ' + ed.getParam('skin') + 'Skin';
+			if (v = ed.getParam('skin_variant'))
+				s['class'] += ' ' + ed.getParam('skin') + 'Skin' + v.substring(0, 1).toUpperCase() + v.substring(1);
+
+			id = t.prefix + id;
+			cls = cc || t._cls.dropmenu || tinymce.ui.DropMenu;
+			c = t.controls[id] = new cls(id, s);
+			c.onAddItem.add(function(c, o) {
+				var s = o.settings;
+
+				s.title = ed.getLang(s.title, s.title);
+
+				if (!s.onclick) {
+					s.onclick = function(v) {
+						if (s.cmd)
+							ed.execCommand(s.cmd, s.ui || false, s.value);
+					};
+				}
+			});
+
+			ed.onRemove.add(function() {
+				c.destroy();
+			});
+
+			// Fix for bug #1897785, #1898007
+			if (tinymce.isIE) {
+				c.onShowMenu.add(function() {
+					// IE 8 needs focus in order to store away a range with the current collapsed caret location
+					ed.focus();
+
+					bm = ed.selection.getBookmark(1);
+				});
+
+				c.onHideMenu.add(function() {
+					if (bm) {
+						ed.selection.moveToBookmark(bm);
+						bm = 0;
+					}
+				});
 			}
-		}
 
-		return null;
-	},
+			return t.add(c);
+		},
 
-	selectNode : function(node, collapse, select_text_node, to_start) {
-		var inst = this.instance, sel, rng, nodes;
+		createListBox : function(id, s, cc) {
+			var t = this, ed = t.editor, cmd, c, cls;
 
-		if (!node)
-			return;
+			if (t.get(id))
+				return null;
 
-		if (typeof(collapse) == "undefined")
-			collapse = true;
+			s.title = ed.translate(s.title);
+			s.scope = s.scope || ed;
 
-		if (typeof(select_text_node) == "undefined")
-			select_text_node = false;
+			if (!s.onselect) {
+				s.onselect = function(v) {
+					ed.execCommand(s.cmd, s.ui || false, v || s.value);
+				};
+			}
 
-		if (typeof(to_start) == "undefined")
-			to_start = true;
+			s = extend({
+				title : s.title,
+				'class' : 'mce_' + id,
+				scope : s.scope,
+				control_manager : t
+			}, s);
 
-		if (inst.settings.auto_resize)
-			inst.resizeToContent();
+			id = t.prefix + id;
 
-		if (tinyMCE.isRealIE) {
-			rng = inst.getDoc().body.createTextRange();
+			if (ed.settings.use_native_selects)
+				c = new tinymce.ui.NativeListBox(id, s);
+			else {
+				cls = cc || t._cls.listbox || tinymce.ui.ListBox;
+				c = new cls(id, s);
+			}
 
-			try {
-				rng.moveToElementText(node);
+			t.controls[id] = c;
 
-				if (collapse)
-					rng.collapse(to_start);
+			// Fix focus problem in Safari
+			if (tinymce.isWebKit) {
+				c.onPostRender.add(function(c, n) {
+					// Store bookmark on mousedown
+					Event.add(n, 'mousedown', function() {
+						ed.bookmark = ed.selection.getBookmark(1);
+					});
 
-				rng.select();
-			} catch (e) {
-				// Throws illigal agrument in MSIE some times
+					// Restore on focus, since it might be lost
+					Event.add(n, 'focus', function() {
+						ed.selection.moveToBookmark(ed.bookmark);
+						ed.bookmark = null;
+					});
+				});
 			}
-		} else {
-			sel = this.getSel();
 
-			if (!sel)
-				return;
+			if (c.hideMenu)
+				ed.onMouseDown.add(c.hideMenu, c);
 
-			if (tinyMCE.isSafari) {
-				sel.setBaseAndExtent(node, 0, node, node.innerText.length);
+			return t.add(c);
+		},
 
-				if (collapse) {
-					if (to_start)
-						sel.collapseToStart();
-					else
-						sel.collapseToEnd();
-				}
+		createButton : function(id, s, cc) {
+			var t = this, ed = t.editor, o, c, cls;
 
-				this.scrollToNode(node);
+			if (t.get(id))
+				return null;
 
-				return;
+			s.title = ed.translate(s.title);
+			s.label = ed.translate(s.label);
+			s.scope = s.scope || ed;
+
+			if (!s.onclick && !s.menu_button) {
+				s.onclick = function() {
+					ed.execCommand(s.cmd, s.ui || false, s.value);
+				};
 			}
 
-			rng = inst.getDoc().createRange();
+			s = extend({
+				title : s.title,
+				'class' : 'mce_' + id,
+				unavailable_prefix : ed.getLang('unavailable', ''),
+				scope : s.scope,
+				control_manager : t
+			}, s);
 
-			if (select_text_node) {
-				// Find first textnode in tree
-				nodes = tinyMCE.getNodeTree(node, [], 3);
-				if (nodes.length > 0)
-					rng.selectNodeContents(nodes[0]);
-				else
-					rng.selectNodeContents(node);
-			} else
-				rng.selectNode(node);
+			id = t.prefix + id;
 
-			if (collapse) {
-				// Special treatment of textnode collapse
-				if (!to_start && node.nodeType == 3) {
-					rng.setStart(node, node.nodeValue.length);
-					rng.setEnd(node, node.nodeValue.length);
-				} else
-					rng.collapse(to_start);
+			if (s.menu_button) {
+				cls = cc || t._cls.menubutton || tinymce.ui.MenuButton;
+				c = new cls(id, s);
+				ed.onMouseDown.add(c.hideMenu, c);
+			} else {
+				cls = t._cls.button || tinymce.ui.Button;
+				c = new cls(id, s);
 			}
 
-			sel.removeAllRanges();
-			sel.addRange(rng);
-		}
+			return t.add(c);
+		},
 
-		this.scrollToNode(node);
+		createMenuButton : function(id, s, cc) {
+			s = s || {};
+			s.menu_button = 1;
 
-		// Set selected element
-		tinyMCE.selectedElement = null;
-		if (node.nodeType == 1)
-			tinyMCE.selectedElement = node;
-	},
+			return this.createButton(id, s, cc);
+		},
 
-	scrollToNode : function(node) {
-		var inst = this.instance, w = inst.getWin(), vp = inst.getViewPort(), pos = tinyMCE.getAbsPosition(node), cvp, p, cwin;
+		createSplitButton : function(id, s, cc) {
+			var t = this, ed = t.editor, cmd, c, cls;
 
-		// Only scroll if out of visible area
-		if (pos.absLeft < vp.left || pos.absLeft > vp.left + vp.width || pos.absTop < vp.top || pos.absTop > vp.top + (vp.height-25))
-			w.scrollTo(pos.absLeft, pos.absTop - vp.height + 25);
+			if (t.get(id))
+				return null;
 
-		// Scroll container window
-		if (inst.settings.auto_resize) {
-			cwin = inst.getContainerWin();
-			cvp = tinyMCE.getViewPort(cwin);
-			p = this.getAbsPosition(node);
+			s.title = ed.translate(s.title);
+			s.scope = s.scope || ed;
 
-			if (p.absLeft < cvp.left || p.absLeft > cvp.left + cvp.width || p.absTop < cvp.top || p.absTop > cvp.top + cvp.height)
-				cwin.scrollTo(p.absLeft, p.absTop - cvp.height + 25);
-		}
-	},
+			if (!s.onclick) {
+				s.onclick = function(v) {
+					ed.execCommand(s.cmd, s.ui || false, v || s.value);
+				};
+			}
 
-	getAbsPosition : function(n) {
-		var pos = tinyMCE.getAbsPosition(n), ipos = tinyMCE.getAbsPosition(this.instance.iframeElement);
+			if (!s.onselect) {
+				s.onselect = function(v) {
+					ed.execCommand(s.cmd, s.ui || false, v || s.value);
+				};
+			}
 
-		return {
-			absLeft : ipos.absLeft + pos.absLeft,
-			absTop : ipos.absTop + pos.absTop
-		};
-	},
+			s = extend({
+				title : s.title,
+				'class' : 'mce_' + id,
+				scope : s.scope,
+				control_manager : t
+			}, s);
 
-	getSel : function() {
-		var inst = this.instance;
+			id = t.prefix + id;
+			cls = cc || t._cls.splitbutton || tinymce.ui.SplitButton;
+			c = t.add(new cls(id, s));
+			ed.onMouseDown.add(c.hideMenu, c);
 
-		if (tinyMCE.isRealIE)
-			return inst.getDoc().selection;
+			return c;
+		},
 
-		return inst.contentWindow.getSelection();
-	},
+		createColorSplitButton : function(id, s, cc) {
+			var t = this, ed = t.editor, cmd, c, cls, bm;
 
-	getRng : function() {
-		var s = this.getSel();
+			if (t.get(id))
+				return null;
 
-		if (s == null)
-			return null;
+			s.title = ed.translate(s.title);
+			s.scope = s.scope || ed;
 
-		if (tinyMCE.isRealIE)
-			return s.createRange();
+			if (!s.onclick) {
+				s.onclick = function(v) {
+					if (tinymce.isIE)
+						bm = ed.selection.getBookmark(1);
 
-		if (tinyMCE.isSafari && !s.getRangeAt)
-			return '' + window.getSelection();
+					ed.execCommand(s.cmd, s.ui || false, v || s.value);
+				};
+			}
 
-		if (s.rangeCount > 0)
-			return s.getRangeAt(0);
+			if (!s.onselect) {
+				s.onselect = function(v) {
+					ed.execCommand(s.cmd, s.ui || false, v || s.value);
+				};
+			}
 
-		return null;
-	},
+			s = extend({
+				title : s.title,
+				'class' : 'mce_' + id,
+				'menu_class' : ed.getParam('skin') + 'Skin',
+				scope : s.scope,
+				more_colors_title : ed.getLang('more_colors')
+			}, s);
 
-	isCollapsed : function() {
-		var r = this.getRng();
+			id = t.prefix + id;
+			cls = cc || t._cls.colorsplitbutton || tinymce.ui.ColorSplitButton;
+			c = new cls(id, s);
+			ed.onMouseDown.add(c.hideMenu, c);
 
-		if (r.item)
-			return false;
+			// Remove the menu element when the editor is removed
+			ed.onRemove.add(function() {
+				c.destroy();
+			});
 
-		return r.boundingWidth == 0 || this.getSel().isCollapsed;
-	},
+			// Fix for bug #1897785, #1898007
+			if (tinymce.isIE) {
+				c.onShowMenu.add(function() {
+					// IE 8 needs focus in order to store away a range with the current collapsed caret location
+					ed.focus();
+					bm = ed.selection.getBookmark(1);
+				});
 
-	collapse : function(b) {
-		var r = this.getRng(), s = this.getSel();
+				c.onHideMenu.add(function() {
+					if (bm) {
+						ed.selection.moveToBookmark(bm);
+						bm = 0;
+					}
+				});
+			}
 
-		if (r.select) {
-			r.collapse(b);
-			r.select();
-		} else {
-			if (b)
-				s.collapseToStart();
-			else
-				s.collapseToEnd();
+			return t.add(c);
+		},
+
+		createToolbar : function(id, s, cc) {
+			var c, t = this, cls;
+
+			id = t.prefix + id;
+			cls = cc || t._cls.toolbar || tinymce.ui.Toolbar;
+			c = new cls(id, s);
+
+			if (t.get(id))
+				return null;
+
+			return t.add(c);
+		},
+
+		createSeparator : function(cc) {
+			var cls = cc || this._cls.separator || tinymce.ui.Separator;
+
+			return new cls();
+		},
+
+		setControlType : function(n, c) {
+			return this._cls[n.toLowerCase()] = c;
+		},
+	
+		destroy : function() {
+			each(this.controls, function(c) {
+				c.destroy();
+			});
+
+			this.controls = null;
 		}
-	},
+	});
+})(tinymce);
 
-	getFocusElement : function() {
-		var inst = this.instance, doc, rng, sel, elm;
+(function(tinymce) {
+	var Dispatcher = tinymce.util.Dispatcher, each = tinymce.each, isIE = tinymce.isIE, isOpera = tinymce.isOpera;
 
-		if (tinyMCE.isRealIE) {
-			doc = inst.getDoc();
-			rng = doc.selection.createRange();
+	tinymce.create('tinymce.WindowManager', {
+		WindowManager : function(ed) {
+			var t = this;
 
-	//		if (rng.collapse)
-	//			rng.collapse(true);
+			t.editor = ed;
+			t.onOpen = new Dispatcher(t);
+			t.onClose = new Dispatcher(t);
+			t.params = {};
+			t.features = {};
+		},
 
-			elm = rng.item ? rng.item(0) : rng.parentElement();
-		} else {
-			if (!tinyMCE.isSafari && inst.isHidden())
-				return inst.getBody();
+		open : function(s, p) {
+			var t = this, f = '', x, y, mo = t.editor.settings.dialog_type == 'modal', w, sw, sh, vp = tinymce.DOM.getViewPort(), u;
 
-			sel = this.getSel();
-			rng = this.getRng();
+			// Default some options
+			s = s || {};
+			p = p || {};
+			sw = isOpera ? vp.w : screen.width; // Opera uses windows inside the Opera window
+			sh = isOpera ? vp.h : screen.height;
+			s.name = s.name || 'mc_' + new Date().getTime();
+			s.width = parseInt(s.width || 320);
+			s.height = parseInt(s.height || 240);
+			s.resizable = true;
+			s.left = s.left || parseInt(sw / 2.0) - (s.width / 2.0);
+			s.top = s.top || parseInt(sh / 2.0) - (s.height / 2.0);
+			p.inline = false;
+			p.mce_width = s.width;
+			p.mce_height = s.height;
+			p.mce_auto_focus = s.auto_focus;
 
-			if (!sel || !rng)
-				return null;
+			if (mo) {
+				if (isIE) {
+					s.center = true;
+					s.help = false;
+					s.dialogWidth = s.width + 'px';
+					s.dialogHeight = s.height + 'px';
+					s.scroll = s.scrollbars || false;
+				}
+			}
 
-			elm = rng.commonAncestorContainer;
-			//elm = (sel && sel.anchorNode) ? sel.anchorNode : null;
+			// Build features string
+			each(s, function(v, k) {
+				if (tinymce.is(v, 'boolean'))
+					v = v ? 'yes' : 'no';
 
-			// Handle selection a image or other control like element such as anchors
-			if (!rng.collapsed) {
-				// Is selection small
-				if (rng.startContainer == rng.endContainer) {
-					if (rng.startOffset - rng.endOffset < 2) {
-						if (rng.startContainer.hasChildNodes())
-							elm = rng.startContainer.childNodes[rng.startOffset];
-					}
+				if (!/^(name|url)$/.test(k)) {
+					if (isIE && mo)
+						f += (f ? ';' : '') + k + ':' + v;
+					else
+						f += (f ? ',' : '') + k + '=' + v;
 				}
+			});
+
+			t.features = s;
+			t.params = p;
+			t.onOpen.dispatch(t, s, p);
+
+			u = s.url || s.file;
+			u = tinymce._addVer(u);
+
+			try {
+				if (isIE && mo) {
+					w = 1;
+					window.showModalDialog(u, window, f);
+				} else
+					w = window.open(u, s.name, f);
+			} catch (ex) {
+				// Ignore
 			}
 
-			// Get the element parent of the node
-			elm = tinyMCE.getParentElement(elm);
+			if (!w)
+				alert(t.editor.getLang('popup_blocked'));
+		},
 
-			//if (tinyMCE.selectedElement != null && tinyMCE.selectedElement.nodeName.toLowerCase() == "img")
-			//	elm = tinyMCE.selectedElement;
+		close : function(w) {
+			w.close();
+			this.onClose.dispatch(this);
+		},
+
+		createInstance : function(cl, a, b, c, d, e) {
+			var f = tinymce.resolve(cl);
+
+			return new f(a, b, c, d, e);
+		},
+
+		confirm : function(t, cb, s, w) {
+			w = w || window;
+
+			cb.call(s || this, w.confirm(this._decode(this.editor.getLang(t, t))));
+		},
+
+		alert : function(tx, cb, s, w) {
+			var t = this;
+
+			w = w || window;
+			w.alert(t._decode(t.editor.getLang(tx, tx)));
+
+			if (cb)
+				cb.call(s || t);
+		},
+
+		resizeBy : function(dw, dh, win) {
+			win.resizeBy(dw, dh);
+		},
+
+		// Internal functions
+
+		_decode : function(s) {
+			return tinymce.DOM.decode(s).replace(/\\n/g, '\n');
 		}
+	});
+}(tinymce));
+(function(tinymce) {
+	function CommandManager() {
+		var execCommands = {}, queryStateCommands = {}, queryValueCommands = {};
 
-		return elm;
-	}
+		function add(collection, cmd, func, scope) {
+			if (typeof(cmd) == 'string')
+				cmd = [cmd];
 
+			tinymce.each(cmd, function(cmd) {
+				collection[cmd.toLowerCase()] = {func : func, scope : scope};
+			});
+		};
+
+		tinymce.extend(this, {
+			add : function(cmd, func, scope) {
+				add(execCommands, cmd, func, scope);
+			},
+
+			addQueryStateHandler : function(cmd, func, scope) {
+				add(queryStateCommands, cmd, func, scope);
+			},
+
+			addQueryValueHandler : function(cmd, func, scope) {
+				add(queryValueCommands, cmd, func, scope);
+			},
+
+			execCommand : function(scope, cmd, ui, value, args) {
+				if (cmd = execCommands[cmd.toLowerCase()]) {
+					if (cmd.func.call(scope || cmd.scope, ui, value, args) !== false)
+						return true;
+				}
+			},
+
+			queryCommandValue : function() {
+				if (cmd = queryValueCommands[cmd.toLowerCase()])
+					return cmd.func.call(scope || cmd.scope, ui, value, args);
+			},
+
+			queryCommandState : function() {
+				if (cmd = queryStateCommands[cmd.toLowerCase()])
+					return cmd.func.call(scope || cmd.scope, ui, value, args);
+			}
+		});
 	};
 
-/* file:jscripts/tiny_mce/classes/TinyMCE_UndoRedo.class.js */
+	tinymce.GlobalCommands = new CommandManager();
+})(tinymce);
+(function(tinymce) {
+	tinymce.Formatter = function(ed) {
+		var formats = {},
+			each = tinymce.each,
+			dom = ed.dom,
+			selection = ed.selection,
+			TreeWalker = tinymce.dom.TreeWalker,
+			rangeUtils = new tinymce.dom.RangeUtils(dom),
+			isValid = ed.schema.isValid,
+			isBlock = dom.isBlock,
+			forcedRootBlock = ed.settings.forced_root_block,
+			nodeIndex = dom.nodeIndex,
+			INVISIBLE_CHAR = '\uFEFF',
+			MCE_ATTR_RE = /^(src|href|style)$/,
+			FALSE = false,
+			TRUE = true,
+			undefined,
+			pendingFormats = {apply : [], remove : []};
 
-function TinyMCE_UndoRedo(inst) {
-	this.instance = inst;
-	this.undoLevels = [];
-	this.undoIndex = 0;
-	this.typingUndoIndex = -1;
-	this.undoRedo = true;
-};
+		function isArray(obj) {
+			return obj instanceof Array;
+		};
 
-TinyMCE_UndoRedo.prototype = {
-	add : function(l) {
-		var b, customUndoLevels, newHTML, inst = this.instance, i, ul, ur;
+		function getParents(node, selector) {
+			return dom.getParents(node, selector, dom.getRoot());
+		};
 
-		if (l) {
-			this.undoLevels[this.undoLevels.length] = l;
-			return true;
-		}
+		function isCaretNode(node) {
+			return node.nodeType === 1 && (node.face === 'mceinline' || node.style.fontFamily === 'mceinline');
+		};
 
-		if (this.typingUndoIndex != -1) {
-			this.undoIndex = this.typingUndoIndex;
+		// Public functions
 
-			if (tinyMCE.typingUndoIndex != -1)
-				tinyMCE.undoIndex = tinyMCE.typingUndoIndex;
-		}
+		function get(name) {
+			return name ? formats[name] : formats;
+		};
 
-		newHTML = tinyMCE.trim(inst.getBody().innerHTML);
-		if (this.undoLevels[this.undoIndex] && newHTML != this.undoLevels[this.undoIndex].content) {
-			//tinyMCE.debug(newHTML, this.undoLevels[this.undoIndex].content);
+		function register(name, format) {
+			if (name) {
+				if (typeof(name) !== 'string') {
+					each(name, function(format, name) {
+						register(name, format);
+					});
+				} else {
+					// Force format into array and add it to internal collection
+					format = format.length ? format : [format];
 
-			// Is dirty again
-			inst.isNotDirty = false;
+					each(format, function(format) {
+						// Set deep to false by default on selector formats this to avoid removing
+						// alignment on images inside paragraphs when alignment is changed on paragraphs
+						if (format.deep === undefined)
+							format.deep = !format.selector;
 
-			tinyMCE.dispatchCallback(inst, 'onchange_callback', 'onChange', inst);
+						// Default to true
+						if (format.split === undefined)
+							format.split = !format.selector || format.inline;
 
-			// Time to compress
-			customUndoLevels = tinyMCE.settings.custom_undo_redo_levels;
-			if (customUndoLevels != -1 && this.undoLevels.length > customUndoLevels) {
-				for (i=0; i<this.undoLevels.length-1; i++)
-					this.undoLevels[i] = this.undoLevels[i+1];
+						// Default to true
+						if (format.remove === undefined && format.selector && !format.inline)
+							format.remove = 'none';
 
-				this.undoLevels.length--;
-				this.undoIndex--;
+						// Mark format as a mixed format inline + block level
+						if (format.selector && format.inline) {
+							format.mixed = true;
+							format.block_expand = true;
+						}
 
-				// Todo: Implement global undo/redo logic here
+						// Split classes if needed
+						if (typeof(format.classes) === 'string')
+							format.classes = format.classes.split(/\s+/);
+					});
+
+					formats[name] = format;
+				}
 			}
+		};
 
-			b = inst.undoBookmark;
+		function apply(name, vars, node) {
+			var formatList = get(name), format = formatList[0], bookmark, rng, i;
 
-			if (!b)
-				b = inst.selection.getBookmark();
+			function moveStart(rng) {
+				var container = rng.startContainer,
+					offset = rng.startOffset,
+					walker, node;
 
-			this.undoIndex++;
-			this.undoLevels[this.undoIndex] = {
-				content : newHTML,
-				bookmark : b
+				// Move startContainer/startOffset in to a suitable node
+				if (container.nodeType == 1 || container.nodeValue === "") {
+					container = container.nodeType == 1 ? container.childNodes[offset] : container;
+
+					// Might fail if the offset is behind the last element in it's container
+					if (container) {
+						walker = new TreeWalker(container, container.parentNode);
+						for (node = walker.current(); node; node = walker.next()) {
+							if (node.nodeType == 3 && !isWhiteSpaceNode(node)) {
+								rng.setStart(node, 0);
+								break;
+							}
+						}
+					}
+				}
+
+				return rng;
 			};
 
-			// Remove all above from global undo/redo
-			ul = tinyMCE.undoLevels;
-			for (i=tinyMCE.undoIndex + 1; i<ul.length; i++) {
-				ur = ul[i].undoRedo;
+			function setElementFormat(elm, fmt) {
+				fmt = fmt || format;
 
-				if (ur.undoIndex == ur.undoLevels.length -1)
-					ur.undoIndex--;
+				if (elm) {
+					each(fmt.styles, function(value, name) {
+						dom.setStyle(elm, name, replaceVars(value, vars));
+					});
 
-				ur.undoLevels.length--;
-			}
+					each(fmt.attributes, function(value, name) {
+						dom.setAttrib(elm, name, replaceVars(value, vars));
+					});
 
-			// Add global undo level
-			tinyMCE.undoLevels[tinyMCE.undoIndex++] = inst;
-			tinyMCE.undoLevels.length = tinyMCE.undoIndex;
+					each(fmt.classes, function(value) {
+						value = replaceVars(value, vars);
 
-			this.undoLevels.length = this.undoIndex + 1;
+						if (!dom.hasClass(elm, value))
+							dom.addClass(elm, value);
+					});
+				}
+			};
 
-			return true;
-		}
+			function applyRngStyle(rng) {
+				var newWrappers = [], wrapName, wrapElm;
 
-		return false;
-	},
+				// Setup wrapper element
+				wrapName = format.inline || format.block;
+				wrapElm = dom.create(wrapName);
+				setElementFormat(wrapElm);
 
-	undo : function() {
-		var inst = this.instance;
+				rangeUtils.walk(rng, function(nodes) {
+					var currentWrapElm;
 
-		// Do undo
-		if (this.undoIndex > 0) {
-			this.undoIndex--;
+					function process(node) {
+						var nodeName = node.nodeName.toLowerCase(), parentName = node.parentNode.nodeName.toLowerCase(), found;
 
-			tinyMCE.setInnerHTML(inst.getBody(), this.undoLevels[this.undoIndex].content);
-			inst.repaint();
+						// Stop wrapping on br elements
+						if (isEq(nodeName, 'br')) {
+							currentWrapElm = 0;
 
-			if (inst.settings.custom_undo_redo_restore_selection)
-				inst.selection.moveToBookmark(this.undoLevels[this.undoIndex].bookmark);
-		}
-	},
+							// Remove any br elements when we wrap things
+							if (format.block)
+								dom.remove(node);
 
-	redo : function() {
-		var inst = this.instance;
+							return;
+						}
 
-		tinyMCE.execCommand("mceEndTyping");
+						// If node is wrapper type
+						if (format.wrapper && matchNode(node, name, vars)) {
+							currentWrapElm = 0;
+							return;
+						}
 
-		if (this.undoIndex < (this.undoLevels.length-1)) {
-			this.undoIndex++;
+						// Can we rename the block
+						if (format.block && !format.wrapper && isTextBlock(nodeName)) {
+							node = dom.rename(node, wrapName);
+							setElementFormat(node);
+							newWrappers.push(node);
+							currentWrapElm = 0;
+							return;
+						}
 
-			tinyMCE.setInnerHTML(inst.getBody(), this.undoLevels[this.undoIndex].content);
-			inst.repaint();
+						// Handle selector patterns
+						if (format.selector) {
+							// Look for matching formats
+							each(formatList, function(format) {
+								if (dom.is(node, format.selector) && !isCaretNode(node)) {
+									setElementFormat(node, format);
+									found = true;
+								}
+							});
 
-			if (inst.settings.custom_undo_redo_restore_selection)
-				inst.selection.moveToBookmark(this.undoLevels[this.undoIndex].bookmark);
-		}
+							// Continue processing if a selector match wasn't found and a inline element is defined
+							if (!format.inline || found) {
+								currentWrapElm = 0;
+								return;
+							}
+						}
 
-		tinyMCE.triggerNodeChange();
-	}
+						// Is it valid to wrap this item
+						if (isValid(wrapName, nodeName) && isValid(parentName, wrapName)) {
+							// Start wrapping
+							if (!currentWrapElm) {
+								// Wrap the node
+								currentWrapElm = wrapElm.cloneNode(FALSE);
+								node.parentNode.insertBefore(currentWrapElm, node);
+								newWrappers.push(currentWrapElm);
+							}
 
-	};
+							currentWrapElm.appendChild(node);
+						} else {
+							// Start a new wrapper for possible children
+							currentWrapElm = 0;
 
-/* file:jscripts/tiny_mce/classes/TinyMCE_ForceParagraphs.class.js */
+							each(tinymce.grep(node.childNodes), process);
 
-var TinyMCE_ForceParagraphs = {
-	_insertPara : function(inst, e) {
-		var doc = inst.getDoc(), sel = inst.getSel(), body = inst.getBody(), win = inst.contentWindow, rng = sel.getRangeAt(0);
-		var rootElm = doc.documentElement, blockName = "P", startNode, endNode, startBlock, endBlock;
-		var rngBefore, rngAfter, direct, startNode, startOffset, endNode, endOffset, b = tinyMCE.isOpera ? inst.selection.getBookmark() : null;
-		var paraBefore, paraAfter, startChop, endChop, contents, i;
+							// End the last wrapper
+							currentWrapElm = 0;
+						}
+					};
 
-		function isEmpty(para) {
-			var nodes;
+					// Process siblings from range
+					each(nodes, process);
+				});
 
-			function isEmptyHTML(html) {
-				return html.replace(new RegExp('[ \t\r\n]+', 'g'), '').toLowerCase() == '';
-			}
+				// Cleanup
+				each(newWrappers, function(node) {
+					var childCount;
 
-			// Check for images
-			if (para.getElementsByTagName("img").length > 0)
-				return false;
+					function getChildCount(node) {
+						var count = 0;
 
-			// Check for tables
-			if (para.getElementsByTagName("table").length > 0)
-				return false;
+						each(node.childNodes, function(node) {
+							if (!isWhiteSpaceNode(node) && !isBookmarkNode(node))
+								count++;
+						});
 
-			// Check for HRs
-			if (para.getElementsByTagName("hr").length > 0)
-				return false;
+						return count;
+					};
 
-			// Check all textnodes
-			nodes = tinyMCE.getNodeTree(para, [], 3);
-			for (i=0; i<nodes.length; i++) {
-				if (!isEmptyHTML(nodes[i].nodeValue))
-					return false;
+					function mergeStyles(node) {
+						var child, clone;
+
+						each(node.childNodes, function(node) {
+							if (node.nodeType == 1 && !isBookmarkNode(node) && !isCaretNode(node)) {
+								child = node;
+								return FALSE; // break loop
+							}
+						});
+
+						// If child was found and of the same type as the current node
+						if (child && matchName(child, format)) {
+							clone = child.cloneNode(FALSE);
+							setElementFormat(clone);
+
+							dom.replace(clone, node, TRUE);
+							dom.remove(child, 1);
+						}
+
+						return clone || node;
+					};
+
+					childCount = getChildCount(node);
+
+					// Remove empty nodes
+					if (childCount === 0) {
+						dom.remove(node, 1);
+						return;
+					}
+
+					if (format.inline || format.wrapper) {
+						// Merges the current node with it's children of similar type to reduce the number of elements
+						if (!format.exact && childCount === 1)
+							node = mergeStyles(node);
+
+						// Remove/merge children
+						each(formatList, function(format) {
+							// Merge all children of similar type will move styles from child to parent
+							// this: <span style="color:red"><b><span style="color:red; font-size:10px">text</span></b></span>
+							// will become: <span style="color:red"><b><span style="font-size:10px">text</span></b></span>
+							each(dom.select(format.inline, node), function(child) {
+								removeFormat(format, vars, child, format.exact ? child : null);
+							});
+						});
+
+						// Remove child if direct parent is of same type
+						if (matchNode(node.parentNode, name, vars)) {
+							dom.remove(node, 1);
+							node = 0;
+							return TRUE;
+						}
+
+						// Look for parent with similar style format
+						if (format.merge_with_parents) {
+							dom.getParent(node.parentNode, function(parent) {
+								if (matchNode(parent, name, vars)) {
+									dom.remove(node, 1);
+									node = 0;
+									return TRUE;
+								}
+							});
+						}
+
+						// Merge next and previous siblings if they are similar <b>text</b><b>text</b> becomes <b>texttext</b>
+						if (node) {
+							node = mergeSiblings(getNonWhiteSpaceSibling(node), node);
+							node = mergeSiblings(node, getNonWhiteSpaceSibling(node, TRUE));
+						}
+					}
+				});
+			};
+
+			if (format) {
+				if (node) {
+					rng = dom.createRng();
+
+					rng.setStartBefore(node);
+					rng.setEndAfter(node);
+
+					applyRngStyle(expandRng(rng, formatList));
+				} else {
+					if (!selection.isCollapsed() || !format.inline) {
+						// Apply formatting to selection
+						bookmark = selection.getBookmark();
+						applyRngStyle(expandRng(selection.getRng(TRUE), formatList));
+
+						selection.moveToBookmark(bookmark);
+						selection.setRng(moveStart(selection.getRng(TRUE)));
+						ed.nodeChanged();
+					} else
+						performCaretAction('apply', name, vars);
+				}
 			}
+		};
 
-			// No images, no tables, no hrs, no text content then it's empty
-			return true;
-		}
+		function remove(name, vars, node) {
+			var formatList = get(name), format = formatList[0], bookmark, i, rng;
 
-	//	tinyMCE.debug(body.innerHTML);
+			function moveStart(rng) {
+				var container = rng.startContainer,
+					offset = rng.startOffset,
+					walker, node, nodes, tmpNode;
 
-	//	debug(e.target, sel.anchorNode.nodeName, sel.focusNode.nodeName, rng.startContainer, rng.endContainer, rng.commonAncestorContainer, sel.anchorOffset, sel.focusOffset, rng.toString());
+				// Convert text node into index if possible
+				if (container.nodeType == 3 && offset >= container.nodeValue.length - 1) {
+					container = container.parentNode;
+					offset = nodeIndex(container) + 1;
+				}
 
-		// Setup before range
-		rngBefore = doc.createRange();
-		rngBefore.setStart(sel.anchorNode, sel.anchorOffset);
-		rngBefore.collapse(true);
+				// Move startContainer/startOffset in to a suitable node
+				if (container.nodeType == 1) {
+					nodes = container.childNodes;
+					container = nodes[Math.min(offset, nodes.length - 1)];
+					walker = new TreeWalker(container);
 
-		// Setup after range
-		rngAfter = doc.createRange();
-		rngAfter.setStart(sel.focusNode, sel.focusOffset);
-		rngAfter.collapse(true);
+					// If offset is at end of the parent node walk to the next one
+					if (offset > nodes.length - 1)
+						walker.next();
 
-		// Setup start/end points
-		direct = rngBefore.compareBoundaryPoints(rngBefore.START_TO_END, rngAfter) < 0;
-		startNode = direct ? sel.anchorNode : sel.focusNode;
-		startOffset = direct ? sel.anchorOffset : sel.focusOffset;
-		endNode = direct ? sel.focusNode : sel.anchorNode;
-		endOffset = direct ? sel.focusOffset : sel.anchorOffset;
+					for (node = walker.current(); node; node = walker.next()) {
+						if (node.nodeType == 3 && !isWhiteSpaceNode(node)) {
+							// IE has a "neat" feature where it moves the start node into the closest element
+							// we can avoid this by inserting an element before it and then remove it after we set the selection
+							tmpNode = dom.create('a', null, INVISIBLE_CHAR);
+							node.parentNode.insertBefore(tmpNode, node);
 
-		startNode = startNode.nodeName == "HTML" ? doc.body : startNode; // Fix for Opera bug: https://bugs.opera.com/show_bug.cgi?id=273224&comments=yes
-		startNode = startNode.nodeName == "BODY" ? startNode.firstChild : startNode;
-		endNode = endNode.nodeName == "BODY" ? endNode.firstChild : endNode;
+							// Set selection and remove tmpNode
+							rng.setStart(node, 0);
+							selection.setRng(rng);
+							dom.remove(tmpNode);
 
-		// Get block elements
-		startBlock = inst.getParentBlockElement(startNode);
-		endBlock = inst.getParentBlockElement(endNode);
+							return;
+						}
+					}
+				}
+			};
 
-		// If absolute force paragraph generation within
-		if (startBlock && (startBlock.nodeName == 'CAPTION' || /absolute|relative|static/gi.test(startBlock.style.position)))
-			startBlock = null;
+			// Merges the styles for each node
+			function process(node) {
+				var children, i, l;
 
-		if (endBlock && (endBlock.nodeName == 'CAPTION' || /absolute|relative|static/gi.test(endBlock.style.position)))
-			endBlock = null;
+				// Grab the children first since the nodelist might be changed
+				children = tinymce.grep(node.childNodes);
 
-		// Use current block name
-		if (startBlock != null) {
-			blockName = startBlock.nodeName;
+				// Process current node
+				for (i = 0, l = formatList.length; i < l; i++) {
+					if (removeFormat(formatList[i], vars, node, node))
+						break;
+				}
 
-			// Use P instead
-			if (/(TD|TABLE|TH|CAPTION)/.test(blockName) || (blockName == "DIV" && /left|right/gi.test(startBlock.style.cssFloat)))
-				blockName = "P";
-		}
+				// Process the children
+				if (format.deep) {
+					for (i = 0, l = children.length; i < l; i++)
+						process(children[i]);
+				}
+			};
 
-		// Within a list use normal behaviour
-		if (tinyMCE.getParentElement(startBlock, "OL,UL", null, body) != null)
-			return false;
+			function findFormatRoot(container) {
+				var formatRoot;
 
-		// Within a table create new paragraphs
-		if ((startBlock != null && startBlock.nodeName == "TABLE") || (endBlock != null && endBlock.nodeName == "TABLE"))
-			startBlock = endBlock = null;
+				// Find format root
+				each(getParents(container.parentNode).reverse(), function(parent) {
+					var format;
 
-		// Setup new paragraphs
-		paraBefore = (startBlock != null && startBlock.nodeName == blockName) ? startBlock.cloneNode(false) : doc.createElement(blockName);
-		paraAfter = (endBlock != null && endBlock.nodeName == blockName) ? endBlock.cloneNode(false) : doc.createElement(blockName);
+					// Find format root element
+					if (!formatRoot && parent.id != '_start' && parent.id != '_end') {
+						// Is the node matching the format we are looking for
+						format = matchNode(parent, name, vars);
+						if (format && format.split !== false)
+							formatRoot = parent;
+					}
+				});
 
-		// Is header, then force paragraph under
-		if (/^(H[1-6])$/.test(blockName))
-			paraAfter = doc.createElement("p");
+				return formatRoot;
+			};
 
-		// Setup chop nodes
-		startChop = startNode;
-		endChop = endNode;
+			function wrapAndSplit(format_root, container, target, split) {
+				var parent, clone, lastClone, firstClone, i, formatRootParent;
 
-		// Get startChop node
-		node = startChop;
-		do {
-			if (node == body || node.nodeType == 9 || tinyMCE.isBlockElement(node))
-				break;
+				// Format root found then clone formats and split it
+				if (format_root) {
+					formatRootParent = format_root.parentNode;
 
-			startChop = node;
-		} while ((node = node.previousSibling ? node.previousSibling : node.parentNode));
+					for (parent = container.parentNode; parent && parent != formatRootParent; parent = parent.parentNode) {
+						clone = parent.cloneNode(FALSE);
 
-		// Get endChop node
-		node = endChop;
-		do {
-			if (node == body || node.nodeType == 9 || tinyMCE.isBlockElement(node))
-				break;
+						for (i = 0; i < formatList.length; i++) {
+							if (removeFormat(formatList[i], vars, clone, clone)) {
+								clone = 0;
+								break;
+							}
+						}
 
-			endChop = node;
-		} while ((node = node.nextSibling ? node.nextSibling : node.parentNode));
+						// Build wrapper node
+						if (clone) {
+							if (lastClone)
+								clone.appendChild(lastClone);
 
-		// Fix when only a image is within the TD
-		if (startChop.nodeName == "TD")
-			startChop = startChop.firstChild;
+							if (!firstClone)
+								firstClone = clone;
 
-		if (endChop.nodeName == "TD")
-			endChop = endChop.lastChild;
+							lastClone = clone;
+						}
+					}
 
-		// If not in a block element
-		if (startBlock == null) {
-			// Delete selection
-			rng.deleteContents();
+					// Never split block elements if the format is mixed
+					if (split && (!format.mixed || !isBlock(format_root)))
+						container = dom.split(format_root, container);
 
-			if (!tinyMCE.isSafari)
-				sel.removeAllRanges();
+					// Wrap container in cloned formats
+					if (lastClone) {
+						target.parentNode.insertBefore(lastClone, target);
+						firstClone.appendChild(target);
+					}
+				}
 
-			if (startChop != rootElm && endChop != rootElm) {
-				// Insert paragraph before
-				rngBefore = rng.cloneRange();
+				return container;
+			};
 
-				if (startChop == body)
-					rngBefore.setStart(startChop, 0);
-				else
-					rngBefore.setStartBefore(startChop);
+			function splitToFormatRoot(container) {
+				return wrapAndSplit(findFormatRoot(container), container, container, true);
+			};
 
-				paraBefore.appendChild(rngBefore.cloneContents());
+			function unwrap(start) {
+				var node = dom.get(start ? '_start' : '_end'),
+					out = node[start ? 'firstChild' : 'lastChild'];
 
-				// Insert paragraph after
-				if (endChop.parentNode.nodeName == blockName)
-					endChop = endChop.parentNode;
+				// If the end is placed within the start the result will be removed
+				// So this checks if the out node is a bookmark node if it is it
+				// checks for another more suitable node
+				if (isBookmarkNode(out))
+					out = out[start ? 'firstChild' : 'lastChild'];
 
-				// If not after image
-				//if (rng.startContainer.nodeName != "BODY" && rng.endContainer.nodeName != "BODY")
-					rng.setEndAfter(endChop);
+				dom.remove(node, true);
 
-				if (endChop.nodeName != "#text" && endChop.nodeName != "BODY")
-					rngBefore.setEndAfter(endChop);
+				return out;
+			};
 
-				contents = rng.cloneContents();
-				if (contents.firstChild && (contents.firstChild.nodeName == blockName || contents.firstChild.nodeName == "BODY"))
-					paraAfter.innerHTML = contents.firstChild.innerHTML;
-				else
-					paraAfter.appendChild(contents);
+			function removeRngStyle(rng) {
+				var startContainer, endContainer;
 
-				// Check if it's a empty paragraph
-				if (isEmpty(paraBefore))
-					paraBefore.innerHTML = "&nbsp;";
+				rng = expandRng(rng, formatList, TRUE);
 
-				// Check if it's a empty paragraph
-				if (isEmpty(paraAfter))
-					paraAfter.innerHTML = "&nbsp;";
+				if (format.split) {
+					startContainer = getContainer(rng, TRUE);
+					endContainer = getContainer(rng);
 
-				// Delete old contents
-				rng.deleteContents();
-				rngAfter.deleteContents();
-				rngBefore.deleteContents();
+					if (startContainer != endContainer) {
+						// Wrap start/end nodes in span element since these might be cloned/moved
+						startContainer = wrap(startContainer, 'span', {id : '_start', _mce_type : 'bookmark'});
+						endContainer = wrap(endContainer, 'span', {id : '_end', _mce_type : 'bookmark'});
 
-				// Insert new paragraphs
-				if (tinyMCE.isOpera) {
-					paraBefore.normalize();
-					rngBefore.insertNode(paraBefore);
-					paraAfter.normalize();
-					rngBefore.insertNode(paraAfter);
-				} else {
-					paraAfter.normalize();
-					rngBefore.insertNode(paraAfter);
-					paraBefore.normalize();
-					rngBefore.insertNode(paraBefore);
+						// Split start/end
+						splitToFormatRoot(startContainer);
+						splitToFormatRoot(endContainer);
+
+						// Unwrap start/end to get real elements again
+						startContainer = unwrap(TRUE);
+						endContainer = unwrap();
+					} else
+						startContainer = endContainer = splitToFormatRoot(startContainer);
+
+					// Update range positions since they might have changed after the split operations
+					rng.startContainer = startContainer.parentNode;
+					rng.startOffset = nodeIndex(startContainer);
+					rng.endContainer = endContainer.parentNode;
+					rng.endOffset = nodeIndex(endContainer) + 1;
 				}
 
-				//tinyMCE.debug("1: ", paraBefore.innerHTML, paraAfter.innerHTML);
-			} else {
-				body.innerHTML = "<" + blockName + ">&nbsp;</" + blockName + "><" + blockName + ">&nbsp;</" + blockName + ">";
-				paraAfter = body.childNodes[1];
+				// Remove items between start/end
+				rangeUtils.walk(rng, function(nodes) {
+					each(nodes, function(node) {
+						process(node);
+					});
+				});
+			};
+
+			// Handle node
+			if (node) {
+				rng = dom.createRng();
+				rng.setStartBefore(node);
+				rng.setEndAfter(node);
+				removeRngStyle(rng);
+				return;
 			}
 
-			inst.selection.moveToBookmark(b);
-			inst.selection.selectNode(paraAfter, true, true);
+			if (!selection.isCollapsed() || !format.inline) {
+				bookmark = selection.getBookmark();
+				removeRngStyle(selection.getRng(TRUE));
+				selection.moveToBookmark(bookmark);
 
-			return true;
-		}
+				// Check if start element still has formatting then we are at: "<b>text|</b>text" and need to move the start into the next text node
+				if (match(name, vars, selection.getStart())) {
+					moveStart(selection.getRng(true));
+				}
 
-		// Place first part within new paragraph
-		if (startChop.nodeName == blockName)
-			rngBefore.setStart(startChop, 0);
-		else
-			rngBefore.setStartBefore(startChop);
+				ed.nodeChanged();
+			} else
+				performCaretAction('remove', name, vars);
+		};
 
-		rngBefore.setEnd(startNode, startOffset);
-		paraBefore.appendChild(rngBefore.cloneContents());
+		function toggle(name, vars, node) {
+			if (match(name, vars, node))
+				remove(name, vars, node);
+			else
+				apply(name, vars, node);
+		};
 
-		// Place secound part within new paragraph
-		rngAfter.setEndAfter(endChop);
-		rngAfter.setStart(endNode, endOffset);
-		contents = rngAfter.cloneContents();
+		function matchNode(node, name, vars, similar) {
+			var formatList = get(name), format, i, classes;
 
-		if (contents.firstChild && contents.firstChild.nodeName == blockName) {
-	/*		var nodes = contents.firstChild.childNodes;
-			for (i=0; i<nodes.length; i++) {
-				//tinyMCE.debug(nodes[i].nodeName);
-				if (nodes[i].nodeName != "BODY")
-					paraAfter.appendChild(nodes[i]);
+			function matchItems(node, format, item_name) {
+				var key, value, items = format[item_name], i;
+
+				// Check all items
+				if (items) {
+					// Non indexed object
+					if (items.length === undefined) {
+						for (key in items) {
+							if (items.hasOwnProperty(key)) {
+								if (item_name === 'attributes')
+									value = dom.getAttrib(node, key);
+								else
+									value = getStyle(node, key);
+
+								if (similar && !value && !format.exact)
+									return;
+
+								if ((!similar || format.exact) && !isEq(value, replaceVars(items[key], vars)))
+									return;
+							}
+						}
+					} else {
+						// Only one match needed for indexed arrays
+						for (i = 0; i < items.length; i++) {
+							if (item_name === 'attributes' ? dom.getAttrib(node, items[i]) : getStyle(node, items[i]))
+								return format;
+						}
+					}
+				}
+
+				return format;
+			};
+
+			if (formatList && node) {
+				// Check each format in list
+				for (i = 0; i < formatList.length; i++) {
+					format = formatList[i];
+
+					// Name name, attributes, styles and classes
+					if (matchName(node, format) && matchItems(node, format, 'attributes') && matchItems(node, format, 'styles')) {
+						// Match classes
+						if (classes = format.classes) {
+							for (i = 0; i < classes.length; i++) {
+								if (!dom.hasClass(node, classes[i]))
+									return;
+							}
+						}
+
+						return format;
+					}
+				}
 			}
-	*/
-			paraAfter.innerHTML = contents.firstChild.innerHTML;
-		} else
-			paraAfter.appendChild(contents);
+		};
 
-		// Check if it's a empty paragraph
-		if (isEmpty(paraBefore))
-			paraBefore.innerHTML = "&nbsp;";
+		function match(name, vars, node) {
+			var startNode, i;
 
-		// Check if it's a empty paragraph
-		if (isEmpty(paraAfter))
-			paraAfter.innerHTML = "&nbsp;";
+			function matchParents(node) {
+				// Find first node with similar format settings
+				node = dom.getParent(node, function(node) {
+					return !!matchNode(node, name, vars, true);
+				});
 
-		// Create a range around everything
-		rng = doc.createRange();
+				// Do an exact check on the similar format element
+				return matchNode(node, name, vars);
+			};
 
-		if (!startChop.previousSibling && startChop.parentNode.nodeName.toUpperCase() == blockName) {
-			rng.setStartBefore(startChop.parentNode);
-		} else {
-			if (rngBefore.startContainer.nodeName.toUpperCase() == blockName && rngBefore.startOffset == 0)
-				rng.setStartBefore(rngBefore.startContainer);
-			else
-				rng.setStart(rngBefore.startContainer, rngBefore.startOffset);
-		}
+			// Check specified node
+			if (node)
+				return matchParents(node);
 
-		if (!endChop.nextSibling && endChop.parentNode.nodeName.toUpperCase() == blockName)
-			rng.setEndAfter(endChop.parentNode);
-		else
-			rng.setEnd(rngAfter.endContainer, rngAfter.endOffset);
+			// Check pending formats
+			if (selection.isCollapsed()) {
+				for (i = pendingFormats.apply.length - 1; i >= 0; i--) {
+					if (pendingFormats.apply[i].name == name)
+						return true;
+				}
 
-		// Delete all contents and insert new paragraphs
-		rng.deleteContents();
+				for (i = pendingFormats.remove.length - 1; i >= 0; i--) {
+					if (pendingFormats.remove[i].name == name)
+						return false;
+				}
 
-		if (tinyMCE.isOpera) {
-			rng.insertNode(paraBefore);
-			rng.insertNode(paraAfter);
-		} else {
-			rng.insertNode(paraAfter);
-			rng.insertNode(paraBefore);
-		}
+				return matchParents(selection.getNode());
+			}
 
-		//tinyMCE.debug("2", paraBefore.innerHTML, paraAfter.innerHTML);
+			// Check selected node
+			node = selection.getNode();
+			if (matchParents(node))
+				return TRUE;
 
-		// Normalize
-		paraAfter.normalize();
-		paraBefore.normalize();
+			// Check start node if it's different
+			startNode = selection.getStart();
+			if (startNode != node) {
+				if (matchParents(startNode))
+					return TRUE;
+			}
 
-		inst.selection.moveToBookmark(b);
-		inst.selection.selectNode(paraAfter, true, true);
+			return FALSE;
+		};
 
-		return true;
-	},
+		function matchAll(names, vars) {
+			var startElement, matchedFormatNames = [], checkedMap = {}, i, ni, name;
 
-	_handleBackSpace : function(inst) {
-		var r = inst.getRng(), sn = r.startContainer, nv, s = false;
+			// If the selection is collapsed then check pending formats
+			if (selection.isCollapsed()) {
+				for (ni = 0; ni < names.length; ni++) {
+					// If the name is to be removed, then stop it from being added
+					for (i = pendingFormats.remove.length - 1; i >= 0; i--) {
+						name = names[ni];
 
-		// Added body check for bug #1527787
-		if (sn && sn.nextSibling && sn.nextSibling.nodeName == "BR" && sn.parentNode.nodeName != "BODY") {
-			nv = sn.nodeValue;
+						if (pendingFormats.remove[i].name == name) {
+							checkedMap[name] = true;
+							break;
+						}
+					}
+				}
 
-			// Handle if a backspace is pressed after a space character #bug 1466054 removed since fix for #1527787
-			/*if (nv != null && nv.length >= r.startOffset && nv.charAt(r.startOffset - 1) == ' ')
-				s = true;*/
+				// If the format is to be applied
+				for (i = pendingFormats.apply.length - 1; i >= 0; i--) {
+					for (ni = 0; ni < names.length; ni++) {
+						name = names[ni];
 
-			// Only remove BRs if we are at the end of line #bug 1464152
-			if (nv != null && r.startOffset == nv.length)
-				sn.nextSibling.parentNode.removeChild(sn.nextSibling);
-		}
+						if (!checkedMap[name] && pendingFormats.apply[i].name == name) {
+							checkedMap[name] = true;
+							matchedFormatNames.push(name);
+						}
+					}
+				}
+			}
 
-		if (inst.settings.auto_resize)
-			inst.resizeToContent();
+			// Check start of selection for formats
+			startElement = selection.getStart();
+			dom.getParent(startElement, function(node) {
+				var i, name;
 
-		return s;
-	}
+				for (i = 0; i < names.length; i++) {
+					name = names[i];
 
-	};
+					if (!checkedMap[name] && matchNode(node, name, vars)) {
+						checkedMap[name] = true;
+						matchedFormatNames.push(name);
+					}
+				}
+			});
 
-/* file:jscripts/tiny_mce/classes/TinyMCE_Layer.class.js */
+			return matchedFormatNames;
+		};
 
-function TinyMCE_Layer(id, bm) {
-	this.id = id;
-	this.blockerElement = null;
-	this.events = false;
-	this.element = null;
-	this.blockMode = typeof(bm) != 'undefined' ? bm : true;
-	this.doc = document;
-};
+		function canApply(name) {
+			var formatList = get(name), startNode, parents, i, x, selector;
 
-TinyMCE_Layer.prototype = {
-	moveRelativeTo : function(re, p) {
-		var rep = this.getAbsPosition(re), e = this.getElement(), x, y;
-		var w = parseInt(re.offsetWidth), h = parseInt(re.offsetHeight);
-		var ew = parseInt(e.offsetWidth), eh = parseInt(e.offsetHeight);
+			if (formatList) {
+				startNode = selection.getStart();
+				parents = getParents(startNode);
 
-		switch (p) {
-			case "tl":
-				x = rep.absLeft;
-				y = rep.absTop;
-				break;
+				for (x = formatList.length - 1; x >= 0; x--) {
+					selector = formatList[x].selector;
 
-			case "tr":
-				x = rep.absLeft + w;
-				y = rep.absTop;
-				break;
+					// Format is not selector based, then always return TRUE
+					if (!selector)
+						return TRUE;
 
-			case "bl":
-				x = rep.absLeft;
-				y = rep.absTop + h;
-				break;
+					for (i = parents.length - 1; i >= 0; i--) {
+						if (dom.is(parents[i], selector))
+							return TRUE;
+					}
+				}
+			}
 
-			case "br":
-				x = rep.absLeft + w;
-				y = rep.absTop + h;
-				break;
+			return FALSE;
+		};
 
-			case "cc":
-				x = rep.absLeft + (w / 2) - (ew / 2);
-				y = rep.absTop + (h / 2) - (eh / 2);
-				break;
-		}
+		// Expose to public
+		tinymce.extend(this, {
+			get : get,
+			register : register,
+			apply : apply,
+			remove : remove,
+			toggle : toggle,
+			match : match,
+			matchAll : matchAll,
+			matchNode : matchNode,
+			canApply : canApply
+		});
 
-		this.moveTo(x, y);
-	},
+		// Private functions
 
-	moveBy : function(x, y) {
-		var e = this.getElement();
-		this.moveTo(parseInt(e.style.left) + x, parseInt(e.style.top) + y);
-	},
+		function matchName(node, format) {
+			// Check for inline match
+			if (isEq(node, format.inline))
+				return TRUE;
 
-	moveTo : function(x, y) {
-		var e = this.getElement();
+			// Check for block match
+			if (isEq(node, format.block))
+				return TRUE;
 
-		e.style.left = x + "px";
-		e.style.top = y + "px";
+			// Check for selector match
+			if (format.selector)
+				return dom.is(node, format.selector);
+		};
 
-		this.updateBlocker();
-	},
+		function isEq(str1, str2) {
+			str1 = str1 || '';
+			str2 = str2 || '';
 
-	resizeBy : function(w, h) {
-		var e = this.getElement();
-		this.resizeTo(parseInt(e.style.width) + w, parseInt(e.style.height) + h);
-	},
+			str1 = '' + (str1.nodeName || str1);
+			str2 = '' + (str2.nodeName || str2);
 
-	resizeTo : function(w, h) {
-		var e = this.getElement();
+			return str1.toLowerCase() == str2.toLowerCase();
+		};
 
-		if (w != null)
-			e.style.width = w + "px";
+		function getStyle(node, name) {
+			var styleVal = dom.getStyle(node, name);
 
-		if (h != null)
-			e.style.height = h + "px";
+			// Force the format to hex
+			if (name == 'color' || name == 'backgroundColor')
+				styleVal = dom.toHex(styleVal);
 
-		this.updateBlocker();
-	},
+			// Opera will return bold as 700
+			if (name == 'fontWeight' && styleVal == 700)
+				styleVal = 'bold';
 
-	show : function() {
-		var el = this.getElement();
+			return '' + styleVal;
+		};
 
-		if (el) {
-			el.style.display = 'block';
-			this.updateBlocker();
-		}
-	},
+		function replaceVars(value, vars) {
+			if (typeof(value) != "string")
+				value = value(vars);
+			else if (vars) {
+				value = value.replace(/%(\w+)/g, function(str, name) {
+					return vars[name] || str;
+				});
+			}
 
-	hide : function() {
-		var el = this.getElement();
+			return value;
+		};
 
-		if (el) {
-			el.style.display = 'none';
-			this.updateBlocker();
-		}
-	},
+		function isWhiteSpaceNode(node) {
+			return node && node.nodeType === 3 && /^([\s\r\n]+|)$/.test(node.nodeValue);
+		};
 
-	isVisible : function() {
-		return this.getElement().style.display == 'block';
-	},
+		function wrap(node, name, attrs) {
+			var wrapper = dom.create(name, attrs);
 
-	getElement : function() {
-		if (!this.element)
-			this.element = this.doc.getElementById(this.id);
+			node.parentNode.insertBefore(wrapper, node);
+			wrapper.appendChild(node);
 
-		return this.element;
-	},
+			return wrapper;
+		};
 
-	setBlockMode : function(s) {
-		this.blockMode = s;
-	},
+		function expandRng(rng, format, remove) {
+			var startContainer = rng.startContainer,
+				startOffset = rng.startOffset,
+				endContainer = rng.endContainer,
+				endOffset = rng.endOffset, sibling, lastIdx;
 
-	updateBlocker : function() {
-		var e, b, x, y, w, h;
+			// This function walks up the tree if there is no siblings before/after the node
+			function findParentContainer(container, child_name, sibling_name, root) {
+				var parent, child;
 
-		b = this.getBlocker();
-		if (b) {
-			if (this.blockMode) {
-				e = this.getElement();
-				x = this.parseInt(e.style.left);
-				y = this.parseInt(e.style.top);
-				w = this.parseInt(e.offsetWidth);
-				h = this.parseInt(e.offsetHeight);
+				root = root || dom.getRoot();
 
-				b.style.left = x + 'px';
-				b.style.top = y + 'px';
-				b.style.width = w + 'px';
-				b.style.height = h + 'px';
-				b.style.display = e.style.display;
-			} else
-				b.style.display = 'none';
-		}
-	},
+				for (;;) {
+					// Check if we can move up are we at root level or body level
+					parent = container.parentNode;
 
-	getBlocker : function() {
-		var d, b;
+					// Stop expanding on block elements or root depending on format
+					if (parent == root || (!format[0].block_expand && isBlock(parent)))
+						return container;
 
-		if (!this.blockerElement && this.blockMode) {
-			d = this.doc;
-			b = d.getElementById(this.id + "_blocker");
+					for (sibling = parent[child_name]; sibling && sibling != container; sibling = sibling[sibling_name]) {
+						if (sibling.nodeType == 1 && !isBookmarkNode(sibling))
+							return container;
 
-			if (!b) {
-				b = d.createElement("iframe");
+						if (sibling.nodeType == 3 && !isWhiteSpaceNode(sibling))
+							return container;
+					}
 
-				b.setAttribute('id', this.id + "_blocker");
-				b.style.cssText = 'display: none; position: absolute; left: 0; top: 0';
-				b.src = 'javascript:false;';
-				b.frameBorder = '0';
-				b.scrolling = 'no';
-	
-				d.body.appendChild(b);
+					container = container.parentNode;
+				}
+
+				return container;
+			};
+
+			// If index based start position then resolve it
+			if (startContainer.nodeType == 1 && startContainer.hasChildNodes()) {
+				lastIdx = startContainer.childNodes.length - 1;
+				startContainer = startContainer.childNodes[startOffset > lastIdx ? lastIdx : startOffset];
+
+				if (startContainer.nodeType == 3)
+					startOffset = 0;
 			}
 
-			this.blockerElement = b;
-		}
+			// If index based end position then resolve it
+			if (endContainer.nodeType == 1 && endContainer.hasChildNodes()) {
+				lastIdx = endContainer.childNodes.length - 1;
+				endContainer = endContainer.childNodes[endOffset > lastIdx ? lastIdx : endOffset - 1];
 
-		return this.blockerElement;
-	},
+				if (endContainer.nodeType == 3)
+					endOffset = endContainer.nodeValue.length;
+			}
 
-	getAbsPosition : function(n) {
-		var p = {absLeft : 0, absTop : 0};
+			// Exclude bookmark nodes if possible
+			if (isBookmarkNode(startContainer.parentNode))
+				startContainer = startContainer.parentNode;
 
-		while (n) {
-			p.absLeft += n.offsetLeft;
-			p.absTop += n.offsetTop;
-			n = n.offsetParent;
+			if (isBookmarkNode(startContainer))
+				startContainer = startContainer.nextSibling || startContainer;
+
+			if (isBookmarkNode(endContainer.parentNode))
+				endContainer = endContainer.parentNode;
+
+			if (isBookmarkNode(endContainer))
+				endContainer = endContainer.previousSibling || endContainer;
+
+			// Move start/end point up the tree if the leaves are sharp and if we are in different containers
+			// Example * becomes !: !<p><b><i>*text</i><i>text*</i></b></p>!
+			// This will reduce the number of wrapper elements that needs to be created
+			// Move start point up the tree
+			if (format[0].inline || format[0].block_expand) {
+				startContainer = findParentContainer(startContainer, 'firstChild', 'nextSibling');
+				endContainer = findParentContainer(endContainer, 'lastChild', 'previousSibling');
+			}
+
+			// Expand start/end container to matching selector
+			if (format[0].selector && format[0].expand !== FALSE && !format[0].inline) {
+				function findSelectorEndPoint(container, sibling_name) {
+					var parents, i, y;
+
+					if (container.nodeType == 3 && container.nodeValue.length == 0 && container[sibling_name])
+						container = container[sibling_name];
+
+					parents = getParents(container);
+					for (i = 0; i < parents.length; i++) {
+						for (y = 0; y < format.length; y++) {
+							if (dom.is(parents[i], format[y].selector))
+								return parents[i];
+						}
+					}
+
+					return container;
+				};
+
+				// Find new startContainer/endContainer if there is better one
+				startContainer = findSelectorEndPoint(startContainer, 'previousSibling');
+				endContainer = findSelectorEndPoint(endContainer, 'nextSibling');
+			}
+
+			// Expand start/end container to matching block element or text node
+			if (format[0].block || format[0].selector) {
+				function findBlockEndPoint(container, sibling_name, sibling_name2) {
+					var node;
+
+					// Expand to block of similar type
+					if (!format[0].wrapper)
+						node = dom.getParent(container, format[0].block);
+
+					// Expand to first wrappable block element or any block element
+					if (!node)
+						node = dom.getParent(container.nodeType == 3 ? container.parentNode : container, isBlock);
+
+					// Exclude inner lists from wrapping
+					if (node && format[0].wrapper)
+						node = getParents(node, 'ul,ol').reverse()[0] || node;
+
+					// Didn't find a block element look for first/last wrappable element
+					if (!node) {
+						node = container;
+
+						while (node[sibling_name] && !isBlock(node[sibling_name])) {
+							node = node[sibling_name];
+
+							// Break on BR but include it will be removed later on
+							// we can't remove it now since we need to check if it can be wrapped
+							if (isEq(node, 'br'))
+								break;
+						}
+					}
+
+					return node || container;
+				};
+
+				// Find new startContainer/endContainer if there is better one
+				startContainer = findBlockEndPoint(startContainer, 'previousSibling');
+				endContainer = findBlockEndPoint(endContainer, 'nextSibling');
+
+				// Non block element then try to expand up the leaf
+				if (format[0].block) {
+					if (!isBlock(startContainer))
+						startContainer = findParentContainer(startContainer, 'firstChild', 'nextSibling');
+
+					if (!isBlock(endContainer))
+						endContainer = findParentContainer(endContainer, 'lastChild', 'previousSibling');
+				}
+			}
+
+			// Setup index for startContainer
+			if (startContainer.nodeType == 1) {
+				startOffset = nodeIndex(startContainer);
+				startContainer = startContainer.parentNode;
+			}
+
+			// Setup index for endContainer
+			if (endContainer.nodeType == 1) {
+				endOffset = nodeIndex(endContainer) + 1;
+				endContainer = endContainer.parentNode;
+			}
+
+			// Return new range like object
+			return {
+				startContainer : startContainer,
+				startOffset : startOffset,
+				endContainer : endContainer,
+				endOffset : endOffset
+			};
 		}
 
-		return p;
-	},
+		function removeFormat(format, vars, node, compare_node) {
+			var i, attrs, stylesModified;
 
-	create : function(n, c, p, h) {
-		var d = this.doc, e = d.createElement(n);
+			// Check if node matches format
+			if (!matchName(node, format))
+				return FALSE;
 
-		e.setAttribute('id', this.id);
+			// Should we compare with format attribs and styles
+			if (format.remove != 'all') {
+				// Remove styles
+				each(format.styles, function(value, name) {
+					value = replaceVars(value, vars);
 
-		if (c)
-			e.className = c;
+					// Indexed array
+					if (typeof(name) === 'number') {
+						name = value;
+						compare_node = 0;
+					}
 
-		if (!p)
-			p = d.body;
+					if (!compare_node || isEq(getStyle(compare_node, name), value))
+						dom.setStyle(node, name, '');
 
-		if (h)
-			e.innerHTML = h;
+					stylesModified = 1;
+				});
 
-		p.appendChild(e);
+				// Remove style attribute if it's empty
+				if (stylesModified && dom.getAttrib(node, 'style') == '') {
+					node.removeAttribute('style');
+					node.removeAttribute('_mce_style');
+				}
 
-		return this.element = e;
-	},
+				// Remove attributes
+				each(format.attributes, function(value, name) {
+					var valueOut;
 
-	exists : function() {
-		return this.doc.getElementById(this.id) != null;
-	},
+					value = replaceVars(value, vars);
 
-	parseInt : function(s) {
-		if (s == null || s == '')
-			return 0;
+					// Indexed array
+					if (typeof(name) === 'number') {
+						name = value;
+						compare_node = 0;
+					}
 
-		return parseInt(s);
-	},
+					if (!compare_node || isEq(dom.getAttrib(compare_node, name), value)) {
+						// Keep internal classes
+						if (name == 'class') {
+							value = dom.getAttrib(node, name);
+							if (value) {
+								// Build new class value where everything is removed except the internal prefixed classes
+								valueOut = '';
+								each(value.split(/\s+/), function(cls) {
+									if (/mce\w+/.test(cls))
+										valueOut += (valueOut ? ' ' : '') + cls;
+								});
 
-	remove : function() {
-		var e = this.getElement(), b = this.getBlocker();
+								// We got some internal classes left
+								if (valueOut) {
+									dom.setAttrib(node, name, valueOut);
+									return;
+								}
+							}
+						}
 
-		if (e)
-			e.parentNode.removeChild(e);
+						// IE6 has a bug where the attribute doesn't get removed correctly
+						if (name == "class")
+							node.removeAttribute('className');
 
-		if (b)
-			b.parentNode.removeChild(b);
-	}
+						// Remove mce prefixed attributes
+						if (MCE_ATTR_RE.test(name))
+							node.removeAttribute('_mce_' + name);
 
-	};
+						node.removeAttribute(name);
+					}
+				});
 
-/* file:jscripts/tiny_mce/classes/TinyMCE_Menu.class.js */
+				// Remove classes
+				each(format.classes, function(value) {
+					value = replaceVars(value, vars);
 
-function TinyMCE_Menu() {
-	var id;
+					if (!compare_node || dom.hasClass(compare_node, value))
+						dom.removeClass(node, value);
+				});
 
-	if (typeof(tinyMCE.menuCounter) == "undefined")
-		tinyMCE.menuCounter = 0;
+				// Check for non internal attributes
+				attrs = dom.getAttribs(node);
+				for (i = 0; i < attrs.length; i++) {
+					if (attrs[i].nodeName.indexOf('_') !== 0)
+						return FALSE;
+				}
+			}
 
-	id = "mc_menu_" + tinyMCE.menuCounter++;
+			// Remove the inline child if it's empty for example <b> or <span>
+			if (format.remove != 'none') {
+				removeNode(node, format);
+				return TRUE;
+			}
+		};
 
-	TinyMCE_Layer.call(this, id, true);
+		function removeNode(node, format) {
+			var parentNode = node.parentNode, rootBlockElm;
 
-	this.id = id;
-	this.items = [];
-	this.needsUpdate = true;
-};
+			if (format.block) {
+				if (!forcedRootBlock) {
+					function find(node, next, inc) {
+						node = getNonWhiteSpaceSibling(node, next, inc);
 
-TinyMCE_Menu.prototype = tinyMCE.extend(TinyMCE_Layer.prototype, {
-	init : function(s) {
-		var n;
+						return !node || (node.nodeName == 'BR' || isBlock(node));
+					};
 
-		// Default params
-		this.settings = {
-			separator_class : 'mceMenuSeparator',
-			title_class : 'mceMenuTitle',
-			disabled_class : 'mceMenuDisabled',
-			menu_class : 'mceMenu',
-			drop_menu : true
+					// Append BR elements if needed before we remove the block
+					if (isBlock(node) && !isBlock(parentNode)) {
+						if (!find(node, FALSE) && !find(node.firstChild, TRUE, 1))
+							node.insertBefore(dom.create('br'), node.firstChild);
+
+						if (!find(node, TRUE) && !find(node.lastChild, FALSE, 1))
+							node.appendChild(dom.create('br'));
+					}
+				} else {
+					// Wrap the block in a forcedRootBlock if we are at the root of document
+					if (parentNode == dom.getRoot()) {
+						if (!format.list_block || !isEq(node, format.list_block)) {
+							each(tinymce.grep(node.childNodes), function(node) {
+								if (isValid(forcedRootBlock, node.nodeName.toLowerCase())) {
+									if (!rootBlockElm)
+										rootBlockElm = wrap(node, forcedRootBlock);
+									else
+										rootBlockElm.appendChild(node);
+								} else
+									rootBlockElm = 0;
+							});
+						}
+					}
+				}
+			}
+
+			// Never remove nodes that isn't the specified inline element if a selector is specified too
+			if (format.selector && format.inline && !isEq(format.inline, node))
+				return;
+
+			dom.remove(node, 1);
 		};
 
-		for (n in s)
-			this.settings[n] = s[n];
+		function getNonWhiteSpaceSibling(node, next, inc) {
+			if (node) {
+				next = next ? 'nextSibling' : 'previousSibling';
 
-		this.create('div', this.settings.menu_class);
-	},
+				for (node = inc ? node : node[next]; node; node = node[next]) {
+					if (node.nodeType == 1 || !isWhiteSpaceNode(node))
+						return node;
+				}
+			}
+		};
 
-	clear : function() {
-		this.items = [];
-	},
+		function isBookmarkNode(node) {
+			return node && node.nodeType == 1 && node.getAttribute('_mce_type') == 'bookmark';
+		};
 
-	addTitle : function(t) {
-		this.add({type : 'title', text : t});
-	},
+		function mergeSiblings(prev, next) {
+			var marker, sibling, tmpSibling;
 
-	addDisabled : function(t) {
-		this.add({type : 'disabled', text : t});
-	},
+			function compareElements(node1, node2) {
+				// Not the same name
+				if (node1.nodeName != node2.nodeName)
+					return FALSE;
 
-	addSeparator : function() {
-		this.add({type : 'separator'});
-	},
+				function getAttribs(node) {
+					var attribs = {};
 
-	addItem : function(t, js) {
-		this.add({text : t, js : js});
-	},
+					each(dom.getAttribs(node), function(attr) {
+						var name = attr.nodeName.toLowerCase();
 
-	add : function(mi) {
-		this.items[this.items.length] = mi;
-		this.needsUpdate = true;
-	},
+						// Don't compare internal attributes or style
+						if (name.indexOf('_') !== 0 && name !== 'style')
+							attribs[name] = dom.getAttrib(node, name);
+					});
 
-	update : function() {
-		var e = this.getElement(), h = '', i, t, m = this.items, s = this.settings;
+					return attribs;
+				};
 
-		if (this.settings.drop_menu)
-			h += '<span class="mceMenuLine"></span>';
+				function compareObjects(obj1, obj2) {
+					var value, name;
 
-		h += '<table border="0" cellpadding="0" cellspacing="0">';
+					for (name in obj1) {
+						// Obj1 has item obj2 doesn't have
+						if (obj1.hasOwnProperty(name)) {
+							value = obj2[name];
 
-		for (i=0; i<m.length; i++) {
-			t = tinyMCE.xmlEncode(m[i].text);
-			c = m[i].class_name ? ' class="' + m[i].class_name + '"' : '';
+							// Obj2 doesn't have obj1 item
+							if (value === undefined)
+								return FALSE;
 
-			switch (m[i].type) {
-				case 'separator':
-					h += '<tr class="' + s.separator_class + '"><td>';
-					break;
+							// Obj2 item has a different value
+							if (obj1[name] != value)
+								return FALSE;
 
-				case 'title':
-					h += '<tr class="' + s.title_class + '"><td><span' + c +'>' + t + '</span>';
-					break;
+							// Delete similar value
+							delete obj2[name];
+						}
+					}
 
-				case 'disabled':
-					h += '<tr class="' + s.disabled_class + '"><td><span' + c +'>' + t + '</span>';
-					break;
+					// Check if obj 2 has something obj 1 doesn't have
+					for (name in obj2) {
+						// Obj2 has item obj1 doesn't have
+						if (obj2.hasOwnProperty(name))
+							return FALSE;
+					}
 
-				default:
-					h += '<tr><td><a href="' + tinyMCE.xmlEncode(m[i].js) + '" onmousedown="' + tinyMCE.xmlEncode(m[i].js) + ';return tinyMCE.cancelEvent(event);" onclick="return tinyMCE.cancelEvent(event);" onmouseup="return tinyMCE.cancelEvent(event);"><span' + c +'>' + t + '</span></a>';
+					return TRUE;
+				};
+
+				// Attribs are not the same
+				if (!compareObjects(getAttribs(node1), getAttribs(node2)))
+					return FALSE;
+
+				// Styles are not the same
+				if (!compareObjects(dom.parseStyle(dom.getAttrib(node1, 'style')), dom.parseStyle(dom.getAttrib(node2, 'style'))))
+					return FALSE;
+
+				return TRUE;
+			};
+
+			// Check if next/prev exists and that they are elements
+			if (prev && next) {
+				function findElementSibling(node, sibling_name) {
+					for (sibling = node; sibling; sibling = sibling[sibling_name]) {
+						if (sibling.nodeType == 3 && !isWhiteSpaceNode(sibling))
+							return node;
+
+						if (sibling.nodeType == 1 && !isBookmarkNode(sibling))
+							return sibling;
+					}
+
+					return node;
+				};
+
+				// If previous sibling is empty then jump over it
+				prev = findElementSibling(prev, 'previousSibling');
+				next = findElementSibling(next, 'nextSibling');
+
+				// Compare next and previous nodes
+				if (compareElements(prev, next)) {
+					// Append nodes between
+					for (sibling = prev.nextSibling; sibling && sibling != next;) {
+						tmpSibling = sibling;
+						sibling = sibling.nextSibling;
+						prev.appendChild(tmpSibling);
+					}
+
+					// Remove next node
+					dom.remove(next);
+
+					// Move children into prev node
+					each(tinymce.grep(next.childNodes), function(node) {
+						prev.appendChild(node);
+					});
+
+					return prev;
+				}
 			}
 
-			h += '</td></tr>';
-		}
+			return next;
+		};
 
-		h += '</table>';
+		function isTextBlock(name) {
+			return /^(h[1-6]|p|div|pre|address|dl|dt|dd)$/.test(name);
+		};
 
-		e.innerHTML = h;
+		function getContainer(rng, start) {
+			var container, offset, lastIdx;
 
-		this.needsUpdate = false;
-		this.updateBlocker();
-	},
+			container = rng[start ? 'startContainer' : 'endContainer'];
+			offset = rng[start ? 'startOffset' : 'endOffset'];
 
-	show : function() {
-		var nl, i;
+			if (container.nodeType == 1) {
+				lastIdx = container.childNodes.length - 1;
 
-		if (tinyMCE.lastMenu == this)
-			return;
+				if (!start && offset)
+					offset--;
 
-		if (this.needsUpdate)
-			this.update();
+				container = container.childNodes[offset > lastIdx ? lastIdx : offset];
+			}
 
-		if (tinyMCE.lastMenu && tinyMCE.lastMenu != this)
-			tinyMCE.lastMenu.hide();
+			return container;
+		};
 
-		TinyMCE_Layer.prototype.show.call(this);
+		function performCaretAction(type, name, vars) {
+			var i, currentPendingFormats = pendingFormats[type],
+				otherPendingFormats = pendingFormats[type == 'apply' ? 'remove' : 'apply'];
 
-		if (!tinyMCE.isOpera) {
-			// Accessibility stuff
-/*			nl = this.getElement().getElementsByTagName("a");
-			if (nl.length > 0)
-				nl[0].focus();*/
-		}
+			function hasPending() {
+				return pendingFormats.apply.length || pendingFormats.remove.length;
+			};
 
-		tinyMCE.lastMenu = this;
-	}
+			function resetPending() {
+				pendingFormats.apply = [];
+				pendingFormats.remove = [];
+			};
 
-	});
+			function perform(caret_node) {
+				// Apply pending formats
+				each(pendingFormats.apply.reverse(), function(item) {
+					apply(item.name, item.vars, caret_node);
+				});
 
-/* file:jscripts/tiny_mce/classes/TinyMCE_Debug.class.js */
+				// Remove pending formats
+				each(pendingFormats.remove.reverse(), function(item) {
+					remove(item.name, item.vars, caret_node);
+				});
 
-tinyMCE.add(TinyMCE_Engine, {
-	debug : function() {
-		var m = "", a, i, l = tinyMCE.log.length;
+				dom.remove(caret_node, 1);
+				resetPending();
+			};
 
-		for (i=0, a = this.debug.arguments; i<a.length; i++) {
-			m += a[i];
+			// Check if it already exists then ignore it
+			for (i = currentPendingFormats.length - 1; i >= 0; i--) {
+				if (currentPendingFormats[i].name == name)
+					return;
+			}
 
-			if (i<a.length-1)
-				m += ', ';
-		}
+			currentPendingFormats.push({name : name, vars : vars});
 
-		if (l < 1000)
-			tinyMCE.log[l] = "[debug] " + m;
+			// Check if it's in the other type, then remove it
+			for (i = otherPendingFormats.length - 1; i >= 0; i--) {
+				if (otherPendingFormats[i].name == name)
+					otherPendingFormats.splice(i, 1);
+			}
+
+			// Pending apply or remove formats
+			if (hasPending()) {
+				ed.getDoc().execCommand('FontName', false, 'mceinline');
+				pendingFormats.lastRng = selection.getRng();
+
+				// IE will convert the current word
+				each(dom.select('font,span'), function(node) {
+					var bookmark;
+
+					if (isCaretNode(node)) {
+						bookmark = selection.getBookmark();
+						perform(node);
+						selection.moveToBookmark(bookmark);
+						ed.nodeChanged();
+					}
+				});
+
+				// Only register listeners once if we need to
+				if (!pendingFormats.isListening && hasPending()) {
+					pendingFormats.isListening = true;
+
+					each('onKeyDown,onKeyUp,onKeyPress,onMouseUp'.split(','), function(event) {
+						ed[event].addToTop(function(ed, e) {
+							// Do we have pending formats and is the selection moved has moved
+							if (hasPending() && !tinymce.dom.RangeUtils.compareRanges(pendingFormats.lastRng, selection.getRng())) {
+								each(dom.select('font,span'), function(node) {
+									var textNode, rng;
+
+									// Look for marker
+									if (isCaretNode(node)) {
+										textNode = node.firstChild;
+
+										if (textNode) {
+											perform(node);
+
+											rng = dom.createRng();
+											rng.setStart(textNode, textNode.nodeValue.length);
+											rng.setEnd(textNode, textNode.nodeValue.length);
+											selection.setRng(rng);
+											ed.nodeChanged();
+										} else
+											dom.remove(node);
+									}
+								});
+
+								// Always unbind and clear pending styles on keyup
+								if (e.type == 'keyup' || e.type == 'mouseup')
+									resetPending();
+							}
+						});
+					});
+				}
+			}
+		};
+	};
+})(tinymce);
+
+tinymce.onAddEditor.add(function(tinymce, ed) {
+	var filters, fontSizes, dom, settings = ed.settings;
+
+	if (settings.inline_styles) {
+		fontSizes = tinymce.explode(settings.font_size_style_values);
+
+		function replaceWithSpan(node, styles) {
+			tinymce.each(styles, function(value, name) {
+				if (value)
+					dom.setStyle(node, name, value);
+			});
+
+			dom.rename(node, 'span');
+		};
+
+		filters = {
+			font : function(dom, node) {
+				replaceWithSpan(node, {
+					backgroundColor : node.style.backgroundColor,
+					color : node.color,
+					fontFamily : node.face,
+					fontSize : fontSizes[parseInt(node.size) - 1]
+				});
+			},
+
+			u : function(dom, node) {
+				replaceWithSpan(node, {
+					textDecoration : 'underline'
+				});
+			},
+
+			strike : function(dom, node) {
+				replaceWithSpan(node, {
+					textDecoration : 'line-through'
+				});
+			}
+		};
+
+		function convert(editor, params) {
+			dom = editor.dom;
+
+			if (settings.convert_fonts_to_spans) {
+				tinymce.each(dom.select('font,u,strike', params.node), function(node) {
+					filters[node.nodeName.toLowerCase()](ed.dom, node);
+				});
+			}
+		};
+
+		ed.onPreProcess.add(convert);
+
+		ed.onInit.add(function() {
+			ed.selection.onSetContent.add(convert);
+		});
 	}
+});
 
-	});
-

Modified: plog/branches/lifetype-1.2/js/tinymce/utils/editable_selects.js
===================================================================
--- plog/branches/lifetype-1.2/js/tinymce/utils/editable_selects.js	2010-09-21 21:29:55 UTC (rev 7026)
+++ plog/branches/lifetype-1.2/js/tinymce/utils/editable_selects.js	2010-09-21 23:00:22 UTC (rev 7027)
@@ -1,10 +1,11 @@
 /**
- * $Id: editable_selects.js 162 2007-01-03 16:16:52Z spocke $
+ * editable_selects.js
  *
- * Makes select boxes editable.
+ * Copyright 2009, Moxiecode Systems AB
+ * Released under LGPL License.
  *
- * @author Moxiecode
- * @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved.
+ * License: http://tinymce.moxiecode.com/license
+ * Contributing: http://tinymce.moxiecode.com/contributing
  */
 
 var TinyMCE_EditableSelects = {
@@ -20,13 +21,13 @@
 				o.className = 'mceAddSelectValue';
 
 				nl[i].options[nl[i].options.length] = o;
-				nl[i].setAttribute('onchange', 'TinyMCE_EditableSelects.onChangeEditableSelect(this);');
+				nl[i].onchange = TinyMCE_EditableSelects.onChangeEditableSelect;
 			}
 		}
 	},
 
-	onChangeEditableSelect : function(se) {
-		var d = document, ne;
+	onChangeEditableSelect : function(e) {
+		var d = document, ne, se = window.event ? window.event.srcElement : e.target;
 
 		if (se.options[se.selectedIndex].value == '__mce_add_custom__') {
 			ne = d.createElement("input");
@@ -34,11 +35,12 @@
 			ne.name = se.name + "_custom";
 			ne.type = "text";
 
-			ne.style.width = se.clientWidth;
+			ne.style.width = se.offsetWidth + 'px';
 			se.parentNode.insertBefore(ne, se);
 			se.style.display = 'none';
 			ne.focus();
 			ne.onblur = TinyMCE_EditableSelects.onBlurEditableSelectInput;
+			ne.onkeydown = TinyMCE_EditableSelects.onKeyDown;
 			TinyMCE_EditableSelects.editSelectElm = se;
 		}
 	},
@@ -57,5 +59,12 @@
 			se.parentNode.removeChild(se.previousSibling);
 			TinyMCE_EditableSelects.editSelectElm = null;
 		}
+	},
+
+	onKeyDown : function(e) {
+		e = e || window.event;
+
+		if (e.keyCode == 13)
+			TinyMCE_EditableSelects.onBlurEditableSelectInput();
 	}
 };

Modified: plog/branches/lifetype-1.2/js/tinymce/utils/form_utils.js
===================================================================
--- plog/branches/lifetype-1.2/js/tinymce/utils/form_utils.js	2010-09-21 21:29:55 UTC (rev 7026)
+++ plog/branches/lifetype-1.2/js/tinymce/utils/form_utils.js	2010-09-21 23:00:22 UTC (rev 7027)
@@ -1,33 +1,24 @@
 /**
- * $Id: form_utils.js 162 2007-01-03 16:16:52Z spocke $
+ * form_utils.js
  *
- * Various form utilitiy functions.
+ * Copyright 2009, Moxiecode Systems AB
+ * Released under LGPL License.
  *
- * @author Moxiecode
- * @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved.
+ * License: http://tinymce.moxiecode.com/license
+ * Contributing: http://tinymce.moxiecode.com/contributing
  */
 
-var themeBaseURL = tinyMCE.baseURL + '/themes/' + tinyMCE.getParam("theme");
+var themeBaseURL = tinyMCEPopup.editor.baseURI.toAbsolute('themes/' + tinyMCEPopup.getParam("theme"));
 
 function getColorPickerHTML(id, target_form_element) {
 	var h = "";
 
-	h += '<a id="' + id + '_link" href="javascript:void(0);" onkeydown="pickColor(event,\'' + target_form_element +'\');" onmousedown="pickColor(event,\'' + target_form_element +'\');return false;">';
-	h += '<img id="' + id + '" src="' + themeBaseURL + '/images/color.gif"';
-	h += ' onmouseover="this.className=\'mceButtonOver\'"';
-	h += ' onmouseout="this.className=\'mceButtonNormal\'"';
-	h += ' onmousedown="this.className=\'mceButtonDown\'"';
-	h += ' width="20" height="16" border="0" title="' + tinyMCE.getLang('lang_browse') + '"';
-	h += ' class="mceButtonNormal" alt="' + tinyMCE.getLang('lang_browse') + '" /></a>';
+	h += '<a id="' + id + '_link" href="javascript:;" onclick="tinyMCEPopup.pickColor(event,\'' + target_form_element +'\');" onmousedown="return false;" class="pickcolor">';
+	h += '<span id="' + id + '" title="' + tinyMCEPopup.getLang('browse') + '">&nbsp;</span></a>';
 
 	return h;
 }
 
-function pickColor(e, target_form_element) {
-	if ((e.keyCode == 32 || e.keyCode == 13) || e.type == "mousedown")
-		tinyMCEPopup.pickColor(e, target_form_element);
-}
-
 function updateColor(img_id, form_element_id) {
 	document.getElementById(img_id).style.backgroundColor = document.forms[0].elements[form_element_id].value;
 }
@@ -40,34 +31,32 @@
 		if (state) {
 			lnk.setAttribute("realhref", lnk.getAttribute("href"));
 			lnk.removeAttribute("href");
-			tinyMCE.switchClass(img, 'mceButtonDisabled', true);
+			tinyMCEPopup.dom.addClass(img, 'disabled');
 		} else {
-			lnk.setAttribute("href", lnk.getAttribute("realhref"));
-			tinyMCE.switchClass(img, 'mceButtonNormal', false);
+			if (lnk.getAttribute("realhref"))
+				lnk.setAttribute("href", lnk.getAttribute("realhref"));
+
+			tinyMCEPopup.dom.removeClass(img, 'disabled');
 		}
 	}
 }
 
 function getBrowserHTML(id, target_form_element, type, prefix) {
-	var option = prefix + "_" + type + "_browser_callback";
-	var cb = tinyMCE.getParam(option, tinyMCE.getParam("file_browser_callback"));
-	if (cb == null)
-		return "";
+	var option = prefix + "_" + type + "_browser_callback", cb, html;
 
-	var html = "";
+	cb = tinyMCEPopup.getParam(option, tinyMCEPopup.getParam("file_browser_callback"));
 
-	html += '<a id="' + id + '_link" href="javascript:openBrower(\'' + id + '\',\'' + target_form_element + '\', \'' + type + '\',\'' + option + '\');" onmousedown="return false;">';
-	html += '<img id="' + id + '" src="' + themeBaseURL + '/images/browse.gif"';
-	html += ' onmouseover="this.className=\'mceButtonOver\';"';
-	html += ' onmouseout="this.className=\'mceButtonNormal\';"';
-	html += ' onmousedown="this.className=\'mceButtonDown\';"';
-	html += ' width="20" height="18" border="0" title="' + tinyMCE.getLang('lang_browse') + '"';
-	html += ' class="mceButtonNormal" alt="' + tinyMCE.getLang('lang_browse') + '" /></a>';
+	if (!cb)
+		return "";
 
+	html = "";
+	html += '<a id="' + id + '_link" href="javascript:openBrowser(\'' + id + '\',\'' + target_form_element + '\', \'' + type + '\',\'' + option + '\');" onmousedown="return false;" class="browse">';
+	html += '<span id="' + id + '" title="' + tinyMCEPopup.getLang('browse') + '">&nbsp;</span></a>';
+
 	return html;
 }
 
-function openBrower(img_id, target_form_element, type, option) {
+function openBrowser(img_id, target_form_element, type, option) {
 	var img = document.getElementById(img_id);
 
 	if (img.className != "mceButtonDisabled")
@@ -104,7 +93,7 @@
 function getSelectValue(form_obj, field_name) {
 	var elm = form_obj.elements[field_name];
 
-	if (elm == null || elm.options == null)
+	if (elm == null || elm.options == null || elm.selectedIndex === -1)
 		return "";
 
 	return elm.options[elm.selectedIndex].value;
@@ -119,8 +108,8 @@
 function addClassesToList(list_id, specific_option) {
 	// Setup class droplist
 	var styleSelectElm = document.getElementById(list_id);
-	var styles = tinyMCE.getParam('theme_advanced_styles', false);
-	styles = tinyMCE.getParam(specific_option, styles);
+	var styles = tinyMCEPopup.getParam('theme_advanced_styles', false);
+	styles = tinyMCEPopup.getParam(specific_option, styles);
 
 	if (styles) {
 		var stylesAr = styles.split(';');
@@ -136,10 +125,9 @@
 			}
 		}
 	} else {
-		// Use auto impored classes
-		var csses = tinyMCE.getCSSClasses(tinyMCE.getWindowArg('editor_id'));
-		for (var i=0; i<csses.length; i++)
-			styleSelectElm.options[styleSelectElm.length] = new Option(csses[i], csses[i]);
+		tinymce.each(tinyMCEPopup.editor.dom.getClasses(), function(o) {
+			styleSelectElm.options[styleSelectElm.length] = new Option(o.title || o['class'], o['class']);
+		});
 	}
 }
 
@@ -183,7 +171,7 @@
 }
 
 function trimSize(size) {
-	return size.replace(new RegExp('[^0-9%]', 'gi'), '');
+	return size.replace(/([0-9\.]+)px|(%|in|cm|mm|em|ex|pt|pc)/, '$1$2');
 }
 
 function getCSSSize(size) {
@@ -192,11 +180,15 @@
 	if (size == "")
 		return "";
 
-	return size.indexOf('%') != -1 ? size : size + "px";
+	// Add px
+	if (/^[0-9]+$/.test(size))
+		size += 'px';
+
+	return size;
 }
 
 function getStyle(elm, attrib, style) {
-	var val = tinyMCE.getAttrib(elm, attrib);
+	var val = tinyMCEPopup.dom.getAttrib(elm, attrib);
 
 	if (val != '')
 		return '' + val;
@@ -204,7 +196,5 @@
 	if (typeof(style) == 'undefined')
 		style = attrib;
 
-	val = eval('elm.style.' + style);
-
-	return val == null ? '' : '' + val;
+	return tinyMCEPopup.dom.getStyle(elm, style);
 }

Deleted: plog/branches/lifetype-1.2/js/tinymce/utils/mclayer.js
===================================================================
--- plog/branches/lifetype-1.2/js/tinymce/utils/mclayer.js	2010-09-21 21:29:55 UTC (rev 7026)
+++ plog/branches/lifetype-1.2/js/tinymce/utils/mclayer.js	2010-09-21 23:00:22 UTC (rev 7027)
@@ -1,210 +0,0 @@
-/**
- * $Id: mclayer.js 162 2007-01-03 16:16:52Z spocke $
- *
- * Moxiecode floating layer script.
- *
- * @author Moxiecode
- * @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved.
- */
-
-function MCLayer(id) {
-	this.id = id;
-	this.settings = new Array();
-	this.blockerElement = null;
-	this.isMSIE = navigator.appName == "Microsoft Internet Explorer";
-	this.events = false;
-	this.autoHideCallback = null;
-}
-
-MCLayer.prototype = {
-	moveRelativeTo : function(re, p, a) {
-		var rep = this.getAbsPosition(re);
-		var w = parseInt(re.offsetWidth);
-		var h = parseInt(re.offsetHeight);
-		var x, y;
-
-		switch (p) {
-			case "tl":
-				break;
-
-			case "tr":
-				x = rep.absLeft + w;
-				y = rep.absTop;
-				break;
-
-			case "bl":
-				break;
-
-			case "br":
-				break;
-		}
-
-		this.moveTo(x, y);
-	},
-
-	moveBy : function(dx, dy) {
-		var e = this.getElement();
-		var x = parseInt(e.style.left);
-		var y = parseInt(e.style.top);
-
-		e.style.left = (x + dx) + "px";
-		e.style.top = (y + dy) + "px";
-
-		this.updateBlocker();
-	},
-
-	moveTo : function(x, y) {
-		var e = this.getElement();
-
-		e.style.left = x + "px";
-		e.style.top = y + "px";
-
-		this.updateBlocker();
-	},
-
-	show : function() {
-		MCLayer.visibleLayer = this;
-
-		this.getElement().style.display = 'block';
-		this.updateBlocker();
-	},
-
-	hide : function() {
-		this.getElement().style.display = 'none';
-		this.updateBlocker();
-	},
-
-	setAutoHide : function(s, cb) {
-		this.autoHideCallback = cb;
-		this.registerEventHandlers();
-	},
-
-	getElement : function() {
-		return document.getElementById(this.id);
-	},
-
-	updateBlocker : function() {
-		if (!this.isMSIE)
-			return;
-
-		var e = this.getElement();
-		var b = this.getBlocker();
-		var x = this.parseInt(e.style.left);
-		var y = this.parseInt(e.style.top);
-		var w = this.parseInt(e.offsetWidth);
-		var h = this.parseInt(e.offsetHeight);
-
-		b.style.left = x + 'px';
-		b.style.top = y + 'px';
-		b.style.width = w + 'px';
-		b.style.height = h + 'px';
-		b.style.display = e.style.display;
-	},
-
-	getBlocker : function() {
-		if (!this.blockerElement) {
-			var d = document, b = d.createElement("iframe");
-
-			b.style.cssText = 'display: none; left: 0px; position: absolute; top: 0';
-			b.src = 'javascript:false;';
-			b.frameBorder = '0';
-			b.scrolling = 'no';
-
-			d.body.appendChild(b);
-			this.blockerElement = b;
-		}
-
-		return this.blockerElement;
-	},
-
-	getAbsPosition : function(n) {
-		var p = {absLeft : 0, absTop : 0};
-
-		while (n) {
-			p.absLeft += n.offsetLeft;
-			p.absTop += n.offsetTop;
-			n = n.offsetParent;
-		}
-
-		return p;
-	},
-
-	registerEventHandlers : function() {
-		if (!this.events) {
-			var d = document;
-
-			this.addEvent(d, 'mousedown', MCLayer.prototype.onMouseDown);
-
-			this.events = true;
-		}
-	},
-
-	addEvent : function(o, n, h) {
-		if (o.attachEvent)
-			o.attachEvent("on" + n, h);
-		else
-			o.addEventListener(n, h, false);
-	},
-
-	onMouseDown : function(e) {
-		e = typeof(e) == "undefined" ? window.event : e;
-		var b = document.body;
-		var l = MCLayer.visibleLayer;
-
-		if (l) {
-			var mx = l.isMSIE ? e.clientX + b.scrollLeft : e.pageX;
-			var my = l.isMSIE ? e.clientY + b.scrollTop : e.pageY;
-			var el = l.getElement();
-			var x = parseInt(el.style.left);
-			var y = parseInt(el.style.top);
-			var w = parseInt(el.offsetWidth);
-			var h = parseInt(el.offsetHeight);
-
-			if (!(mx > x && mx < x + w && my > y && my < y + h)) {
-				MCLayer.visibleLayer = null;
-
-				if (l.autoHideCallback && l.autoHideCallback(l, e, mx, my))
-					return true;
-
-				l.hide();
-			}
-		}
-	},
-
-	addCSSClass : function(e, c) {
-		this.removeCSSClass(e, c);
-		var a = this.explode(' ', e.className);
-		a[a.length] = c;
-		e.className = a.join(' ');
-	},
-
-	removeCSSClass : function(e, c) {
-		var a = this.explode(' ', e.className), i;
-
-		for (i=0; i<a.length; i++) {
-			if (a[i] == c)
-				a[i] = '';
-		}
-
-		e.className = a.join(' ');
-	},
-
-	explode : function(d, s) {
-		var ar = s.split(d);
-		var oar = new Array();
-
-		for (var i = 0; i<ar.length; i++) {
-			if (ar[i] != "")
-				oar[oar.length] = ar[i];
-		}
-
-		return oar;
-	},
-
-	parseInt : function(s) {
-		if (s == null || s == '')
-			return 0;
-
-		return parseInt(s);
-	}
-}

Modified: plog/branches/lifetype-1.2/js/tinymce/utils/mctabs.js
===================================================================
--- plog/branches/lifetype-1.2/js/tinymce/utils/mctabs.js	2010-09-21 21:29:55 UTC (rev 7026)
+++ plog/branches/lifetype-1.2/js/tinymce/utils/mctabs.js	2010-09-21 23:00:22 UTC (rev 7027)
@@ -1,14 +1,15 @@
 /**
- * $Id: mctabs.js 162 2007-01-03 16:16:52Z spocke $
+ * mctabs.js
  *
- * Moxiecode DHTML Tabs script.
+ * Copyright 2009, Moxiecode Systems AB
+ * Released under LGPL License.
  *
- * @author Moxiecode
- * @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved.
+ * License: http://tinymce.moxiecode.com/license
+ * Contributing: http://tinymce.moxiecode.com/contributing
  */
 
 function MCTabs() {
-	this.settings = new Array();
+	this.settings = [];
 };
 
 MCTabs.prototype.init = function(settings) {
@@ -28,17 +29,19 @@
 };
 
 MCTabs.prototype.displayTab = function(tab_id, panel_id) {
-	var panelElm = document.getElementById(panel_id);
-	var panelContainerElm = panelElm ? panelElm.parentNode : null;
-	var tabElm = document.getElementById(tab_id);
-	var tabContainerElm = tabElm ? tabElm.parentNode : null;
-	var selectionClass = this.getParam('selection_class', 'current');
+	var panelElm, panelContainerElm, tabElm, tabContainerElm, selectionClass, nodes, i;
 
+	panelElm= document.getElementById(panel_id);
+	panelContainerElm = panelElm ? panelElm.parentNode : null;
+	tabElm = document.getElementById(tab_id);
+	tabContainerElm = tabElm ? tabElm.parentNode : null;
+	selectionClass = this.getParam('selection_class', 'current');
+
 	if (tabElm && tabContainerElm) {
-		var nodes = tabContainerElm.childNodes;
+		nodes = tabContainerElm.childNodes;
 
 		// Hide all other tabs
-		for (var i=0; i<nodes.length; i++) {
+		for (i = 0; i < nodes.length; i++) {
 			if (nodes[i].nodeName == "LI")
 				nodes[i].className = '';
 		}
@@ -48,10 +51,10 @@
 	}
 
 	if (panelElm && panelContainerElm) {
-		var nodes = panelContainerElm.childNodes;
+		nodes = panelContainerElm.childNodes;
 
 		// Hide all other panels
-		for (var i=0; i<nodes.length; i++) {
+		for (i = 0; i < nodes.length; i++) {
 			if (nodes[i].nodeName == "DIV")
 				nodes[i].className = 'panel';
 		}

Modified: plog/branches/lifetype-1.2/js/tinymce/utils/validate.js
===================================================================
--- plog/branches/lifetype-1.2/js/tinymce/utils/validate.js	2010-09-21 21:29:55 UTC (rev 7026)
+++ plog/branches/lifetype-1.2/js/tinymce/utils/validate.js	2010-09-21 23:00:22 UTC (rev 7027)
@@ -1,10 +1,11 @@
 /**
- * $Id: validate.js 162 2007-01-03 16:16:52Z spocke $
+ * validate.js
  *
- * Various form validation methods.
+ * Copyright 2009, Moxiecode Systems AB
+ * Released under LGPL License.
  *
- * @author Moxiecode
- * @copyright Copyright © 2004-2007, Moxiecode Systems AB, All rights reserved.
+ * License: http://tinymce.moxiecode.com/license
+ * Contributing: http://tinymce.moxiecode.com/contributing
  */
 
 /**
@@ -31,7 +32,7 @@
 	},
 
 	isSize : function(s) {
-		return this.test(s, '^[0-9]+(px|%)?$');
+		return this.test(s, '^[0-9]+(%|in|cm|mm|em|ex|pt|pc|px)?$');
 	},
 
 	isId : function(s) {
@@ -110,7 +111,7 @@
 	},
 
 	reset : function(e) {
-		var t = new Array('label', 'input', 'select', 'textarea');
+		var t = ['label', 'input', 'select', 'textarea'];
 		var i, j, nl, s = this.settings;
 
 		if (e == null)



More information about the pLog-svn mailing list