Index: wp-includes/js/tinymce/plugins/media/editor_plugin.dev.js
===================================================================
--- wp-includes/js/tinymce/plugins/media/editor_plugin.dev.js	(revision 0)
+++ wp-includes/js/tinymce/plugins/media/editor_plugin.dev.js	(revision 0)
@@ -0,0 +1,890 @@
+/**
+ * editor_plugin_src.js
+ *
+ * Copyright 2009, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://tinymce.moxiecode.com/license
+ * Contributing: http://tinymce.moxiecode.com/contributing
+ */
+
+(function() {
+	var rootAttributes = tinymce.explode('id,name,width,height,style,align,class,hspace,vspace,bgcolor,type'), excludedAttrs = tinymce.makeMap(rootAttributes.join(',')), Node = tinymce.html.Node,
+		mediaTypes, scriptRegExp, JSON = tinymce.util.JSON, mimeTypes;
+
+	// Media types supported by this plugin
+	mediaTypes = [
+		// Type, clsid:s, mime types, codebase
+		["Flash", "d27cdb6e-ae6d-11cf-96b8-444553540000", "application/x-shockwave-flash", "http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"],
+		["ShockWave", "166b1bca-3f9c-11cf-8075-444553540000", "application/x-director", "http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,1,0"],
+		["WindowsMedia", "6bf52a52-394a-11d3-b153-00c04f79faa6,22d6f312-b0f6-11d0-94ab-0080c74c7e95,05589fa1-c356-11ce-bf01-00aa0055595a", "application/x-mplayer2", "http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701"],
+		["QuickTime", "02bf25d5-8c17-4b23-bc80-d3488abddc6b", "video/quicktime", "http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0"],
+		["RealMedia", "cfcdaa03-8be4-11cf-b84b-0020afbbccfa", "audio/x-pn-realaudio-plugin", "http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"],
+		["Java", "8ad9c840-044e-11d1-b3e9-00805f499d93", "application/x-java-applet", "http://java.sun.com/products/plugin/autodl/jinstall-1_5_0-windows-i586.cab#Version=1,5,0,0"],
+		["Silverlight", "dfeaf541-f3e1-4c24-acac-99c30715084a", "application/x-silverlight-2"],
+		["Iframe"],
+		["Video"],
+		["EmbeddedAudio"],
+		["Audio"]
+	];
+
+	function toArray(obj) {
+		var undef, out, i;
+
+		if (obj && !obj.splice) {
+			out = [];
+
+			for (i = 0; true; i++) {
+				if (obj[i])
+					out[i] = obj[i];
+				else
+					break;
+			}
+
+			return out;
+		}
+
+		return obj;
+	};
+
+	tinymce.create('tinymce.plugins.MediaPlugin', {
+		init : function(ed, url) {
+			var self = this, lookup = {}, i, y, item, name;
+
+			function isMediaImg(node) {
+				return node && node.nodeName === 'IMG' && ed.dom.hasClass(node, 'mceItemMedia');
+			};
+
+			self.editor = ed;
+			self.url = url;
+
+			// Parse media types into a lookup table
+			scriptRegExp = '';
+			for (i = 0; i < mediaTypes.length; i++) {
+				name = mediaTypes[i][0];
+
+				item = {
+					name : name,
+					clsids : tinymce.explode(mediaTypes[i][1] || ''),
+					mimes : tinymce.explode(mediaTypes[i][2] || ''),
+					codebase : mediaTypes[i][3]
+				};
+
+				for (y = 0; y < item.clsids.length; y++)
+					lookup['clsid:' + item.clsids[y]] = item;
+
+				for (y = 0; y < item.mimes.length; y++)
+					lookup[item.mimes[y]] = item;
+
+				lookup['mceItem' + name] = item;
+				lookup[name.toLowerCase()] = item;
+
+				scriptRegExp += (scriptRegExp ? '|' : '') + name;
+			}
+
+			// Handle the media_types setting
+			tinymce.each(ed.getParam("media_types",
+				"video=mp4,m4v,ogv,webm;" +
+				"silverlight=xap;" +
+				"flash=swf,flv;" +
+				"shockwave=dcr;" +
+				"quicktime=mov,qt,mpg,mpeg;" +
+				"shockwave=dcr;" +
+				"windowsmedia=avi,wmv,wm,asf,asx,wmx,wvx;" +
+				"realmedia=rm,ra,ram;" +
+				"java=jar;" +
+				"audio=mp3,ogg"
+			).split(';'), function(item) {
+				var i, extensions, type;
+
+				item = item.split(/=/);
+				extensions = tinymce.explode(item[1].toLowerCase());
+				for (i = 0; i < extensions.length; i++) {
+					type = lookup[item[0].toLowerCase()];
+
+					if (type)
+						lookup[extensions[i]] = type;
+				}
+			});
+
+			scriptRegExp = new RegExp('write(' + scriptRegExp + ')\\(([^)]+)\\)');
+			self.lookup = lookup;
+
+			ed.onPreInit.add(function() {
+				// Allow video elements
+				ed.schema.addValidElements('object[id|style|width|height|classid|codebase|*],param[name|value],embed[id|style|width|height|type|src|*],video[*],audio[*],source[*]');
+
+				// Convert video elements to image placeholder
+				ed.parser.addNodeFilter('object,embed,video,audio,script,iframe', function(nodes) {
+					var i = nodes.length;
+
+					while (i--)
+						self.objectToImg(nodes[i]);
+				});
+
+				// Convert image placeholders to video elements
+				ed.serializer.addNodeFilter('img', function(nodes, name, args) {
+					var i = nodes.length, node;
+
+					while (i--) {
+						node = nodes[i];
+						if ((node.attr('class') || '').indexOf('mceItemMedia') !== -1)
+							self.imgToObject(node, args);
+					}
+				});
+			});
+
+			ed.onInit.add(function() {
+				// Display "media" instead of "img" in element path
+				if (ed.theme && ed.theme.onResolveName) {
+					ed.theme.onResolveName.add(function(theme, path_object) {
+						if (path_object.name === 'img' && ed.dom.hasClass(path_object.node, 'mceItemMedia'))
+							path_object.name = 'media';
+					});
+				}
+
+				// Add contect menu if it's loaded
+				if (ed && ed.plugins.contextmenu) {
+					ed.plugins.contextmenu.onContextMenu.add(function(plugin, menu, element) {
+						if (element.nodeName === 'IMG' && element.className.indexOf('mceItemMedia') !== -1)
+							menu.add({title : 'media.edit', icon : 'media', cmd : 'mceMedia'});
+					});
+				}
+			});
+
+			// Register commands
+			ed.addCommand('mceMedia', function() {
+				var data, img;
+
+				img = ed.selection.getNode();
+				if (isMediaImg(img)) {
+					data = ed.dom.getAttrib(img, 'data-mce-json');
+					if (data) {
+						data = JSON.parse(data);
+
+						// Add some extra properties to the data object
+						tinymce.each(rootAttributes, function(name) {
+							var value = ed.dom.getAttrib(img, name);
+
+							if (value)
+								data[name] = value;
+						});
+
+						data.type = self.getType(img.className).name.toLowerCase();
+					}
+				}
+
+				if (!data) {
+					data = {
+						type : 'flash',
+						video: {sources:[]},
+						params: {}
+					};
+				}
+
+				ed.windowManager.open({
+					file : url + '/media.htm',
+					width : 430 + parseInt(ed.getLang('media.delta_width', 0)),
+					height : 500 + parseInt(ed.getLang('media.delta_height', 0)),
+					inline : 1
+				}, {
+					plugin_url : url,
+					data : data
+				});
+			});
+
+			// Register buttons
+			ed.addButton('media', {title : 'media.desc', cmd : 'mceMedia'});
+
+			// Update media selection status
+			ed.onNodeChange.add(function(ed, cm, node) {
+				cm.setActive('media', isMediaImg(node));
+			});
+		},
+
+		convertUrl : function(url, force_absolute) {
+			var self = this, editor = self.editor, settings = editor.settings,
+				urlConverter = settings.url_converter,
+				urlConverterScope = settings.url_converter_scope || self;
+
+			if (!url)
+				return url;
+
+			if (force_absolute)
+				return editor.documentBaseURI.toAbsolute(url);
+
+			return urlConverter.call(urlConverterScope, url, 'src', 'object');
+		},
+
+		getInfo : function() {
+			return {
+				longname : 'Media',
+				author : 'Moxiecode Systems AB',
+				authorurl : 'http://tinymce.moxiecode.com',
+				infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/media',
+				version : tinymce.majorVersion + "." + tinymce.minorVersion
+			};
+		},
+
+		/**
+		 * Converts the JSON data object to an img node.
+		 */
+		dataToImg : function(data, force_absolute) {
+			var self = this, editor = self.editor, baseUri = editor.documentBaseURI, sources, attrs, img, i;
+
+			data.params.src = self.convertUrl(data.params.src, force_absolute);
+
+			attrs = data.video.attrs;
+			if (attrs)
+				attrs.src = self.convertUrl(attrs.src, force_absolute);
+
+			if (attrs)
+				attrs.poster = self.convertUrl(attrs.poster, force_absolute);
+
+			sources = toArray(data.video.sources);
+			if (sources) {
+				for (i = 0; i < sources.length; i++)
+					sources[i].src = self.convertUrl(sources[i].src, force_absolute);
+			}
+
+			img = self.editor.dom.create('img', {
+				id : data.id,
+				style : data.style,
+				align : data.align,
+				hspace : data.hspace,
+				vspace : data.vspace,
+				src : self.editor.theme.url + '/img/trans.gif',
+				'class' : 'mceItemMedia mceItem' + self.getType(data.type).name,
+				'data-mce-json' : JSON.serialize(data, "'")
+			});
+
+			img.width = data.width || (data.type == 'audio' ? "300" : "320");
+			img.height = data.height || (data.type == 'audio' ? "32" : "240");
+
+			return img;
+		},
+
+		/**
+		 * Converts the JSON data object to a HTML string.
+		 */
+		dataToHtml : function(data, force_absolute) {
+			return this.editor.serializer.serialize(this.dataToImg(data, force_absolute), {forced_root_block : '', force_absolute : force_absolute});
+		},
+
+		/**
+		 * Converts the JSON data object to a HTML string.
+		 */
+		htmlToData : function(html) {
+			var fragment, img, data;
+
+			data = {
+				type : 'flash',
+				video: {sources:[]},
+				params: {}
+			};
+
+			fragment = this.editor.parser.parse(html);
+			img = fragment.getAll('img')[0];
+
+			if (img) {
+				data = JSON.parse(img.attr('data-mce-json'));
+				data.type = this.getType(img.attr('class')).name.toLowerCase();
+
+				// Add some extra properties to the data object
+				tinymce.each(rootAttributes, function(name) {
+					var value = img.attr(name);
+
+					if (value)
+						data[name] = value;
+				});
+			}
+
+			return data;
+		},
+
+		/**
+		 * Get type item by extension, class, clsid or mime type.
+		 *
+		 * @method getType
+		 * @param {String} value Value to get type item by.
+		 * @return {Object} Type item object or undefined.
+		 */
+		getType : function(value) {
+			var i, values, typeItem;
+
+			// Find type by checking the classes
+			values = tinymce.explode(value, ' ');
+			for (i = 0; i < values.length; i++) {
+				typeItem = this.lookup[values[i]];
+
+				if (typeItem)
+					return typeItem;
+			}
+		},
+
+		/**
+		 * Converts a tinymce.html.Node image element to video/object/embed.
+		 */
+		imgToObject : function(node, args) {
+			var self = this, editor = self.editor, video, object, embed, iframe, name, value, data,
+				source, sources, params, param, typeItem, i, item, mp4Source, replacement,
+				posterSrc, style, audio;
+
+			// Adds the flash player
+			function addPlayer(video_src, poster_src) {
+				var baseUri, flashVars, flashVarsOutput, params, flashPlayer;
+
+				flashPlayer = editor.getParam('flash_video_player_url', self.convertUrl(self.url + '/moxieplayer.swf'));
+				if (flashPlayer) {
+					baseUri = editor.documentBaseURI;
+					data.params.src = flashPlayer;
+
+					// Convert the movie url to absolute urls
+					if (editor.getParam('flash_video_player_absvideourl', true)) {
+						video_src = baseUri.toAbsolute(video_src || '', true);
+						poster_src = baseUri.toAbsolute(poster_src || '', true);
+					}
+
+					// Generate flash vars
+					flashVarsOutput = '';
+					flashVars = editor.getParam('flash_video_player_flashvars', {url : '$url', poster : '$poster'});
+					tinymce.each(flashVars, function(value, name) {
+						// Replace $url and $poster variables in flashvars value
+						value = value.replace(/\$url/, video_src || '');
+						value = value.replace(/\$poster/, poster_src || '');
+
+						if (value.length > 0)
+							flashVarsOutput += (flashVarsOutput ? '&' : '') + name + '=' + escape(value);
+					});
+
+					if (flashVarsOutput.length)
+						data.params.flashvars = flashVarsOutput;
+
+					params = editor.getParam('flash_video_player_params', {
+						allowfullscreen: true,
+						allowscriptaccess: true
+					});
+
+					tinymce.each(params, function(value, name) {
+						data.params[name] = "" + value;
+					});
+				}
+			};
+
+			data = node.attr('data-mce-json');
+			if (!data)
+				return;
+
+			data = JSON.parse(data);
+			typeItem = this.getType(node.attr('class'));
+
+			style = node.attr('data-mce-style')
+			if (!style) {
+				style = node.attr('style');
+
+				if (style)
+					style = editor.dom.serializeStyle(editor.dom.parseStyle(style, 'img'));
+			}
+
+			// Handle iframe
+			if (typeItem.name === 'Iframe') {
+				replacement = new Node('iframe', 1);
+
+				tinymce.each(rootAttributes, function(name) {
+					var value = node.attr(name);
+
+					if (name == 'class' && value)
+						value = value.replace(/mceItem.+ ?/g, '');
+
+					if (value && value.length > 0)
+						replacement.attr(name, value);
+				});
+
+				for (name in data.params)
+					replacement.attr(name, data.params[name]);
+
+				replacement.attr({
+					style: style,
+					src: data.params.src
+				});
+
+				node.replace(replacement);
+
+				return;
+			}
+
+			// Handle scripts
+			if (this.editor.settings.media_use_script) {
+				replacement = new Node('script', 1).attr('type', 'text/javascript');
+
+				value = new Node('#text', 3);
+				value.value = 'write' + typeItem.name + '(' + JSON.serialize(tinymce.extend(data.params, {
+					width: node.attr('width'),
+					height: node.attr('height')
+				})) + ');';
+
+				replacement.append(value);
+				node.replace(replacement);
+
+				return;
+			}
+
+			// Add HTML5 video element
+			if (typeItem.name === 'Video' && data.video.sources[0]) {
+				// Create new object element
+				video = new Node('video', 1).attr(tinymce.extend({
+					id : node.attr('id'),
+					width: node.attr('width'),
+					height: node.attr('height'),
+					style : style
+				}, data.video.attrs));
+
+				// Get poster source and use that for flash fallback
+				if (data.video.attrs)
+					posterSrc = data.video.attrs.poster;
+
+				sources = data.video.sources = toArray(data.video.sources);
+				for (i = 0; i < sources.length; i++) {
+					if (/\.mp4$/.test(sources[i].src))
+						mp4Source = sources[i].src;
+				}
+
+				if (!sources[0].type) {
+					video.attr('src', sources[0].src);
+					sources.splice(0, 1);
+				}
+
+				for (i = 0; i < sources.length; i++) {
+					source = new Node('source', 1).attr(sources[i]);
+					source.shortEnded = true;
+					video.append(source);
+				}
+
+				// Create flash fallback for video if we have a mp4 source
+				if (mp4Source) {
+					addPlayer(mp4Source, posterSrc);
+					typeItem = self.getType('flash');
+				} else
+					data.params.src = '';
+			}
+
+			// Add HTML5 audio element
+			if (typeItem.name === 'Audio' && data.video.sources[0]) {
+				// Create new object element
+				audio = new Node('audio', 1).attr(tinymce.extend({
+					id : node.attr('id'),
+					width: node.attr('width'),
+					height: node.attr('height'),
+					style : style
+				}, data.video.attrs));
+
+				// Get poster source and use that for flash fallback
+				if (data.video.attrs)
+					posterSrc = data.video.attrs.poster;
+
+				sources = data.video.sources = toArray(data.video.sources);
+				if (!sources[0].type) {
+					audio.attr('src', sources[0].src);
+					sources.splice(0, 1);
+				}
+
+				for (i = 0; i < sources.length; i++) {
+					source = new Node('source', 1).attr(sources[i]);
+					source.shortEnded = true;
+					audio.append(source);
+				}
+
+				data.params.src = '';
+			}
+
+			if (typeItem.name === 'EmbeddedAudio') {
+				embed = new Node('embed', 1);
+				embed.shortEnded = true;
+				embed.attr({
+					id: node.attr('id'),
+					width: node.attr('width'),
+					height: node.attr('height'),
+					style : style,
+					type: node.attr('type')
+				});
+
+				for (name in data.params)
+					embed.attr(name, data.params[name]);
+
+				tinymce.each(rootAttributes, function(name) {
+					if (data[name] && name != 'type')
+						embed.attr(name, data[name]);
+				});
+
+				data.params.src = '';
+			}
+
+			// Do we have a params src then we can generate object
+			if (data.params.src) {
+				// Is flv movie add player for it
+				if (/\.flv$/i.test(data.params.src))
+					addPlayer(data.params.src, '');
+
+				if (args && args.force_absolute)
+					data.params.src = editor.documentBaseURI.toAbsolute(data.params.src);
+
+				// Create new object element
+				object = new Node('object', 1).attr({
+					id : node.attr('id'),
+					width: node.attr('width'),
+					height: node.attr('height'),
+					style : style
+				});
+
+				tinymce.each(rootAttributes, function(name) {
+					var value = data[name];
+
+					if (name == 'class' && value)
+						value = value.replace(/mceItem.+ ?/g, '');
+
+					if (value && name != 'type')
+						object.attr(name, value);
+				});
+
+				// Add params
+				for (name in data.params) {
+					param = new Node('param', 1);
+					param.shortEnded = true;
+					value = data.params[name];
+
+					// Windows media needs to use url instead of src for the media URL
+					if (name === 'src' && typeItem.name === 'WindowsMedia')
+						name = 'url';
+
+					param.attr({name: name, value: value});
+					object.append(param);
+				}
+
+				// Setup add type and classid if strict is disabled
+				if (this.editor.getParam('media_strict', true)) {
+					object.attr({
+						data: data.params.src,
+						type: typeItem.mimes[0]
+					});
+				} else {
+					object.attr({
+						classid: "clsid:" + typeItem.clsids[0],
+						codebase: typeItem.codebase
+					});
+
+					embed = new Node('embed', 1);
+					embed.shortEnded = true;
+					embed.attr({
+						id: node.attr('id'),
+						width: node.attr('width'),
+						height: node.attr('height'),
+						style : style,
+						type: typeItem.mimes[0]
+					});
+
+					for (name in data.params)
+						embed.attr(name, data.params[name]);
+
+					tinymce.each(rootAttributes, function(name) {
+						if (data[name] && name != 'type')
+							embed.attr(name, data[name]);
+					});
+
+					object.append(embed);
+				}
+
+				// Insert raw HTML
+				if (data.object_html) {
+					value = new Node('#text', 3);
+					value.raw = true;
+					value.value = data.object_html;
+					object.append(value);
+				}
+
+				// Append object to video element if it exists
+				if (video)
+					video.append(object);
+			}
+
+			if (video) {
+				// Insert raw HTML
+				if (data.video_html) {
+					value = new Node('#text', 3);
+					value.raw = true;
+					value.value = data.video_html;
+					video.append(value);
+				}
+			}
+
+			if (audio) {
+				// Insert raw HTML
+				if (data.video_html) {
+					value = new Node('#text', 3);
+					value.raw = true;
+					value.value = data.video_html;
+					audio.append(value);
+				}
+			}
+
+			var n = video || audio || object || embed;
+			if (n)
+				node.replace(n);
+			else
+				node.remove();
+		},
+
+		/**
+		 * Converts a tinymce.html.Node video/object/embed to an img element.
+		 *
+		 * The video/object/embed will be converted into an image placeholder with a JSON data attribute like this:
+		 * <img class="mceItemMedia mceItemFlash" width="100" height="100" data-mce-json="{..}" />
+		 *
+		 * The JSON structure will be like this:
+		 * {'params':{'flashvars':'something','quality':'high','src':'someurl'}, 'video':{'sources':[{src: 'someurl', type: 'video/mp4'}]}}
+		 */
+		objectToImg : function(node) {
+			var object, embed, video, iframe, img, name, id, width, height, style, i, html,
+				param, params, source, sources, data, type, lookup = this.lookup,
+				matches, attrs, urlConverter = this.editor.settings.url_converter,
+				urlConverterScope = this.editor.settings.url_converter_scope,
+				hspace, vspace, align, bgcolor;
+
+			function getInnerHTML(node) {
+				return new tinymce.html.Serializer({
+					inner: true,
+					validate: false
+				}).serialize(node);
+			};
+
+			function lookupAttribute(o, attr) {
+				return lookup[(o.attr(attr) || '').toLowerCase()];
+			}
+
+			function lookupExtension(src) {
+				var ext = src.replace(/^.*\.([^.]+)$/, '$1');
+				return lookup[ext.toLowerCase() || ''];
+			}
+
+			// If node isn't in document
+			if (!node.parent)
+				return;
+
+			// Handle media scripts
+			if (node.name === 'script') {
+				if (node.firstChild)
+					matches = scriptRegExp.exec(node.firstChild.value);
+
+				if (!matches)
+					return;
+
+				type = matches[1];
+				data = {video : {}, params : JSON.parse(matches[2])};
+				width = data.params.width;
+				height = data.params.height;
+			}
+
+			// Setup data objects
+			data = data || {
+				video : {},
+				params : {}
+			};
+
+			// Setup new image object
+			img = new Node('img', 1);
+			img.attr({
+				src : this.editor.theme.url + '/img/trans.gif'
+			});
+
+			// Video element
+			name = node.name;
+			if (name === 'video' || name == 'audio') {
+				video = node;
+				object = node.getAll('object')[0];
+				embed = node.getAll('embed')[0];
+				width = video.attr('width');
+				height = video.attr('height');
+				id = video.attr('id');
+				data.video = {attrs : {}, sources : []};
+
+				// Get all video attributes
+				attrs = data.video.attrs;
+				for (name in video.attributes.map)
+					attrs[name] = video.attributes.map[name];
+
+				source = node.attr('src');
+				if (source)
+					data.video.sources.push({src : urlConverter.call(urlConverterScope, source, 'src', node.name)});
+
+				// Get all sources
+				sources = video.getAll("source");
+				for (i = 0; i < sources.length; i++) {
+					source = sources[i].remove();
+
+					data.video.sources.push({
+						src: urlConverter.call(urlConverterScope, source.attr('src'), 'src', 'source'),
+						type: source.attr('type'),
+						media: source.attr('media')
+					});
+				}
+
+				// Convert the poster URL
+				if (attrs.poster)
+					attrs.poster = urlConverter.call(urlConverterScope, attrs.poster, 'poster', node.name);
+			}
+
+			// Object element
+			if (node.name === 'object') {
+				object = node;
+				embed = node.getAll('embed')[0];
+			}
+
+			// Embed element
+			if (node.name === 'embed')
+				embed = node;
+
+			// Iframe element
+			if (node.name === 'iframe') {
+				iframe = node;
+				type = 'Iframe';
+			}
+
+			if (object) {
+				// Get width/height
+				width = width || object.attr('width');
+				height = height || object.attr('height');
+				style = style || object.attr('style');
+				id = id || object.attr('id');
+				hspace = hspace || object.attr('hspace');
+				vspace = vspace || object.attr('vspace');
+				align = align || object.attr('align');
+				bgcolor = bgcolor || object.attr('bgcolor');
+				data.name = object.attr('name');
+
+				// Get all object params
+				params = object.getAll("param");
+				for (i = 0; i < params.length; i++) {
+					param = params[i];
+					name = param.remove().attr('name');
+
+					if (!excludedAttrs[name])
+						data.params[name] = param.attr('value');
+				}
+
+				data.params.src = data.params.src || object.attr('data');
+			}
+
+			if (embed) {
+				// Get width/height
+				width = width || embed.attr('width');
+				height = height || embed.attr('height');
+				style = style || embed.attr('style');
+				id = id || embed.attr('id');
+				hspace = hspace || embed.attr('hspace');
+				vspace = vspace || embed.attr('vspace');
+				align = align || embed.attr('align');
+				bgcolor = bgcolor || embed.attr('bgcolor');
+
+				// Get all embed attributes
+				for (name in embed.attributes.map) {
+					if (!excludedAttrs[name] && !data.params[name])
+						data.params[name] = embed.attributes.map[name];
+				}
+			}
+
+			if (iframe) {
+				// Get width/height
+				width = iframe.attr('width');
+				height = iframe.attr('height');
+				style = style || iframe.attr('style');
+				id = iframe.attr('id');
+				hspace = iframe.attr('hspace');
+				vspace = iframe.attr('vspace');
+				align = iframe.attr('align');
+				bgcolor = iframe.attr('bgcolor');
+
+				tinymce.each(rootAttributes, function(name) {
+					img.attr(name, iframe.attr(name));
+				});
+
+				// Get all iframe attributes
+				for (name in iframe.attributes.map) {
+					if (!excludedAttrs[name] && !data.params[name])
+						data.params[name] = iframe.attributes.map[name];
+				}
+			}
+
+			// Use src not movie
+			if (data.params.movie) {
+				data.params.src = data.params.src || data.params.movie;
+				delete data.params.movie;
+			}
+
+			// Convert the URL to relative/absolute depending on configuration
+			if (data.params.src)
+				data.params.src = urlConverter.call(urlConverterScope, data.params.src, 'src', 'object');
+
+			if (video) {
+				if (node.name === 'video')
+					type = lookup.video.name;
+				else if (node.name === 'audio')
+					type = lookup.audio.name;
+			}
+
+			if (object && !type)
+				type = (lookupAttribute(object, 'clsid') || lookupAttribute(object, 'classid') || lookupAttribute(object, 'type') || {}).name;
+
+			if (embed && !type)
+				type = (lookupAttribute(embed, 'type') || lookupExtension(data.params.src) || {}).name;
+
+			// for embedded audio we preserve the original specified type
+			if (embed && type == 'EmbeddedAudio') {
+				data.params.type = embed.attr('type');
+			}
+
+			// Replace the video/object/embed element with a placeholder image containing the data
+			node.replace(img);
+
+			// Remove embed
+			if (embed)
+				embed.remove();
+
+			// Serialize the inner HTML of the object element
+			if (object) {
+				html = getInnerHTML(object.remove());
+
+				if (html)
+					data.object_html = html;
+			}
+
+			// Serialize the inner HTML of the video element
+			if (video) {
+				html = getInnerHTML(video.remove());
+
+				if (html)
+					data.video_html = html;
+			}
+
+			data.hspace = hspace;
+			data.vspace = vspace;
+			data.align = align;
+			data.bgcolor = bgcolor;
+
+			// Set width/height of placeholder
+			img.attr({
+				id : id,
+				'class' : 'mceItemMedia mceItem' + (type || 'Flash'),
+				style : style,
+				width : width || (node.name == 'audio' ? "300" : "320"),
+				height : height || (node.name == 'audio' ? "32" : "240"),
+				hspace : hspace,
+				vspace : vspace,
+				align : align,
+				bgcolor : bgcolor,
+				"data-mce-json" : JSON.serialize(data, "'")
+			});
+		}
+	});
+
+	// Register plugin
+	tinymce.PluginManager.add('media', tinymce.plugins.MediaPlugin);
+})();
Index: wp-includes/js/tinymce/plugins/wpeditimage/editor_plugin.js
===================================================================
--- wp-includes/js/tinymce/plugins/wpeditimage/editor_plugin.js	(revision 19934)
+++ wp-includes/js/tinymce/plugins/wpeditimage/editor_plugin.js	(working copy)
@@ -1 +1,2 @@
+
 (function(){tinymce.create("tinymce.plugins.wpEditImage",{init:function(a,c){var d=this,b={};d.url=c;d._createButtons();a.addCommand("WP_EditImage",function(){var i=a.selection.getNode(),g=tinymce.DOM.getViewPort(),h=g.h,e=(720<g.w)?720:g.w,f=a.dom.getAttrib(i,"class");if(f.indexOf("mceItem")!=-1||f.indexOf("wpGallery")!=-1||i.nodeName!="IMG"){return}tb_show("",c+"/editimage.html?ver=321&TB_iframe=true");tinymce.DOM.setStyles("TB_window",{width:(e-50)+"px",height:(h-45)+"px","margin-left":"-"+parseInt(((e-50)/2),10)+"px"});if(!tinymce.isIE6){tinymce.DOM.setStyles("TB_window",{top:"20px",marginTop:"0"})}tinymce.DOM.setStyles("TB_iframeContent",{width:(e-50)+"px",height:(h-75)+"px"});tinymce.DOM.setStyle(["TB_overlay","TB_window","TB_load"],"z-index","999999")});a.onInit.add(function(e){tinymce.dom.Event.add(e.getBody(),"dragstart",function(f){if(!tinymce.isGecko&&f.target.nodeName=="IMG"&&e.dom.getParent(f.target,"dl.wp-caption")){return tinymce.dom.Event.cancel(f)}})});a.onMouseUp.add(function(f,g){if(tinymce.isWebKit||tinymce.isOpera){return}if(b.x&&(g.clientX!=b.x||g.clientY!=b.y)){var h=f.selection.getNode();if("IMG"==h.nodeName){window.setTimeout(function(){var e,i;if(h.width!=b.img_w||h.height!=b.img_h){h.className=h.className.replace(/size-[^ "']+/,"")}if(f.dom.getParent(h,"div.mceTemp")){e=f.dom.getParent(h,"dl.wp-caption");if(e){i=f.dom.getAttrib(h,"width")||h.width;i=parseInt(i,10);f.dom.setStyle(e,"width",10+i);f.execCommand("mceRepaint")}}},100)}}b={}});a.onMouseDown.add(function(f,g){if(g.target&&(g.target.nodeName=="IMG"||(g.target.firstChild&&g.target.firstChild.nodeName=="IMG"))){b={x:g.clientX,y:g.clientY,img_w:g.target.clientWidth,img_h:g.target.clientHeight};if(f.dom.getAttrib(g.target,"class").indexOf("mceItem")==-1){f.plugins.wordpress._showButtons(g.target,"wp_editbtns")}}});a.onKeyPress.add(function(f,j){var k,g,i,h;if(j.keyCode==13){k=f.selection.getNode();g=f.dom.getParent(k,"dl.wp-caption");i=f.dom.getParent(g,"div.mceTemp");if(g&&i){h=f.dom.create("p",{},"&nbsp;");f.dom.insertAfter(h,i);if(h.firstChild){f.selection.select(h.firstChild)}else{f.selection.select(h)}tinymce.dom.Event.cancel(j);return false}}});a.onBeforeSetContent.add(function(e,f){f.content=d._do_shcode(f.content)});a.onPostProcess.add(function(e,f){if(f.get){f.content=d._get_shcode(f.content)}})},_do_shcode:function(a){return a.replace(/(?:<p>)?\[(?:wp_)?caption([^\]]+)\]([\s\S]+?)\[\/(?:wp_)?caption\](?:<\/p>)?[\s\u00a0]*/g,function(g,d,k){var j,f,e,h,i;d=d.replace(/\\'|\\&#39;|\\&#039;/g,"&#39;").replace(/\\"|\\&quot;/g,"&quot;");k=k.replace(/\\&#39;|\\&#039;/g,"&#39;").replace(/\\&quot;/g,"&quot;");j=d.match(/id=['"]([^'"]+)/i);f=d.match(/align=['"]([^'"]+)/i);e=d.match(/width=['"]([0-9]+)/);h=d.match(/caption=['"]([^'"]+)/i);j=(j&&j[1])?j[1]:"";f=(f&&f[1])?f[1]:"alignnone";e=(e&&e[1])?e[1]:"";h=(h&&h[1])?h[1]:"";if(!e||!h){return k}i=(f=="aligncenter")?"mceTemp mceIEcenter":"mceTemp";return'<div class="'+i+'" draggable><dl id="'+j+'" class="wp-caption '+f+'" style="width: '+(10+parseInt(e))+'px"><dt class="wp-caption-dt">'+k+'</dt><dd class="wp-caption-dd">'+h+"</dd></dl></div>"})},_get_shcode:function(a){return a.replace(/<div class="mceTemp[^"]*">\s*<dl([^>]+)>\s*<dt[^>]+>([\s\S]+?)<\/dt>\s*<dd[^>]+>(.+?)<\/dd>\s*<\/dl>\s*<\/div>\s*/gi,function(g,d,j,h){var i,f,e;i=d.match(/id=['"]([^'"]+)/i);f=d.match(/class=['"]([^'"]+)/i);e=j.match(/width=['"]([0-9]+)/);i=(i&&i[1])?i[1]:"";f=(f&&f[1])?f[1]:"alignnone";e=(e&&e[1])?e[1]:"";if(!e||!h){return j}f=f.match(/align[^ '"]+/)||"alignnone";h=h.replace(/<\S[^<>]*>/gi,"").replace(/'/g,"&#39;").replace(/"/g,"&quot;");return'[caption id="'+i+'" align="'+f+'" width="'+e+'" caption="'+h+'"]'+j+"[/caption]"})},_createButtons:function(){var b=this,a=tinyMCE.activeEditor,d=tinymce.DOM,e,c;d.remove("wp_editbtns");d.add(document.body,"div",{id:"wp_editbtns",style:"display:none;"});e=d.add("wp_editbtns","img",{src:b.url+"/img/image.png",id:"wp_editimgbtn",width:"24",height:"24",title:a.getLang("wpeditimage.edit_img")});tinymce.dom.Event.add(e,"mousedown",function(g){var f=tinyMCE.activeEditor;f.windowManager.bookmark=f.selection.getBookmark("simple");f.execCommand("WP_EditImage")});c=d.add("wp_editbtns","img",{src:b.url+"/img/delete.png",id:"wp_delimgbtn",width:"24",height:"24",title:a.getLang("wpeditimage.del_img")});tinymce.dom.Event.add(c,"mousedown",function(i){var f=tinyMCE.activeEditor,g=f.selection.getNode(),h;if(g.nodeName=="IMG"&&f.dom.getAttrib(g,"class").indexOf("mceItem")==-1){if((h=f.dom.getParent(g,"div"))&&f.dom.hasClass(h,"mceTemp")){f.dom.remove(h)}else{if((h=f.dom.getParent(g,"A"))&&h.childNodes.length==1){f.dom.remove(h)}else{f.dom.remove(g)}}f.execCommand("mceRepaint");return false}})},getInfo:function(){return{longname:"Edit Image",author:"WordPress",authorurl:"http://wordpress.org",infourl:"",version:"1.0"}}});tinymce.PluginManager.add("wpeditimage",tinymce.plugins.wpEditImage)})();
\ No newline at end of file
Index: wp-includes/js/tinymce/plugins/fullscreen/editor_plugin.dev.js
===================================================================
--- wp-includes/js/tinymce/plugins/fullscreen/editor_plugin.dev.js	(revision 0)
+++ wp-includes/js/tinymce/plugins/fullscreen/editor_plugin.dev.js	(revision 0)
@@ -0,0 +1,159 @@
+/**
+ * editor_plugin_src.js
+ *
+ * Copyright 2009, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://tinymce.moxiecode.com/license
+ * Contributing: http://tinymce.moxiecode.com/contributing
+ */
+
+(function() {
+	var DOM = tinymce.DOM;
+
+	tinymce.create('tinymce.plugins.FullScreenPlugin', {
+		init : function(ed, url) {
+			var t = this, s = {}, vp, posCss;
+
+			t.editor = ed;
+
+			// Register commands
+			ed.addCommand('mceFullScreen', function() {
+				var win, de = DOM.doc.documentElement;
+
+				if (ed.getParam('fullscreen_is_enabled')) {
+					if (ed.getParam('fullscreen_new_window'))
+						closeFullscreen(); // Call to close in new window
+					else {
+						DOM.win.setTimeout(function() {
+							tinymce.dom.Event.remove(DOM.win, 'resize', t.resizeFunc);
+							tinyMCE.get(ed.getParam('fullscreen_editor_id')).setContent(ed.getContent());
+							tinyMCE.remove(ed);
+							DOM.remove('mce_fullscreen_container');
+							de.style.overflow = ed.getParam('fullscreen_html_overflow');
+							DOM.setStyle(DOM.doc.body, 'overflow', ed.getParam('fullscreen_overflow'));
+							DOM.win.scrollTo(ed.getParam('fullscreen_scrollx'), ed.getParam('fullscreen_scrolly'));
+							tinyMCE.settings = tinyMCE.oldSettings; // Restore old settings
+						}, 10);
+					}
+
+					return;
+				}
+
+				if (ed.getParam('fullscreen_new_window')) {
+					win = DOM.win.open(url + "/fullscreen.htm", "mceFullScreenPopup", "fullscreen=yes,menubar=no,toolbar=no,scrollbars=no,resizable=yes,left=0,top=0,width=" + screen.availWidth + ",height=" + screen.availHeight);
+					try {
+						win.resizeTo(screen.availWidth, screen.availHeight);
+					} catch (e) {
+						// Ignore
+					}
+				} else {
+					tinyMCE.oldSettings = tinyMCE.settings; // Store old settings
+					s.fullscreen_overflow = DOM.getStyle(DOM.doc.body, 'overflow', 1) || 'auto';
+					s.fullscreen_html_overflow = DOM.getStyle(de, 'overflow', 1);
+					vp = DOM.getViewPort();
+					s.fullscreen_scrollx = vp.x;
+					s.fullscreen_scrolly = vp.y;
+
+					// Fixes an Opera bug where the scrollbars doesn't reappear
+					if (tinymce.isOpera && s.fullscreen_overflow == 'visible')
+						s.fullscreen_overflow = 'auto';
+
+					// Fixes an IE bug where horizontal scrollbars would appear
+					if (tinymce.isIE && s.fullscreen_overflow == 'scroll')
+						s.fullscreen_overflow = 'auto';
+
+					// Fixes an IE bug where the scrollbars doesn't reappear
+					if (tinymce.isIE && (s.fullscreen_html_overflow == 'visible' || s.fullscreen_html_overflow == 'scroll'))
+						s.fullscreen_html_overflow = 'auto'; 
+
+					if (s.fullscreen_overflow == '0px')
+						s.fullscreen_overflow = '';
+
+					DOM.setStyle(DOM.doc.body, 'overflow', 'hidden');
+					de.style.overflow = 'hidden'; //Fix for IE6/7
+					vp = DOM.getViewPort();
+					DOM.win.scrollTo(0, 0);
+
+					if (tinymce.isIE)
+						vp.h -= 1;
+
+					// Use fixed position if it exists
+					if (tinymce.isIE6)
+						posCss = 'absolute;top:' + vp.y;
+					else
+						posCss = 'fixed;top:0';
+
+					n = DOM.add(DOM.doc.body, 'div', {
+						id : 'mce_fullscreen_container', 
+						style : 'position:' + posCss + ';left:0;width:' + vp.w + 'px;height:' + vp.h + 'px;z-index:200000;'});
+					DOM.add(n, 'div', {id : 'mce_fullscreen'});
+
+					tinymce.each(ed.settings, function(v, n) {
+						s[n] = v;
+					});
+
+					s.id = 'mce_fullscreen';
+					s.width = n.clientWidth;
+					s.height = n.clientHeight - 15;
+					s.fullscreen_is_enabled = true;
+					s.fullscreen_editor_id = ed.id;
+					s.theme_advanced_resizing = false;
+					s.save_onsavecallback = function() {
+						ed.setContent(tinyMCE.get(s.id).getContent());
+						ed.execCommand('mceSave');
+					};
+
+					tinymce.each(ed.getParam('fullscreen_settings'), function(v, k) {
+						s[k] = v;
+					});
+
+					if (s.theme_advanced_toolbar_location === 'external')
+						s.theme_advanced_toolbar_location = 'top';
+
+					t.fullscreenEditor = new tinymce.Editor('mce_fullscreen', s);
+					t.fullscreenEditor.onInit.add(function() {
+						t.fullscreenEditor.setContent(ed.getContent());
+						t.fullscreenEditor.focus();
+					});
+
+					t.fullscreenEditor.render();
+
+					t.fullscreenElement = new tinymce.dom.Element('mce_fullscreen_container');
+					t.fullscreenElement.update();
+					//document.body.overflow = 'hidden';
+
+					t.resizeFunc = tinymce.dom.Event.add(DOM.win, 'resize', function() {
+						var vp = tinymce.DOM.getViewPort(), fed = t.fullscreenEditor, outerSize, innerSize;
+
+						// Get outer/inner size to get a delta size that can be used to calc the new iframe size
+						outerSize = fed.dom.getSize(fed.getContainer().firstChild);
+						innerSize = fed.dom.getSize(fed.getContainer().getElementsByTagName('iframe')[0]);
+
+						fed.theme.resizeTo(vp.w - outerSize.w + innerSize.w, vp.h - outerSize.h + innerSize.h);
+					});
+				}
+			});
+
+			// Register buttons
+			ed.addButton('fullscreen', {title : 'fullscreen.desc', cmd : 'mceFullScreen'});
+
+			ed.onNodeChange.add(function(ed, cm) {
+				cm.setActive('fullscreen', ed.getParam('fullscreen_is_enabled'));
+			});
+		},
+
+		getInfo : function() {
+			return {
+				longname : 'Fullscreen',
+				author : 'Moxiecode Systems AB',
+				authorurl : 'http://tinymce.moxiecode.com',
+				infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/fullscreen',
+				version : tinymce.majorVersion + "." + tinymce.minorVersion
+			};
+		}
+	});
+
+	// Register plugin
+	tinymce.PluginManager.add('fullscreen', tinymce.plugins.FullScreenPlugin);
+})();
\ No newline at end of file
Index: wp-includes/js/tinymce/plugins/directionality/editor_plugin.dev.js
===================================================================
--- wp-includes/js/tinymce/plugins/directionality/editor_plugin.dev.js	(revision 0)
+++ wp-includes/js/tinymce/plugins/directionality/editor_plugin.dev.js	(revision 0)
@@ -0,0 +1,82 @@
+/**
+ * editor_plugin_src.js
+ *
+ * Copyright 2009, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://tinymce.moxiecode.com/license
+ * Contributing: http://tinymce.moxiecode.com/contributing
+ */
+
+(function() {
+	tinymce.create('tinymce.plugins.Directionality', {
+		init : function(ed, url) {
+			var t = this;
+
+			t.editor = ed;
+
+			ed.addCommand('mceDirectionLTR', function() {
+				var e = ed.dom.getParent(ed.selection.getNode(), ed.dom.isBlock);
+
+				if (e) {
+					if (ed.dom.getAttrib(e, "dir") != "ltr")
+						ed.dom.setAttrib(e, "dir", "ltr");
+					else
+						ed.dom.setAttrib(e, "dir", "");
+				}
+
+				ed.nodeChanged();
+			});
+
+			ed.addCommand('mceDirectionRTL', function() {
+				var e = ed.dom.getParent(ed.selection.getNode(), ed.dom.isBlock);
+
+				if (e) {
+					if (ed.dom.getAttrib(e, "dir") != "rtl")
+						ed.dom.setAttrib(e, "dir", "rtl");
+					else
+						ed.dom.setAttrib(e, "dir", "");
+				}
+
+				ed.nodeChanged();
+			});
+
+			ed.addButton('ltr', {title : 'directionality.ltr_desc', cmd : 'mceDirectionLTR'});
+			ed.addButton('rtl', {title : 'directionality.rtl_desc', cmd : 'mceDirectionRTL'});
+
+			ed.onNodeChange.add(t._nodeChange, t);
+		},
+
+		getInfo : function() {
+			return {
+				longname : 'Directionality',
+				author : 'Moxiecode Systems AB',
+				authorurl : 'http://tinymce.moxiecode.com',
+				infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/directionality',
+				version : tinymce.majorVersion + "." + tinymce.minorVersion
+			};
+		},
+
+		// Private methods
+
+		_nodeChange : function(ed, cm, n) {
+			var dom = ed.dom, dir;
+
+			n = dom.getParent(n, dom.isBlock);
+			if (!n) {
+				cm.setDisabled('ltr', 1);
+				cm.setDisabled('rtl', 1);
+				return;
+			}
+
+			dir = dom.getAttrib(n, 'dir');
+			cm.setActive('ltr', dir == "ltr");
+			cm.setDisabled('ltr', 0);
+			cm.setActive('rtl', dir == "rtl");
+			cm.setDisabled('rtl', 0);
+		}
+	});
+
+	// Register plugin
+	tinymce.PluginManager.add('directionality', tinymce.plugins.Directionality);
+})();
\ No newline at end of file
Index: wp-includes/js/tinymce/plugins/spellchecker/editor_plugin.dev.js
===================================================================
--- wp-includes/js/tinymce/plugins/spellchecker/editor_plugin.dev.js	(revision 0)
+++ wp-includes/js/tinymce/plugins/spellchecker/editor_plugin.dev.js	(revision 0)
@@ -0,0 +1,436 @@
+/**
+ * editor_plugin_src.js
+ *
+ * Copyright 2009, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://tinymce.moxiecode.com/license
+ * Contributing: http://tinymce.moxiecode.com/contributing
+ */
+
+(function() {
+	var JSONRequest = tinymce.util.JSONRequest, each = tinymce.each, DOM = tinymce.DOM;
+
+	tinymce.create('tinymce.plugins.SpellcheckerPlugin', {
+		getInfo : function() {
+			return {
+				longname : 'Spellchecker',
+				author : 'Moxiecode Systems AB',
+				authorurl : 'http://tinymce.moxiecode.com',
+				infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/spellchecker',
+				version : tinymce.majorVersion + "." + tinymce.minorVersion
+			};
+		},
+
+		init : function(ed, url) {
+			var t = this, cm;
+
+			t.url = url;
+			t.editor = ed;
+			t.rpcUrl = ed.getParam("spellchecker_rpc_url", "{backend}");
+
+			if (t.rpcUrl == '{backend}') {
+				// Sniff if the browser supports native spellchecking (Don't know of a better way)
+				if (tinymce.isIE)
+					return;
+
+				t.hasSupport = true;
+
+				// Disable the context menu when spellchecking is active
+				ed.onContextMenu.addToTop(function(ed, e) {
+					if (t.active)
+						return false;
+				});
+			}
+
+			// Register commands
+			ed.addCommand('mceSpellCheck', function() {
+				if (t.rpcUrl == '{backend}') {
+					// Enable/disable native spellchecker
+					t.editor.getBody().spellcheck = t.active = !t.active;
+					return;
+				}
+
+				if (!t.active) {
+					ed.setProgressState(1);
+					t._sendRPC('checkWords', [t.selectedLang, t._getWords()], function(r) {
+						if (r.length > 0) {
+							t.active = 1;
+							t._markWords(r);
+							ed.setProgressState(0);
+							ed.nodeChanged();
+						} else {
+							ed.setProgressState(0);
+
+							if (ed.getParam('spellchecker_report_no_misspellings', true))
+								ed.windowManager.alert('spellchecker.no_mpell');
+						}
+					});
+				} else
+					t._done();
+			});
+
+			if (ed.settings.content_css !== false)
+				ed.contentCSS.push(url + '/css/content.css');
+
+			ed.onClick.add(t._showMenu, t);
+			ed.onContextMenu.add(t._showMenu, t);
+			ed.onBeforeGetContent.add(function() {
+				if (t.active)
+					t._removeWords();
+			});
+
+			ed.onNodeChange.add(function(ed, cm) {
+				cm.setActive('spellchecker', t.active);
+			});
+
+			ed.onSetContent.add(function() {
+				t._done();
+			});
+
+			ed.onBeforeGetContent.add(function() {
+				t._done();
+			});
+
+			ed.onBeforeExecCommand.add(function(ed, cmd) {
+				if (cmd == 'mceFullScreen')
+					t._done();
+			});
+
+			// Find selected language
+			t.languages = {};
+			each(ed.getParam('spellchecker_languages', '+English=en,Danish=da,Dutch=nl,Finnish=fi,French=fr,German=de,Italian=it,Polish=pl,Portuguese=pt,Spanish=es,Swedish=sv', 'hash'), function(v, k) {
+				if (k.indexOf('+') === 0) {
+					k = k.substring(1);
+					t.selectedLang = v;
+				}
+
+				t.languages[k] = v;
+			});
+		},
+
+		createControl : function(n, cm) {
+			var t = this, c, ed = t.editor;
+
+			if (n == 'spellchecker') {
+				// Use basic button if we use the native spellchecker
+				if (t.rpcUrl == '{backend}') {
+					// Create simple toggle button if we have native support
+					if (t.hasSupport)
+						c = cm.createButton(n, {title : 'spellchecker.desc', cmd : 'mceSpellCheck', scope : t});
+
+					return c;
+				}
+
+				c = cm.createSplitButton(n, {title : 'spellchecker.desc', cmd : 'mceSpellCheck', scope : t});
+
+				c.onRenderMenu.add(function(c, m) {
+					m.add({title : 'spellchecker.langs', 'class' : 'mceMenuItemTitle'}).setDisabled(1);
+					each(t.languages, function(v, k) {
+						var o = {icon : 1}, mi;
+
+						o.onclick = function() {
+							if (v == t.selectedLang) {
+								return;
+							}
+							mi.setSelected(1);
+							t.selectedItem.setSelected(0);
+							t.selectedItem = mi;
+							t.selectedLang = v;
+						};
+
+						o.title = k;
+						mi = m.add(o);
+						mi.setSelected(v == t.selectedLang);
+
+						if (v == t.selectedLang)
+							t.selectedItem = mi;
+					})
+				});
+
+				return c;
+			}
+		},
+
+		// Internal functions
+
+		_walk : function(n, f) {
+			var d = this.editor.getDoc(), w;
+
+			if (d.createTreeWalker) {
+				w = d.createTreeWalker(n, NodeFilter.SHOW_TEXT, null, false);
+
+				while ((n = w.nextNode()) != null)
+					f.call(this, n);
+			} else
+				tinymce.walk(n, f, 'childNodes');
+		},
+
+		_getSeparators : function() {
+			var re = '', i, str = this.editor.getParam('spellchecker_word_separator_chars', '\\s!"#$%&()*+,-./:;<=>?@[\]^_{|}§©«®±¶·¸»¼½¾¿×÷¤\u201d\u201c');
+
+			// Build word separator regexp
+			for (i=0; i<str.length; i++)
+				re += '\\' + str.charAt(i);
+
+			return re;
+		},
+
+		_getWords : function() {
+			var ed = this.editor, wl = [], tx = '', lo = {}, rawWords = [];
+
+			// Get area text
+			this._walk(ed.getBody(), function(n) {
+				if (n.nodeType == 3)
+					tx += n.nodeValue + ' ';
+			});
+
+			// split the text up into individual words
+			if (ed.getParam('spellchecker_word_pattern')) {
+				// look for words that match the pattern
+				rawWords = tx.match('(' + ed.getParam('spellchecker_word_pattern') + ')', 'gi');
+			} else {
+				// Split words by separator
+				tx = tx.replace(new RegExp('([0-9]|[' + this._getSeparators() + '])', 'g'), ' ');
+				tx = tinymce.trim(tx.replace(/(\s+)/g, ' '));
+				rawWords = tx.split(' ');
+			}
+
+			// Build word array and remove duplicates
+			each(rawWords, function(v) {
+				if (!lo[v]) {
+					wl.push(v);
+					lo[v] = 1;
+				}
+			});
+
+			return wl;
+		},
+
+		_removeWords : function(w) {
+			var ed = this.editor, dom = ed.dom, se = ed.selection, b = se.getBookmark();
+
+			each(dom.select('span').reverse(), function(n) {
+				if (n && (dom.hasClass(n, 'mceItemHiddenSpellWord') || dom.hasClass(n, 'mceItemHidden'))) {
+					if (!w || dom.decode(n.innerHTML) == w)
+						dom.remove(n, 1);
+				}
+			});
+
+			se.moveToBookmark(b);
+		},
+
+		_markWords : function(wl) {
+			var ed = this.editor, dom = ed.dom, doc = ed.getDoc(), se = ed.selection, b = se.getBookmark(), nl = [],
+				w = wl.join('|'), re = this._getSeparators(), rx = new RegExp('(^|[' + re + '])(' + w + ')(?=[' + re + ']|$)', 'g');
+
+			// Collect all text nodes
+			this._walk(ed.getBody(), function(n) {
+				if (n.nodeType == 3) {
+					nl.push(n);
+				}
+			});
+
+			// Wrap incorrect words in spans
+			each(nl, function(n) {
+				var node, elem, txt, pos, v = n.nodeValue;
+
+				if (rx.test(v)) {
+					// Encode the content
+					v = dom.encode(v);
+					// Create container element
+					elem = dom.create('span', {'class' : 'mceItemHidden'});
+
+					// Following code fixes IE issues by creating text nodes
+					// using DOM methods instead of innerHTML.
+					// Bug #3124: <PRE> elements content is broken after spellchecking.
+					// Bug #1408: Preceding whitespace characters are removed
+					// @TODO: I'm not sure that both are still issues on IE9.
+					if (tinymce.isIE) {
+						// Enclose mispelled words with temporal tag
+						v = v.replace(rx, '$1<mcespell>$2</mcespell>');
+						// Loop over the content finding mispelled words
+						while ((pos = v.indexOf('<mcespell>')) != -1) {
+							// Add text node for the content before the word
+							txt = v.substring(0, pos);
+							if (txt.length) {
+								node = doc.createTextNode(dom.decode(txt));
+								elem.appendChild(node);
+							}
+							v = v.substring(pos+10);
+							pos = v.indexOf('</mcespell>');
+							txt = v.substring(0, pos);
+							v = v.substring(pos+11);
+							// Add span element for the word
+							elem.appendChild(dom.create('span', {'class' : 'mceItemHiddenSpellWord'}, txt));
+						}
+						// Add text node for the rest of the content
+						if (v.length) {
+							node = doc.createTextNode(dom.decode(v));
+							elem.appendChild(node);
+						}
+					} else {
+						// Other browsers preserve whitespace characters on innerHTML usage
+						elem.innerHTML = v.replace(rx, '$1<span class="mceItemHiddenSpellWord">$2</span>');
+					}
+
+					// Finally, replace the node with the container
+					dom.replace(elem, n);
+				}
+			});
+
+			se.moveToBookmark(b);
+		},
+
+		_showMenu : function(ed, e) {
+			var t = this, ed = t.editor, m = t._menu, p1, dom = ed.dom, vp = dom.getViewPort(ed.getWin()), wordSpan = e.target;
+
+			e = 0; // Fixes IE memory leak
+
+			if (!m) {
+				m = ed.controlManager.createDropMenu('spellcheckermenu', {'class' : 'mceNoIcons'});
+				t._menu = m;
+			}
+
+			if (dom.hasClass(wordSpan, 'mceItemHiddenSpellWord')) {
+				m.removeAll();
+				m.add({title : 'spellchecker.wait', 'class' : 'mceMenuItemTitle'}).setDisabled(1);
+
+				t._sendRPC('getSuggestions', [t.selectedLang, dom.decode(wordSpan.innerHTML)], function(r) {
+					var ignoreRpc;
+
+					m.removeAll();
+
+					if (r.length > 0) {
+						m.add({title : 'spellchecker.sug', 'class' : 'mceMenuItemTitle'}).setDisabled(1);
+						each(r, function(v) {
+							m.add({title : v, onclick : function() {
+								dom.replace(ed.getDoc().createTextNode(v), wordSpan);
+								t._checkDone();
+							}});
+						});
+
+						m.addSeparator();
+					} else
+						m.add({title : 'spellchecker.no_sug', 'class' : 'mceMenuItemTitle'}).setDisabled(1);
+
+					if (ed.getParam('show_ignore_words', true)) {
+						ignoreRpc = t.editor.getParam("spellchecker_enable_ignore_rpc", '');
+						m.add({
+							title : 'spellchecker.ignore_word',
+							onclick : function() {
+								var word = wordSpan.innerHTML;
+
+								dom.remove(wordSpan, 1);
+								t._checkDone();
+
+								// tell the server if we need to
+								if (ignoreRpc) {
+									ed.setProgressState(1);
+									t._sendRPC('ignoreWord', [t.selectedLang, word], function(r) {
+										ed.setProgressState(0);
+									});
+								}
+							}
+						});
+
+						m.add({
+							title : 'spellchecker.ignore_words',
+							onclick : function() {
+								var word = wordSpan.innerHTML;
+
+								t._removeWords(dom.decode(word));
+								t._checkDone();
+
+								// tell the server if we need to
+								if (ignoreRpc) {
+									ed.setProgressState(1);
+									t._sendRPC('ignoreWords', [t.selectedLang, word], function(r) {
+										ed.setProgressState(0);
+									});
+								}
+							}
+						});
+					}
+
+					if (t.editor.getParam("spellchecker_enable_learn_rpc")) {
+						m.add({
+							title : 'spellchecker.learn_word',
+							onclick : function() {
+								var word = wordSpan.innerHTML;
+
+								dom.remove(wordSpan, 1);
+								t._checkDone();
+
+								ed.setProgressState(1);
+								t._sendRPC('learnWord', [t.selectedLang, word], function(r) {
+									ed.setProgressState(0);
+								});
+							}
+						});
+					}
+
+					m.update();
+				});
+
+				p1 = DOM.getPos(ed.getContentAreaContainer());
+				m.settings.offset_x = p1.x;
+				m.settings.offset_y = p1.y;
+
+				ed.selection.select(wordSpan);
+				p1 = dom.getPos(wordSpan);
+				m.showMenu(p1.x, p1.y + wordSpan.offsetHeight - vp.y);
+
+				return tinymce.dom.Event.cancel(e);
+			} else
+				m.hideMenu();
+		},
+
+		_checkDone : function() {
+			var t = this, ed = t.editor, dom = ed.dom, o;
+
+			each(dom.select('span'), function(n) {
+				if (n && dom.hasClass(n, 'mceItemHiddenSpellWord')) {
+					o = true;
+					return false;
+				}
+			});
+
+			if (!o)
+				t._done();
+		},
+
+		_done : function() {
+			var t = this, la = t.active;
+
+			if (t.active) {
+				t.active = 0;
+				t._removeWords();
+
+				if (t._menu)
+					t._menu.hideMenu();
+
+				if (la)
+					t.editor.nodeChanged();
+			}
+		},
+
+		_sendRPC : function(m, p, cb) {
+			var t = this;
+
+			JSONRequest.sendRPC({
+				url : t.rpcUrl,
+				method : m,
+				params : p,
+				success : cb,
+				error : function(e, x) {
+					t.editor.setProgressState(0);
+					t.editor.windowManager.alert(e.errstr || ('Error response: ' + x.responseText));
+				}
+			});
+		}
+	});
+
+	// Register plugin
+	tinymce.PluginManager.add('spellchecker', tinymce.plugins.SpellcheckerPlugin);
+})();
Index: wp-includes/js/tinymce/plugins/inlinepopups/editor_plugin.dev.js
===================================================================
--- wp-includes/js/tinymce/plugins/inlinepopups/editor_plugin.dev.js	(revision 0)
+++ wp-includes/js/tinymce/plugins/inlinepopups/editor_plugin.dev.js	(revision 0)
@@ -0,0 +1,699 @@
+/**
+ * editor_plugin_src.js
+ *
+ * Copyright 2009, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://tinymce.moxiecode.com/license
+ * Contributing: http://tinymce.moxiecode.com/contributing
+ */
+
+(function() {
+	var DOM = tinymce.DOM, Element = tinymce.dom.Element, Event = tinymce.dom.Event, each = tinymce.each, is = tinymce.is;
+
+	tinymce.create('tinymce.plugins.InlinePopups', {
+		init : function(ed, url) {
+			// Replace window manager
+			ed.onBeforeRenderUI.add(function() {
+				ed.windowManager = new tinymce.InlineWindowManager(ed);
+				DOM.loadCSS(url + '/skins/' + (ed.settings.inlinepopups_skin || 'clearlooks2') + "/window.css");
+			});
+		},
+
+		getInfo : function() {
+			return {
+				longname : 'InlinePopups',
+				author : 'Moxiecode Systems AB',
+				authorurl : 'http://tinymce.moxiecode.com',
+				infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/inlinepopups',
+				version : tinymce.majorVersion + "." + tinymce.minorVersion
+			};
+		}
+	});
+
+	tinymce.create('tinymce.InlineWindowManager:tinymce.WindowManager', {
+		InlineWindowManager : function(ed) {
+			var t = this;
+
+			t.parent(ed);
+			t.zIndex = 300000;
+			t.count = 0;
+			t.windows = {};
+		},
+
+		open : function(f, p) {
+			var t = this, id, opt = '', ed = t.editor, dw = 0, dh = 0, vp, po, mdf, clf, we, w, u, parentWindow;
+
+			f = f || {};
+			p = p || {};
+
+			// Run native windows
+			if (!f.inline)
+				return t.parent(f, p);
+
+			parentWindow = t._frontWindow();
+			if (parentWindow && DOM.get(parentWindow.id + '_ifr')) {
+				parentWindow.focussedElement = DOM.get(parentWindow.id + '_ifr').contentWindow.document.activeElement;
+			}
+			
+			// Only store selection if the type is a normal window
+			if (!f.type)
+				t.bookmark = ed.selection.getBookmark(1);
+
+			id = DOM.uniqueId();
+			vp = DOM.getViewPort();
+			f.width = parseInt(f.width || 320);
+			f.height = parseInt(f.height || 240) + (tinymce.isIE ? 8 : 0);
+			f.min_width = parseInt(f.min_width || 150);
+			f.min_height = parseInt(f.min_height || 100);
+			f.max_width = parseInt(f.max_width || 2000);
+			f.max_height = parseInt(f.max_height || 2000);
+			f.left = f.left || Math.round(Math.max(vp.x, vp.x + (vp.w / 2.0) - (f.width / 2.0)));
+			f.top = f.top || Math.round(Math.max(vp.y, vp.y + (vp.h / 2.0) - (f.height / 2.0)));
+			f.movable = f.resizable = true;
+			p.mce_width = f.width;
+			p.mce_height = f.height;
+			p.mce_inline = true;
+			p.mce_window_id = id;
+			p.mce_auto_focus = f.auto_focus;
+
+			// Transpose
+//			po = DOM.getPos(ed.getContainer());
+//			f.left -= po.x;
+//			f.top -= po.y;
+
+			t.features = f;
+			t.params = p;
+			t.onOpen.dispatch(t, f, p);
+
+			if (f.type) {
+				opt += ' mceModal';
+
+				if (f.type)
+					opt += ' mce' + f.type.substring(0, 1).toUpperCase() + f.type.substring(1);
+
+				f.resizable = false;
+			}
+
+			if (f.statusbar)
+				opt += ' mceStatusbar';
+
+			if (f.resizable)
+				opt += ' mceResizable';
+
+			if (f.minimizable)
+				opt += ' mceMinimizable';
+
+			if (f.maximizable)
+				opt += ' mceMaximizable';
+
+			if (f.movable)
+				opt += ' mceMovable';
+
+			// Create DOM objects
+			t._addAll(DOM.doc.body, 
+				['div', {id : id, role : 'dialog', 'aria-labelledby': f.type ? id + '_content' : id + '_title', 'class' : (ed.settings.inlinepopups_skin || 'clearlooks2') + (tinymce.isIE && window.getSelection ? ' ie9' : ''), style : 'width:100px;height:100px'}, 
+					['div', {id : id + '_wrapper', 'class' : 'mceWrapper' + opt},
+						['div', {id : id + '_top', 'class' : 'mceTop'}, 
+							['div', {'class' : 'mceLeft'}],
+							['div', {'class' : 'mceCenter'}],
+							['div', {'class' : 'mceRight'}],
+							['span', {id : id + '_title'}, f.title || '']
+						],
+
+						['div', {id : id + '_middle', 'class' : 'mceMiddle'}, 
+							['div', {id : id + '_left', 'class' : 'mceLeft', tabindex : '0'}],
+							['span', {id : id + '_content'}],
+							['div', {id : id + '_right', 'class' : 'mceRight', tabindex : '0'}]
+						],
+
+						['div', {id : id + '_bottom', 'class' : 'mceBottom'},
+							['div', {'class' : 'mceLeft'}],
+							['div', {'class' : 'mceCenter'}],
+							['div', {'class' : 'mceRight'}],
+							['span', {id : id + '_status'}, 'Content']
+						],
+
+						['a', {'class' : 'mceMove', tabindex : '-1', href : 'javascript:;'}],
+						['a', {'class' : 'mceMin', tabindex : '-1', href : 'javascript:;', onmousedown : 'return false;'}],
+						['a', {'class' : 'mceMax', tabindex : '-1', href : 'javascript:;', onmousedown : 'return false;'}],
+						['a', {'class' : 'mceMed', tabindex : '-1', href : 'javascript:;', onmousedown : 'return false;'}],
+						['a', {'class' : 'mceClose', tabindex : '-1', href : 'javascript:;', onmousedown : 'return false;'}],
+						['a', {id : id + '_resize_n', 'class' : 'mceResize mceResizeN', tabindex : '-1', href : 'javascript:;'}],
+						['a', {id : id + '_resize_s', 'class' : 'mceResize mceResizeS', tabindex : '-1', href : 'javascript:;'}],
+						['a', {id : id + '_resize_w', 'class' : 'mceResize mceResizeW', tabindex : '-1', href : 'javascript:;'}],
+						['a', {id : id + '_resize_e', 'class' : 'mceResize mceResizeE', tabindex : '-1', href : 'javascript:;'}],
+						['a', {id : id + '_resize_nw', 'class' : 'mceResize mceResizeNW', tabindex : '-1', href : 'javascript:;'}],
+						['a', {id : id + '_resize_ne', 'class' : 'mceResize mceResizeNE', tabindex : '-1', href : 'javascript:;'}],
+						['a', {id : id + '_resize_sw', 'class' : 'mceResize mceResizeSW', tabindex : '-1', href : 'javascript:;'}],
+						['a', {id : id + '_resize_se', 'class' : 'mceResize mceResizeSE', tabindex : '-1', href : 'javascript:;'}]
+					]
+				]
+			);
+
+			DOM.setStyles(id, {top : -10000, left : -10000});
+
+			// Fix gecko rendering bug, where the editors iframe messed with window contents
+			if (tinymce.isGecko)
+				DOM.setStyle(id, 'overflow', 'auto');
+
+			// Measure borders
+			if (!f.type) {
+				dw += DOM.get(id + '_left').clientWidth;
+				dw += DOM.get(id + '_right').clientWidth;
+				dh += DOM.get(id + '_top').clientHeight;
+				dh += DOM.get(id + '_bottom').clientHeight;
+			}
+
+			// Resize window
+			DOM.setStyles(id, {top : f.top, left : f.left, width : f.width + dw, height : f.height + dh});
+
+			u = f.url || f.file;
+			if (u) {
+				if (tinymce.relaxedDomain)
+					u += (u.indexOf('?') == -1 ? '?' : '&') + 'mce_rdomain=' + tinymce.relaxedDomain;
+
+				u = tinymce._addVer(u);
+			}
+
+			if (!f.type) {
+				DOM.add(id + '_content', 'iframe', {id : id + '_ifr', src : 'javascript:""', frameBorder : 0, style : 'border:0;width:10px;height:10px'});
+				DOM.setStyles(id + '_ifr', {width : f.width, height : f.height});
+				DOM.setAttrib(id + '_ifr', 'src', u);
+			} else {
+				DOM.add(id + '_wrapper', 'a', {id : id + '_ok', 'class' : 'mceButton mceOk', href : 'javascript:;', onmousedown : 'return false;'}, 'Ok');
+
+				if (f.type == 'confirm')
+					DOM.add(id + '_wrapper', 'a', {'class' : 'mceButton mceCancel', href : 'javascript:;', onmousedown : 'return false;'}, 'Cancel');
+
+				DOM.add(id + '_middle', 'div', {'class' : 'mceIcon'});
+				DOM.setHTML(id + '_content', f.content.replace('\n', '<br />'));
+				
+				Event.add(id, 'keyup', function(evt) {
+					var VK_ESCAPE = 27;
+					if (evt.keyCode === VK_ESCAPE) {
+						f.button_func(false);
+						return Event.cancel(evt);
+					}
+				});
+
+				Event.add(id, 'keydown', function(evt) {
+					var cancelButton, VK_TAB = 9;
+					if (evt.keyCode === VK_TAB) {
+						cancelButton = DOM.select('a.mceCancel', id + '_wrapper')[0];
+						if (cancelButton && cancelButton !== evt.target) {
+							cancelButton.focus();
+						} else {
+							DOM.get(id + '_ok').focus();
+						}
+						return Event.cancel(evt);
+					}
+				});
+			}
+
+			// Register events
+			mdf = Event.add(id, 'mousedown', function(e) {
+				var n = e.target, w, vp;
+
+				w = t.windows[id];
+				t.focus(id);
+
+				if (n.nodeName == 'A' || n.nodeName == 'a') {
+					if (n.className == 'mceClose') {
+						t.close(null, id);
+						return Event.cancel(e);
+					} else if (n.className == 'mceMax') {
+						w.oldPos = w.element.getXY();
+						w.oldSize = w.element.getSize();
+
+						vp = DOM.getViewPort();
+
+						// Reduce viewport size to avoid scrollbars
+						vp.w -= 2;
+						vp.h -= 2;
+
+						w.element.moveTo(vp.x, vp.y);
+						w.element.resizeTo(vp.w, vp.h);
+						DOM.setStyles(id + '_ifr', {width : vp.w - w.deltaWidth, height : vp.h - w.deltaHeight});
+						DOM.addClass(id + '_wrapper', 'mceMaximized');
+					} else if (n.className == 'mceMed') {
+						// Reset to old size
+						w.element.moveTo(w.oldPos.x, w.oldPos.y);
+						w.element.resizeTo(w.oldSize.w, w.oldSize.h);
+						w.iframeElement.resizeTo(w.oldSize.w - w.deltaWidth, w.oldSize.h - w.deltaHeight);
+
+						DOM.removeClass(id + '_wrapper', 'mceMaximized');
+					} else if (n.className == 'mceMove')
+						return t._startDrag(id, e, n.className);
+					else if (DOM.hasClass(n, 'mceResize'))
+						return t._startDrag(id, e, n.className.substring(13));
+				}
+			});
+
+			clf = Event.add(id, 'click', function(e) {
+				var n = e.target;
+
+				t.focus(id);
+
+				if (n.nodeName == 'A' || n.nodeName == 'a') {
+					switch (n.className) {
+						case 'mceClose':
+							t.close(null, id);
+							return Event.cancel(e);
+
+						case 'mceButton mceOk':
+						case 'mceButton mceCancel':
+							f.button_func(n.className == 'mceButton mceOk');
+							return Event.cancel(e);
+					}
+				}
+			});
+			
+			// Make sure the tab order loops within the dialog.
+			Event.add([id + '_left', id + '_right'], 'focus', function(evt) {
+				var iframe = DOM.get(id + '_ifr');
+				if (iframe) {
+					var body = iframe.contentWindow.document.body;
+					var focusable = DOM.select(':input:enabled,*[tabindex=0]', body);
+					if (evt.target.id === (id + '_left')) {
+						focusable[focusable.length - 1].focus();
+					} else {
+						focusable[0].focus();
+					}
+				} else {
+					DOM.get(id + '_ok').focus();
+				}
+			});
+			
+			// Add window
+			w = t.windows[id] = {
+				id : id,
+				mousedown_func : mdf,
+				click_func : clf,
+				element : new Element(id, {blocker : 1, container : ed.getContainer()}),
+				iframeElement : new Element(id + '_ifr'),
+				features : f,
+				deltaWidth : dw,
+				deltaHeight : dh
+			};
+
+			w.iframeElement.on('focus', function() {
+				t.focus(id);
+			});
+
+			// Setup blocker
+			if (t.count == 0 && t.editor.getParam('dialog_type', 'modal') == 'modal') {
+				DOM.add(DOM.doc.body, 'div', {
+					id : 'mceModalBlocker',
+					'class' : (t.editor.settings.inlinepopups_skin || 'clearlooks2') + '_modalBlocker',
+					style : {zIndex : t.zIndex - 1}
+				});
+
+				DOM.show('mceModalBlocker'); // Reduces flicker in IE
+				DOM.setAttrib(DOM.doc.body, 'aria-hidden', 'true');
+			} else
+				DOM.setStyle('mceModalBlocker', 'z-index', t.zIndex - 1);
+
+			if (tinymce.isIE6 || /Firefox\/2\./.test(navigator.userAgent) || (tinymce.isIE && !DOM.boxModel))
+				DOM.setStyles('mceModalBlocker', {position : 'absolute', left : vp.x, top : vp.y, width : vp.w - 2, height : vp.h - 2});
+
+			DOM.setAttrib(id, 'aria-hidden', 'false');
+			t.focus(id);
+			t._fixIELayout(id, 1);
+
+			// Focus ok button
+			if (DOM.get(id + '_ok'))
+				DOM.get(id + '_ok').focus();
+			t.count++;
+
+			return w;
+		},
+
+		focus : function(id) {
+			var t = this, w;
+
+			if (w = t.windows[id]) {
+				w.zIndex = this.zIndex++;
+				w.element.setStyle('zIndex', w.zIndex);
+				w.element.update();
+
+				id = id + '_wrapper';
+				DOM.removeClass(t.lastId, 'mceFocus');
+				DOM.addClass(id, 'mceFocus');
+				t.lastId = id;
+				
+				if (w.focussedElement) {
+					w.focussedElement.focus();
+				} else if (DOM.get(id + '_ok')) {
+					DOM.get(w.id + '_ok').focus();
+				} else if (DOM.get(w.id + '_ifr')) {
+					DOM.get(w.id + '_ifr').focus();
+				}
+			}
+		},
+
+		_addAll : function(te, ne) {
+			var i, n, t = this, dom = tinymce.DOM;
+
+			if (is(ne, 'string'))
+				te.appendChild(dom.doc.createTextNode(ne));
+			else if (ne.length) {
+				te = te.appendChild(dom.create(ne[0], ne[1]));
+
+				for (i=2; i<ne.length; i++)
+					t._addAll(te, ne[i]);
+			}
+		},
+
+		_startDrag : function(id, se, ac) {
+			var t = this, mu, mm, d = DOM.doc, eb, w = t.windows[id], we = w.element, sp = we.getXY(), p, sz, ph, cp, vp, sx, sy, sex, sey, dx, dy, dw, dh;
+
+			// Get positons and sizes
+//			cp = DOM.getPos(t.editor.getContainer());
+			cp = {x : 0, y : 0};
+			vp = DOM.getViewPort();
+
+			// Reduce viewport size to avoid scrollbars while dragging
+			vp.w -= 2;
+			vp.h -= 2;
+
+			sex = se.screenX;
+			sey = se.screenY;
+			dx = dy = dw = dh = 0;
+
+			// Handle mouse up
+			mu = Event.add(d, 'mouseup', function(e) {
+				Event.remove(d, 'mouseup', mu);
+				Event.remove(d, 'mousemove', mm);
+
+				if (eb)
+					eb.remove();
+
+				we.moveBy(dx, dy);
+				we.resizeBy(dw, dh);
+				sz = we.getSize();
+				DOM.setStyles(id + '_ifr', {width : sz.w - w.deltaWidth, height : sz.h - w.deltaHeight});
+				t._fixIELayout(id, 1);
+
+				return Event.cancel(e);
+			});
+
+			if (ac != 'Move')
+				startMove();
+
+			function startMove() {
+				if (eb)
+					return;
+
+				t._fixIELayout(id, 0);
+
+				// Setup event blocker
+				DOM.add(d.body, 'div', {
+					id : 'mceEventBlocker',
+					'class' : 'mceEventBlocker ' + (t.editor.settings.inlinepopups_skin || 'clearlooks2'),
+					style : {zIndex : t.zIndex + 1}
+				});
+
+				if (tinymce.isIE6 || (tinymce.isIE && !DOM.boxModel))
+					DOM.setStyles('mceEventBlocker', {position : 'absolute', left : vp.x, top : vp.y, width : vp.w - 2, height : vp.h - 2});
+
+				eb = new Element('mceEventBlocker');
+				eb.update();
+
+				// Setup placeholder
+				p = we.getXY();
+				sz = we.getSize();
+				sx = cp.x + p.x - vp.x;
+				sy = cp.y + p.y - vp.y;
+				DOM.add(eb.get(), 'div', {id : 'mcePlaceHolder', 'class' : 'mcePlaceHolder', style : {left : sx, top : sy, width : sz.w, height : sz.h}});
+				ph = new Element('mcePlaceHolder');
+			};
+
+			// Handle mouse move/drag
+			mm = Event.add(d, 'mousemove', function(e) {
+				var x, y, v;
+
+				startMove();
+
+				x = e.screenX - sex;
+				y = e.screenY - sey;
+
+				switch (ac) {
+					case 'ResizeW':
+						dx = x;
+						dw = 0 - x;
+						break;
+
+					case 'ResizeE':
+						dw = x;
+						break;
+
+					case 'ResizeN':
+					case 'ResizeNW':
+					case 'ResizeNE':
+						if (ac == "ResizeNW") {
+							dx = x;
+							dw = 0 - x;
+						} else if (ac == "ResizeNE")
+							dw = x;
+
+						dy = y;
+						dh = 0 - y;
+						break;
+
+					case 'ResizeS':
+					case 'ResizeSW':
+					case 'ResizeSE':
+						if (ac == "ResizeSW") {
+							dx = x;
+							dw = 0 - x;
+						} else if (ac == "ResizeSE")
+							dw = x;
+
+						dh = y;
+						break;
+
+					case 'mceMove':
+						dx = x;
+						dy = y;
+						break;
+				}
+
+				// Boundary check
+				if (dw < (v = w.features.min_width - sz.w)) {
+					if (dx !== 0)
+						dx += dw - v;
+
+					dw = v;
+				}
+	
+				if (dh < (v = w.features.min_height - sz.h)) {
+					if (dy !== 0)
+						dy += dh - v;
+
+					dh = v;
+				}
+
+				dw = Math.min(dw, w.features.max_width - sz.w);
+				dh = Math.min(dh, w.features.max_height - sz.h);
+				dx = Math.max(dx, vp.x - (sx + vp.x));
+				dy = Math.max(dy, vp.y - (sy + vp.y));
+				dx = Math.min(dx, (vp.w + vp.x) - (sx + sz.w + vp.x));
+				dy = Math.min(dy, (vp.h + vp.y) - (sy + sz.h + vp.y));
+
+				// Move if needed
+				if (dx + dy !== 0) {
+					if (sx + dx < 0)
+						dx = 0;
+	
+					if (sy + dy < 0)
+						dy = 0;
+
+					ph.moveTo(sx + dx, sy + dy);
+				}
+
+				// Resize if needed
+				if (dw + dh !== 0)
+					ph.resizeTo(sz.w + dw, sz.h + dh);
+
+				return Event.cancel(e);
+			});
+
+			return Event.cancel(se);
+		},
+
+		resizeBy : function(dw, dh, id) {
+			var w = this.windows[id];
+
+			if (w) {
+				w.element.resizeBy(dw, dh);
+				w.iframeElement.resizeBy(dw, dh);
+			}
+		},
+
+		close : function(win, id) {
+			var t = this, w, d = DOM.doc, fw, id;
+
+			id = t._findId(id || win);
+
+			// Probably not inline
+			if (!t.windows[id]) {
+				t.parent(win);
+				return;
+			}
+
+			t.count--;
+
+			if (t.count == 0) {
+				DOM.remove('mceModalBlocker');
+				DOM.setAttrib(DOM.doc.body, 'aria-hidden', 'false');
+				t.editor.focus();
+			}
+
+			if (w = t.windows[id]) {
+				t.onClose.dispatch(t);
+				Event.remove(d, 'mousedown', w.mousedownFunc);
+				Event.remove(d, 'click', w.clickFunc);
+				Event.clear(id);
+				Event.clear(id + '_ifr');
+
+				DOM.setAttrib(id + '_ifr', 'src', 'javascript:""'); // Prevent leak
+				w.element.remove();
+				delete t.windows[id];
+
+				fw = t._frontWindow();
+
+				if (fw)
+					t.focus(fw.id);
+			}
+		},
+		
+		// Find front most window
+		_frontWindow : function() {
+			var fw, ix = 0;
+			// Find front most window and focus that
+			each (this.windows, function(w) {
+				if (w.zIndex > ix) {
+					fw = w;
+					ix = w.zIndex;
+				}
+			});
+			return fw;
+		},
+
+		setTitle : function(w, ti) {
+			var e;
+
+			w = this._findId(w);
+
+			if (e = DOM.get(w + '_title'))
+				e.innerHTML = DOM.encode(ti);
+		},
+
+		alert : function(txt, cb, s) {
+			var t = this, w;
+
+			w = t.open({
+				title : t,
+				type : 'alert',
+				button_func : function(s) {
+					if (cb)
+						cb.call(s || t, s);
+
+					t.close(null, w.id);
+				},
+				content : DOM.encode(t.editor.getLang(txt, txt)),
+				inline : 1,
+				width : 400,
+				height : 130
+			});
+		},
+
+		confirm : function(txt, cb, s) {
+			var t = this, w;
+
+			w = t.open({
+				title : t,
+				type : 'confirm',
+				button_func : function(s) {
+					if (cb)
+						cb.call(s || t, s);
+
+					t.close(null, w.id);
+				},
+				content : DOM.encode(t.editor.getLang(txt, txt)),
+				inline : 1,
+				width : 400,
+				height : 130
+			});
+		},
+
+		// Internal functions
+
+		_findId : function(w) {
+			var t = this;
+
+			if (typeof(w) == 'string')
+				return w;
+
+			each(t.windows, function(wo) {
+				var ifr = DOM.get(wo.id + '_ifr');
+
+				if (ifr && w == ifr.contentWindow) {
+					w = wo.id;
+					return false;
+				}
+			});
+
+			return w;
+		},
+
+		_fixIELayout : function(id, s) {
+			var w, img;
+
+			if (!tinymce.isIE6)
+				return;
+
+			// Fixes the bug where hover flickers and does odd things in IE6
+			each(['n','s','w','e','nw','ne','sw','se'], function(v) {
+				var e = DOM.get(id + '_resize_' + v);
+
+				DOM.setStyles(e, {
+					width : s ? e.clientWidth : '',
+					height : s ? e.clientHeight : '',
+					cursor : DOM.getStyle(e, 'cursor', 1)
+				});
+
+				DOM.setStyle(id + "_bottom", 'bottom', '-1px');
+
+				e = 0;
+			});
+
+			// Fixes graphics glitch
+			if (w = this.windows[id]) {
+				// Fixes rendering bug after resize
+				w.element.hide();
+				w.element.show();
+
+				// Forced a repaint of the window
+				//DOM.get(id).style.filter = '';
+
+				// IE has a bug where images used in CSS won't get loaded
+				// sometimes when the cache in the browser is disabled
+				// This fix tries to solve it by loading the images using the image object
+				each(DOM.select('div,a', id), function(e, i) {
+					if (e.currentStyle.backgroundImage != 'none') {
+						img = new Image();
+						img.src = e.currentStyle.backgroundImage.replace(/url\(\"(.+)\"\)/, '$1');
+					}
+				});
+
+				DOM.get(id).style.filter = '';
+			}
+		}
+	});
+
+	// Register plugin
+	tinymce.PluginManager.add('inlinepopups', tinymce.plugins.InlinePopups);
+})();
+
Index: wp-includes/js/tinymce/plugins/tabfocus/editor_plugin.dev.js
===================================================================
--- wp-includes/js/tinymce/plugins/tabfocus/editor_plugin.dev.js	(revision 0)
+++ wp-includes/js/tinymce/plugins/tabfocus/editor_plugin.dev.js	(revision 0)
@@ -0,0 +1,122 @@
+/**
+ * editor_plugin_src.js
+ *
+ * Copyright 2009, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://tinymce.moxiecode.com/license
+ * Contributing: http://tinymce.moxiecode.com/contributing
+ */
+
+(function() {
+	var DOM = tinymce.DOM, Event = tinymce.dom.Event, each = tinymce.each, explode = tinymce.explode;
+
+	tinymce.create('tinymce.plugins.TabFocusPlugin', {
+		init : function(ed, url) {
+			function tabCancel(ed, e) {
+				if (e.keyCode === 9)
+					return Event.cancel(e);
+			}
+
+			function tabHandler(ed, e) {
+				var x, i, f, el, v;
+
+				function find(d) {
+					el = DOM.select(':input:enabled,*[tabindex]');
+
+					function canSelectRecursive(e) {
+						return e.nodeName==="BODY" || (e.type != 'hidden' &&
+							!(e.style.display == "none") &&
+							!(e.style.visibility == "hidden") && canSelectRecursive(e.parentNode));
+					}
+					function canSelectInOldIe(el) {
+						return el.attributes["tabIndex"].specified || el.nodeName == "INPUT" || el.nodeName == "TEXTAREA";
+					}
+					function isOldIe() {
+						return tinymce.isIE6 || tinymce.isIE7;
+					}
+					function canSelect(el) {
+						return ((!isOldIe() || canSelectInOldIe(el))) && el.getAttribute("tabindex") != '-1' && canSelectRecursive(el);
+					}
+
+					each(el, function(e, i) {
+						if (e.id == ed.id) {
+							x = i;
+							return false;
+						}
+					});
+					if (d > 0) {
+						for (i = x + 1; i < el.length; i++) {
+							if (canSelect(el[i]))
+								return el[i];
+						}
+					} else {
+						for (i = x - 1; i >= 0; i--) {
+							if (canSelect(el[i]))
+								return el[i];
+						}
+					}
+
+					return null;
+				}
+
+				if (e.keyCode === 9) {
+					v = explode(ed.getParam('tab_focus', ed.getParam('tabfocus_elements', ':prev,:next')));
+
+					if (v.length == 1) {
+						v[1] = v[0];
+						v[0] = ':prev';
+					}
+
+					// Find element to focus
+					if (e.shiftKey) {
+						if (v[0] == ':prev')
+							el = find(-1);
+						else
+							el = DOM.get(v[0]);
+					} else {
+						if (v[1] == ':next')
+							el = find(1);
+						else
+							el = DOM.get(v[1]);
+					}
+
+					if (el) {
+						if (el.id && (ed = tinymce.get(el.id || el.name)))
+							ed.focus();
+						else
+							window.setTimeout(function() {
+								if (!tinymce.isWebKit)
+									window.focus();
+								el.focus();
+							}, 10);
+
+						return Event.cancel(e);
+					}
+				}
+			}
+
+			ed.onKeyUp.add(tabCancel);
+
+			if (tinymce.isGecko) {
+				ed.onKeyPress.add(tabHandler);
+				ed.onKeyDown.add(tabCancel);
+			} else
+				ed.onKeyDown.add(tabHandler);
+
+		},
+
+		getInfo : function() {
+			return {
+				longname : 'Tabfocus',
+				author : 'Moxiecode Systems AB',
+				authorurl : 'http://tinymce.moxiecode.com',
+				infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/tabfocus',
+				version : tinymce.majorVersion + "." + tinymce.minorVersion
+			};
+		}
+	});
+
+	// Register plugin
+	tinymce.PluginManager.add('tabfocus', tinymce.plugins.TabFocusPlugin);
+})();
Index: wp-includes/js/tinymce/plugins/paste/editor_plugin.dev.js
===================================================================
--- wp-includes/js/tinymce/plugins/paste/editor_plugin.dev.js	(revision 0)
+++ wp-includes/js/tinymce/plugins/paste/editor_plugin.dev.js	(revision 0)
@@ -0,0 +1,871 @@
+/**
+ * editor_plugin_src.js
+ *
+ * Copyright 2009, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://tinymce.moxiecode.com/license
+ * Contributing: http://tinymce.moxiecode.com/contributing
+ */
+
+(function() {
+	var each = tinymce.each,
+		defs = {
+			paste_auto_cleanup_on_paste : true,
+			paste_enable_default_filters : true,
+			paste_block_drop : false,
+			paste_retain_style_properties : "none",
+			paste_strip_class_attributes : "mso",
+			paste_remove_spans : false,
+			paste_remove_styles : false,
+			paste_remove_styles_if_webkit : true,
+			paste_convert_middot_lists : true,
+			paste_convert_headers_to_strong : false,
+			paste_dialog_width : "450",
+			paste_dialog_height : "400",
+			paste_text_use_dialog : false,
+			paste_text_sticky : false,
+			paste_text_sticky_default : false,
+			paste_text_notifyalways : false,
+			paste_text_linebreaktype : "combined",
+			paste_text_replacements : [
+				[/\u2026/g, "..."],
+				[/[\x93\x94\u201c\u201d]/g, '"'],
+				[/[\x60\x91\x92\u2018\u2019]/g, "'"]
+			]
+		};
+
+	function getParam(ed, name) {
+		return ed.getParam(name, defs[name]);
+	}
+
+	tinymce.create('tinymce.plugins.PastePlugin', {
+		init : function(ed, url) {
+			var t = this;
+
+			t.editor = ed;
+			t.url = url;
+
+			// Setup plugin events
+			t.onPreProcess = new tinymce.util.Dispatcher(t);
+			t.onPostProcess = new tinymce.util.Dispatcher(t);
+
+			// Register default handlers
+			t.onPreProcess.add(t._preProcess);
+			t.onPostProcess.add(t._postProcess);
+
+			// Register optional preprocess handler
+			t.onPreProcess.add(function(pl, o) {
+				ed.execCallback('paste_preprocess', pl, o);
+			});
+
+			// Register optional postprocess
+			t.onPostProcess.add(function(pl, o) {
+				ed.execCallback('paste_postprocess', pl, o);
+			});
+
+			ed.onKeyDown.addToTop(function(ed, e) {
+				// Block ctrl+v from adding an undo level since the default logic in tinymce.Editor will add that
+				if (((tinymce.isMac ? e.metaKey : e.ctrlKey) && e.keyCode == 86) || (e.shiftKey && e.keyCode == 45))
+					return false; // Stop other listeners
+			});
+
+			// Initialize plain text flag
+			ed.pasteAsPlainText = getParam(ed, 'paste_text_sticky_default');
+
+			// This function executes the process handlers and inserts the contents
+			// force_rich overrides plain text mode set by user, important for pasting with execCommand
+			function process(o, force_rich) {
+				var dom = ed.dom, rng;
+
+				// Execute pre process handlers
+				t.onPreProcess.dispatch(t, o);
+
+				// Create DOM structure
+				o.node = dom.create('div', 0, o.content);
+
+				// If pasting inside the same element and the contents is only one block
+				// remove the block and keep the text since Firefox will copy parts of pre and h1-h6 as a pre element
+				if (tinymce.isGecko) {
+					rng = ed.selection.getRng(true);
+					if (rng.startContainer == rng.endContainer && rng.startContainer.nodeType == 3) {
+						// Is only one block node and it doesn't contain word stuff
+						if (o.node.childNodes.length === 1 && /^(p|h[1-6]|pre)$/i.test(o.node.firstChild.nodeName) && o.content.indexOf('__MCE_ITEM__') === -1)
+							dom.remove(o.node.firstChild, true);
+					}
+				}
+
+				// Execute post process handlers
+				t.onPostProcess.dispatch(t, o);
+
+				// Serialize content
+				o.content = ed.serializer.serialize(o.node, {getInner : 1, forced_root_block : ''});
+
+				// Plain text option active?
+				if ((!force_rich) && (ed.pasteAsPlainText)) {
+					t._insertPlainText(o.content);
+
+					if (!getParam(ed, "paste_text_sticky")) {
+						ed.pasteAsPlainText = false;
+						ed.controlManager.setActive("pastetext", false);
+					}
+				} else {
+					t._insert(o.content);
+				}
+			}
+
+			// Add command for external usage
+			ed.addCommand('mceInsertClipboardContent', function(u, o) {
+				process(o, true);
+			});
+
+			if (!getParam(ed, "paste_text_use_dialog")) {
+				ed.addCommand('mcePasteText', function(u, v) {
+					var cookie = tinymce.util.Cookie;
+
+					ed.pasteAsPlainText = !ed.pasteAsPlainText;
+					ed.controlManager.setActive('pastetext', ed.pasteAsPlainText);
+
+					if ((ed.pasteAsPlainText) && (!cookie.get("tinymcePasteText"))) {
+						if (getParam(ed, "paste_text_sticky")) {
+							ed.windowManager.alert(ed.translate('paste.plaintext_mode_sticky'));
+						} else {
+							ed.windowManager.alert(ed.translate('paste.plaintext_mode'));
+						}
+
+						if (!getParam(ed, "paste_text_notifyalways")) {
+							cookie.set("tinymcePasteText", "1", new Date(new Date().getFullYear() + 1, 12, 31))
+						}
+					}
+				});
+			}
+
+			ed.addButton('pastetext', {title: 'paste.paste_text_desc', cmd: 'mcePasteText'});
+			ed.addButton('selectall', {title: 'paste.selectall_desc', cmd: 'selectall'});
+
+			// This function grabs the contents from the clipboard by adding a
+			// hidden div and placing the caret inside it and after the browser paste
+			// is done it grabs that contents and processes that
+			function grabContent(e) {
+				var n, or, rng, oldRng, sel = ed.selection, dom = ed.dom, body = ed.getBody(), posY, textContent;
+
+				// Check if browser supports direct plaintext access
+				if (e.clipboardData || dom.doc.dataTransfer) {
+					textContent = (e.clipboardData || dom.doc.dataTransfer).getData('Text');
+
+					if (ed.pasteAsPlainText) {
+						e.preventDefault();
+						process({content : dom.encode(textContent).replace(/\r?\n/g, '<br />')});
+						return;
+					}
+				}
+
+				if (dom.get('_mcePaste'))
+					return;
+
+				// Create container to paste into
+				n = dom.add(body, 'div', {id : '_mcePaste', 'class' : 'mcePaste', 'data-mce-bogus' : '1'}, '\uFEFF\uFEFF');
+
+				// If contentEditable mode we need to find out the position of the closest element
+				if (body != ed.getDoc().body)
+					posY = dom.getPos(ed.selection.getStart(), body).y;
+				else
+					posY = body.scrollTop + dom.getViewPort(ed.getWin()).y;
+
+				// Styles needs to be applied after the element is added to the document since WebKit will otherwise remove all styles
+				// If also needs to be in view on IE or the paste would fail
+				dom.setStyles(n, {
+					position : 'absolute',
+					left : tinymce.isGecko ? -40 : 0, // Need to move it out of site on Gecko since it will othewise display a ghost resize rect for the div
+					top : posY - 25,
+					width : 1,
+					height : 1,
+					overflow : 'hidden'
+				});
+
+				if (tinymce.isIE) {
+					// Store away the old range
+					oldRng = sel.getRng();
+
+					// Select the container
+					rng = dom.doc.body.createTextRange();
+					rng.moveToElementText(n);
+					rng.execCommand('Paste');
+
+					// Remove container
+					dom.remove(n);
+
+					// Check if the contents was changed, if it wasn't then clipboard extraction failed probably due
+					// to IE security settings so we pass the junk though better than nothing right
+					if (n.innerHTML === '\uFEFF\uFEFF') {
+						ed.execCommand('mcePasteWord');
+						e.preventDefault();
+						return;
+					}
+
+					// Restore the old range and clear the contents before pasting
+					sel.setRng(oldRng);
+					sel.setContent('');
+
+					// For some odd reason we need to detach the the mceInsertContent call from the paste event
+					// It's like IE has a reference to the parent element that you paste in and the selection gets messed up
+					// when it tries to restore the selection
+					setTimeout(function() {
+						// Process contents
+						process({content : n.innerHTML});
+					}, 0);
+
+					// Block the real paste event
+					return tinymce.dom.Event.cancel(e);
+				} else {
+					function block(e) {
+						e.preventDefault();
+					};
+
+					// Block mousedown and click to prevent selection change
+					dom.bind(ed.getDoc(), 'mousedown', block);
+					dom.bind(ed.getDoc(), 'keydown', block);
+
+					or = ed.selection.getRng();
+
+					// Move select contents inside DIV
+					n = n.firstChild;
+					rng = ed.getDoc().createRange();
+					rng.setStart(n, 0);
+					rng.setEnd(n, 2);
+					sel.setRng(rng);
+
+					// Wait a while and grab the pasted contents
+					window.setTimeout(function() {
+						var h = '', nl;
+
+						// Paste divs duplicated in paste divs seems to happen when you paste plain text so lets first look for that broken behavior in WebKit
+						if (!dom.select('div.mcePaste > div.mcePaste').length) {
+							nl = dom.select('div.mcePaste');
+
+							// WebKit will split the div into multiple ones so this will loop through then all and join them to get the whole HTML string
+							each(nl, function(n) {
+								var child = n.firstChild;
+
+								// WebKit inserts a DIV container with lots of odd styles
+								if (child && child.nodeName == 'DIV' && child.style.marginTop && child.style.backgroundColor) {
+									dom.remove(child, 1);
+								}
+
+								// Remove apply style spans
+								each(dom.select('span.Apple-style-span', n), function(n) {
+									dom.remove(n, 1);
+								});
+
+								// Remove bogus br elements
+								each(dom.select('br[data-mce-bogus]', n), function(n) {
+									dom.remove(n);
+								});
+
+								// WebKit will make a copy of the DIV for each line of plain text pasted and insert them into the DIV
+								if (n.parentNode.className != 'mcePaste')
+									h += n.innerHTML;
+							});
+						} else {
+							// Found WebKit weirdness so force the content into paragraphs this seems to happen when you paste plain text from Nodepad etc
+							// So this logic will replace double enter with paragraphs and single enter with br so it kind of looks the same
+							h = '<p>' + dom.encode(textContent).replace(/\r?\n\r?\n/g, '</p><p>').replace(/\r?\n/g, '<br />') + '</p>';
+						}
+
+						// Remove the nodes
+						each(dom.select('div.mcePaste'), function(n) {
+							dom.remove(n);
+						});
+
+						// Restore the old selection
+						if (or)
+							sel.setRng(or);
+
+						process({content : h});
+
+						// Unblock events ones we got the contents
+						dom.unbind(ed.getDoc(), 'mousedown', block);
+						dom.unbind(ed.getDoc(), 'keydown', block);
+					}, 0);
+				}
+			}
+
+			// Check if we should use the new auto process method			
+			if (getParam(ed, "paste_auto_cleanup_on_paste")) {
+				// Is it's Opera or older FF use key handler
+				if (tinymce.isOpera || /Firefox\/2/.test(navigator.userAgent)) {
+					ed.onKeyDown.addToTop(function(ed, e) {
+						if (((tinymce.isMac ? e.metaKey : e.ctrlKey) && e.keyCode == 86) || (e.shiftKey && e.keyCode == 45))
+							grabContent(e);
+					});
+				} else {
+					// Grab contents on paste event on Gecko and WebKit
+					ed.onPaste.addToTop(function(ed, e) {
+						return grabContent(e);
+					});
+				}
+			}
+
+			ed.onInit.add(function() {
+				ed.controlManager.setActive("pastetext", ed.pasteAsPlainText);
+
+				// Block all drag/drop events
+				if (getParam(ed, "paste_block_drop")) {
+					ed.dom.bind(ed.getBody(), ['dragend', 'dragover', 'draggesture', 'dragdrop', 'drop', 'drag'], function(e) {
+						e.preventDefault();
+						e.stopPropagation();
+
+						return false;
+					});
+				}
+			});
+
+			// Add legacy support
+			t._legacySupport();
+		},
+
+		getInfo : function() {
+			return {
+				longname : 'Paste text/word',
+				author : 'Moxiecode Systems AB',
+				authorurl : 'http://tinymce.moxiecode.com',
+				infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/paste',
+				version : tinymce.majorVersion + "." + tinymce.minorVersion
+			};
+		},
+
+		_preProcess : function(pl, o) {
+			var ed = this.editor,
+				h = o.content,
+				grep = tinymce.grep,
+				explode = tinymce.explode,
+				trim = tinymce.trim,
+				len, stripClass;
+
+			//console.log('Before preprocess:' + o.content);
+
+			function process(items) {
+				each(items, function(v) {
+					// Remove or replace
+					if (v.constructor == RegExp)
+						h = h.replace(v, '');
+					else
+						h = h.replace(v[0], v[1]);
+				});
+			}
+			
+			if (ed.settings.paste_enable_default_filters == false) {
+				return;
+			}
+
+			// IE9 adds BRs before/after block elements when contents is pasted from word or for example another browser
+			if (tinymce.isIE && document.documentMode >= 9) {
+				// IE9 adds BRs before/after block elements when contents is pasted from word or for example another browser
+				process([[/(?:<br>&nbsp;[\s\r\n]+|<br>)*(<\/?(h[1-6r]|p|div|address|pre|form|table|tbody|thead|tfoot|th|tr|td|li|ol|ul|caption|blockquote|center|dl|dt|dd|dir|fieldset)[^>]*>)(?:<br>&nbsp;[\s\r\n]+|<br>)*/g, '$1']]);
+
+				// IE9 also adds an extra BR element for each soft-linefeed and it also adds a BR for each word wrap break
+				process([
+					[/<br><br>/g, '<BR><BR>'], // Replace multiple BR elements with uppercase BR to keep them intact
+					[/<br>/g, ' '], // Replace single br elements with space since they are word wrap BR:s
+					[/<BR><BR>/g, '<br>'] // Replace back the double brs but into a single BR
+				]);
+			}
+
+			// Detect Word content and process it more aggressive
+			if (/class="?Mso|style="[^"]*\bmso-|w:WordDocument/i.test(h) || o.wordContent) {
+				o.wordContent = true;			// Mark the pasted contents as word specific content
+				//console.log('Word contents detected.');
+
+				// Process away some basic content
+				process([
+					/^\s*(&nbsp;)+/gi,				// &nbsp; entities at the start of contents
+					/(&nbsp;|<br[^>]*>)+\s*$/gi		// &nbsp; entities at the end of contents
+				]);
+
+				if (getParam(ed, "paste_convert_headers_to_strong")) {
+					h = h.replace(/<p [^>]*class="?MsoHeading"?[^>]*>(.*?)<\/p>/gi, "<p><strong>$1</strong></p>");
+				}
+
+				if (getParam(ed, "paste_convert_middot_lists")) {
+					process([
+						[/<!--\[if !supportLists\]-->/gi, '$&__MCE_ITEM__'],					// Convert supportLists to a list item marker
+						[/(<span[^>]+(?:mso-list:|:\s*symbol)[^>]+>)/gi, '$1__MCE_ITEM__'],		// Convert mso-list and symbol spans to item markers
+						[/(<p[^>]+(?:MsoListParagraph)[^>]+>)/gi, '$1__MCE_ITEM__']				// Convert mso-list and symbol paragraphs to item markers (FF)
+					]);
+				}
+
+				process([
+					// Word comments like conditional comments etc
+					/<!--[\s\S]+?-->/gi,
+
+					// Remove comments, scripts (e.g., msoShowComment), XML tag, VML content, MS Office namespaced tags, and a few other tags
+					/<(!|script[^>]*>.*?<\/script(?=[>\s])|\/?(\?xml(:\w+)?|img|meta|link|style|\w:\w+)(?=[\s\/>]))[^>]*>/gi,
+
+					// Convert <s> into <strike> for line-though
+					[/<(\/?)s>/gi, "<$1strike>"],
+
+					// Replace nsbp entites to char since it's easier to handle
+					[/&nbsp;/gi, "\u00a0"]
+				]);
+
+				// Remove bad attributes, with or without quotes, ensuring that attribute text is really inside a tag.
+				// If JavaScript had a RegExp look-behind, we could have integrated this with the last process() array and got rid of the loop. But alas, it does not, so we cannot.
+				do {
+					len = h.length;
+					h = h.replace(/(<[a-z][^>]*\s)(?:id|name|language|type|on\w+|\w+:\w+)=(?:"[^"]*"|\w+)\s?/gi, "$1");
+				} while (len != h.length);
+
+				// Remove all spans if no styles is to be retained
+				if (getParam(ed, "paste_retain_style_properties").replace(/^none$/i, "").length == 0) {
+					h = h.replace(/<\/?span[^>]*>/gi, "");
+				} else {
+					// We're keeping styles, so at least clean them up.
+					// CSS Reference: http://msdn.microsoft.com/en-us/library/aa155477.aspx
+
+					process([
+						// Convert <span style="mso-spacerun:yes">___</span> to string of alternating breaking/non-breaking spaces of same length
+						[/<span\s+style\s*=\s*"\s*mso-spacerun\s*:\s*yes\s*;?\s*"\s*>([\s\u00a0]*)<\/span>/gi,
+							function(str, spaces) {
+								return (spaces.length > 0)? spaces.replace(/./, " ").slice(Math.floor(spaces.length/2)).split("").join("\u00a0") : "";
+							}
+						],
+
+						// Examine all styles: delete junk, transform some, and keep the rest
+						[/(<[a-z][^>]*)\sstyle="([^"]*)"/gi,
+							function(str, tag, style) {
+								var n = [],
+									i = 0,
+									s = explode(trim(style).replace(/&quot;/gi, "'"), ";");
+
+								// Examine each style definition within the tag's style attribute
+								each(s, function(v) {
+									var name, value,
+										parts = explode(v, ":");
+
+									function ensureUnits(v) {
+										return v + ((v !== "0") && (/\d$/.test(v)))? "px" : "";
+									}
+
+									if (parts.length == 2) {
+										name = parts[0].toLowerCase();
+										value = parts[1].toLowerCase();
+
+										// Translate certain MS Office styles into their CSS equivalents
+										switch (name) {
+											case "mso-padding-alt":
+											case "mso-padding-top-alt":
+											case "mso-padding-right-alt":
+											case "mso-padding-bottom-alt":
+											case "mso-padding-left-alt":
+											case "mso-margin-alt":
+											case "mso-margin-top-alt":
+											case "mso-margin-right-alt":
+											case "mso-margin-bottom-alt":
+											case "mso-margin-left-alt":
+											case "mso-table-layout-alt":
+											case "mso-height":
+											case "mso-width":
+											case "mso-vertical-align-alt":
+												n[i++] = name.replace(/^mso-|-alt$/g, "") + ":" + ensureUnits(value);
+												return;
+
+											case "horiz-align":
+												n[i++] = "text-align:" + value;
+												return;
+
+											case "vert-align":
+												n[i++] = "vertical-align:" + value;
+												return;
+
+											case "font-color":
+											case "mso-foreground":
+												n[i++] = "color:" + value;
+												return;
+
+											case "mso-background":
+											case "mso-highlight":
+												n[i++] = "background:" + value;
+												return;
+
+											case "mso-default-height":
+												n[i++] = "min-height:" + ensureUnits(value);
+												return;
+
+											case "mso-default-width":
+												n[i++] = "min-width:" + ensureUnits(value);
+												return;
+
+											case "mso-padding-between-alt":
+												n[i++] = "border-collapse:separate;border-spacing:" + ensureUnits(value);
+												return;
+
+											case "text-line-through":
+												if ((value == "single") || (value == "double")) {
+													n[i++] = "text-decoration:line-through";
+												}
+												return;
+
+											case "mso-zero-height":
+												if (value == "yes") {
+													n[i++] = "display:none";
+												}
+												return;
+										}
+
+										// Eliminate all MS Office style definitions that have no CSS equivalent by examining the first characters in the name
+										if (/^(mso|column|font-emph|lang|layout|line-break|list-image|nav|panose|punct|row|ruby|sep|size|src|tab-|table-border|text-(?!align|decor|indent|trans)|top-bar|version|vnd|word-break)/.test(name)) {
+											return;
+										}
+
+										// If it reached this point, it must be a valid CSS style
+										n[i++] = name + ":" + parts[1];		// Lower-case name, but keep value case
+									}
+								});
+
+								// If style attribute contained any valid styles the re-write it; otherwise delete style attribute.
+								if (i > 0) {
+									return tag + ' style="' + n.join(';') + '"';
+								} else {
+									return tag;
+								}
+							}
+						]
+					]);
+				}
+			}
+
+			// Replace headers with <strong>
+			if (getParam(ed, "paste_convert_headers_to_strong")) {
+				process([
+					[/<h[1-6][^>]*>/gi, "<p><strong>"],
+					[/<\/h[1-6][^>]*>/gi, "</strong></p>"]
+				]);
+			}
+
+			process([
+				// Copy paste from Java like Open Office will produce this junk on FF
+				[/Version:[\d.]+\nStartHTML:\d+\nEndHTML:\d+\nStartFragment:\d+\nEndFragment:\d+/gi, '']
+			]);
+
+			// Class attribute options are: leave all as-is ("none"), remove all ("all"), or remove only those starting with mso ("mso").
+			// Note:-  paste_strip_class_attributes: "none", verify_css_classes: true is also a good variation.
+			stripClass = getParam(ed, "paste_strip_class_attributes");
+
+			if (stripClass !== "none") {
+				function removeClasses(match, g1) {
+						if (stripClass === "all")
+							return '';
+
+						var cls = grep(explode(g1.replace(/^(["'])(.*)\1$/, "$2"), " "),
+							function(v) {
+								return (/^(?!mso)/i.test(v));
+							}
+						);
+
+						return cls.length ? ' class="' + cls.join(" ") + '"' : '';
+				};
+
+				h = h.replace(/ class="([^"]+)"/gi, removeClasses);
+				h = h.replace(/ class=([\-\w]+)/gi, removeClasses);
+			}
+
+			// Remove spans option
+			if (getParam(ed, "paste_remove_spans")) {
+				h = h.replace(/<\/?span[^>]*>/gi, "");
+			}
+
+			//console.log('After preprocess:' + h);
+
+			o.content = h;
+		},
+
+		/**
+		 * Various post process items.
+		 */
+		_postProcess : function(pl, o) {
+			var t = this, ed = t.editor, dom = ed.dom, styleProps;
+
+			if (ed.settings.paste_enable_default_filters == false) {
+				return;
+			}
+			
+			if (o.wordContent) {
+				// Remove named anchors or TOC links
+				each(dom.select('a', o.node), function(a) {
+					if (!a.href || a.href.indexOf('#_Toc') != -1)
+						dom.remove(a, 1);
+				});
+
+				if (getParam(ed, "paste_convert_middot_lists")) {
+					t._convertLists(pl, o);
+				}
+
+				// Process styles
+				styleProps = getParam(ed, "paste_retain_style_properties"); // retained properties
+
+				// Process only if a string was specified and not equal to "all" or "*"
+				if ((tinymce.is(styleProps, "string")) && (styleProps !== "all") && (styleProps !== "*")) {
+					styleProps = tinymce.explode(styleProps.replace(/^none$/i, ""));
+
+					// Retains some style properties
+					each(dom.select('*', o.node), function(el) {
+						var newStyle = {}, npc = 0, i, sp, sv;
+
+						// Store a subset of the existing styles
+						if (styleProps) {
+							for (i = 0; i < styleProps.length; i++) {
+								sp = styleProps[i];
+								sv = dom.getStyle(el, sp);
+
+								if (sv) {
+									newStyle[sp] = sv;
+									npc++;
+								}
+							}
+						}
+
+						// Remove all of the existing styles
+						dom.setAttrib(el, 'style', '');
+
+						if (styleProps && npc > 0)
+							dom.setStyles(el, newStyle); // Add back the stored subset of styles
+						else // Remove empty span tags that do not have class attributes
+							if (el.nodeName == 'SPAN' && !el.className)
+								dom.remove(el, true);
+					});
+				}
+			}
+
+			// Remove all style information or only specifically on WebKit to avoid the style bug on that browser
+			if (getParam(ed, "paste_remove_styles") || (getParam(ed, "paste_remove_styles_if_webkit") && tinymce.isWebKit)) {
+				each(dom.select('*[style]', o.node), function(el) {
+					el.removeAttribute('style');
+					el.removeAttribute('data-mce-style');
+				});
+			} else {
+				if (tinymce.isWebKit) {
+					// We need to compress the styles on WebKit since if you paste <img border="0" /> it will become <img border="0" style="... lots of junk ..." />
+					// Removing the mce_style that contains the real value will force the Serializer engine to compress the styles
+					each(dom.select('*', o.node), function(el) {
+						el.removeAttribute('data-mce-style');
+					});
+				}
+			}
+		},
+
+		/**
+		 * Converts the most common bullet and number formats in Office into a real semantic UL/LI list.
+		 */
+		_convertLists : function(pl, o) {
+			var dom = pl.editor.dom, listElm, li, lastMargin = -1, margin, levels = [], lastType, html;
+
+			// Convert middot lists into real semantic lists
+			each(dom.select('p', o.node), function(p) {
+				var sib, val = '', type, html, idx, parents;
+
+				// Get text node value at beginning of paragraph
+				for (sib = p.firstChild; sib && sib.nodeType == 3; sib = sib.nextSibling)
+					val += sib.nodeValue;
+
+				val = p.innerHTML.replace(/<\/?\w+[^>]*>/gi, '').replace(/&nbsp;/g, '\u00a0');
+
+				// Detect unordered lists look for bullets
+				if (/^(__MCE_ITEM__)+[\u2022\u00b7\u00a7\u00d8o\u25CF]\s*\u00a0*/.test(val))
+					type = 'ul';
+
+				// Detect ordered lists 1., a. or ixv.
+				if (/^__MCE_ITEM__\s*\w+\.\s*\u00a0+/.test(val))
+					type = 'ol';
+
+				// Check if node value matches the list pattern: o&nbsp;&nbsp;
+				if (type) {
+					margin = parseFloat(p.style.marginLeft || 0);
+
+					if (margin > lastMargin)
+						levels.push(margin);
+
+					if (!listElm || type != lastType) {
+						listElm = dom.create(type);
+						dom.insertAfter(listElm, p);
+					} else {
+						// Nested list element
+						if (margin > lastMargin) {
+							listElm = li.appendChild(dom.create(type));
+						} else if (margin < lastMargin) {
+							// Find parent level based on margin value
+							idx = tinymce.inArray(levels, margin);
+							parents = dom.getParents(listElm.parentNode, type);
+							listElm = parents[parents.length - 1 - idx] || listElm;
+						}
+					}
+
+					// Remove middot or number spans if they exists
+					each(dom.select('span', p), function(span) {
+						var html = span.innerHTML.replace(/<\/?\w+[^>]*>/gi, '');
+
+						// Remove span with the middot or the number
+						if (type == 'ul' && /^__MCE_ITEM__[\u2022\u00b7\u00a7\u00d8o\u25CF]/.test(html))
+							dom.remove(span);
+						else if (/^__MCE_ITEM__[\s\S]*\w+\.(&nbsp;|\u00a0)*\s*/.test(html))
+							dom.remove(span);
+					});
+
+					html = p.innerHTML;
+
+					// Remove middot/list items
+					if (type == 'ul')
+						html = p.innerHTML.replace(/__MCE_ITEM__/g, '').replace(/^[\u2022\u00b7\u00a7\u00d8o\u25CF]\s*(&nbsp;|\u00a0)+\s*/, '');
+					else
+						html = p.innerHTML.replace(/__MCE_ITEM__/g, '').replace(/^\s*\w+\.(&nbsp;|\u00a0)+\s*/, '');
+
+					// Create li and add paragraph data into the new li
+					li = listElm.appendChild(dom.create('li', 0, html));
+					dom.remove(p);
+
+					lastMargin = margin;
+					lastType = type;
+				} else
+					listElm = lastMargin = 0; // End list element
+			});
+
+			// Remove any left over makers
+			html = o.node.innerHTML;
+			if (html.indexOf('__MCE_ITEM__') != -1)
+				o.node.innerHTML = html.replace(/__MCE_ITEM__/g, '');
+		},
+
+		/**
+		 * Inserts the specified contents at the caret position.
+		 */
+		_insert : function(h, skip_undo) {
+			var ed = this.editor, r = ed.selection.getRng();
+
+			// First delete the contents seems to work better on WebKit when the selection spans multiple list items or multiple table cells.
+			if (!ed.selection.isCollapsed() && r.startContainer != r.endContainer)
+				ed.getDoc().execCommand('Delete', false, null);
+
+			ed.execCommand('mceInsertContent', false, h, {skip_undo : skip_undo});
+		},
+
+		/**
+		 * Instead of the old plain text method which tried to re-create a paste operation, the
+		 * new approach adds a plain text mode toggle switch that changes the behavior of paste.
+		 * This function is passed the same input that the regular paste plugin produces.
+		 * It performs additional scrubbing and produces (and inserts) the plain text.
+		 * This approach leverages all of the great existing functionality in the paste
+		 * plugin, and requires minimal changes to add the new functionality.
+		 * Speednet - June 2009
+		 */
+		_insertPlainText : function(content) {
+			var ed = this.editor,
+				linebr = getParam(ed, "paste_text_linebreaktype"),
+				rl = getParam(ed, "paste_text_replacements"),
+				is = tinymce.is;
+
+			function process(items) {
+				each(items, function(v) {
+					if (v.constructor == RegExp)
+						content = content.replace(v, "");
+					else
+						content = content.replace(v[0], v[1]);
+				});
+			};
+
+			if ((typeof(content) === "string") && (content.length > 0)) {
+				// If HTML content with line-breaking tags, then remove all cr/lf chars because only tags will break a line
+				if (/<(?:p|br|h[1-6]|ul|ol|dl|table|t[rdh]|div|blockquote|fieldset|pre|address|center)[^>]*>/i.test(content)) {
+					process([
+						/[\n\r]+/g
+					]);
+				} else {
+					// Otherwise just get rid of carriage returns (only need linefeeds)
+					process([
+						/\r+/g
+					]);
+				}
+
+				process([
+					[/<\/(?:p|h[1-6]|ul|ol|dl|table|div|blockquote|fieldset|pre|address|center)>/gi, "\n\n"],		// Block tags get a blank line after them
+					[/<br[^>]*>|<\/tr>/gi, "\n"],				// Single linebreak for <br /> tags and table rows
+					[/<\/t[dh]>\s*<t[dh][^>]*>/gi, "\t"],		// Table cells get tabs betweem them
+					/<[a-z!\/?][^>]*>/gi,						// Delete all remaining tags
+					[/&nbsp;/gi, " "],							// Convert non-break spaces to regular spaces (remember, *plain text*)
+					[/(?:(?!\n)\s)*(\n+)(?:(?!\n)\s)*/gi, "$1"],// Cool little RegExp deletes whitespace around linebreak chars.
+					[/\n{3,}/g, "\n\n"]							// Max. 2 consecutive linebreaks
+				]);
+
+				content = ed.dom.decode(tinymce.html.Entities.encodeRaw(content));
+
+				// Perform default or custom replacements
+				if (is(rl, "array")) {
+					process(rl);
+				} else if (is(rl, "string")) {
+					process(new RegExp(rl, "gi"));
+				}
+
+				// Treat paragraphs as specified in the config
+				if (linebr == "none") {
+					// Convert all line breaks to space
+					process([
+						[/\n+/g, " "]
+					]);
+				} else if (linebr == "br") {
+					// Convert all line breaks to <br />
+					process([
+						[/\n/g, "<br />"]
+					]);
+				} else if (linebr == "p") {
+					// Convert all line breaks to <p>...</p>
+					process([
+						[/\n+/g, "</p><p>"],
+						[/^(.*<\/p>)(<p>)$/, '<p>$1']
+					]);
+				} else {
+					// defaults to "combined"
+					// Convert single line breaks to <br /> and double line breaks to <p>...</p>
+					process([
+						[/\n\n/g, "</p><p>"],
+						[/^(.*<\/p>)(<p>)$/, '<p>$1'],
+						[/\n/g, "<br />"]
+					]);
+				}
+
+				ed.execCommand('mceInsertContent', false, content);
+			}
+		},
+
+		/**
+		 * This method will open the old style paste dialogs. Some users might want the old behavior but still use the new cleanup engine.
+		 */
+		_legacySupport : function() {
+			var t = this, ed = t.editor;
+
+			// Register command(s) for backwards compatibility
+			ed.addCommand("mcePasteWord", function() {
+				ed.windowManager.open({
+					file: t.url + "/pasteword.htm",
+					width: parseInt(getParam(ed, "paste_dialog_width")),
+					height: parseInt(getParam(ed, "paste_dialog_height")),
+					inline: 1
+				});
+			});
+
+			if (getParam(ed, "paste_text_use_dialog")) {
+				ed.addCommand("mcePasteText", function() {
+					ed.windowManager.open({
+						file : t.url + "/pastetext.htm",
+						width: parseInt(getParam(ed, "paste_dialog_width")),
+						height: parseInt(getParam(ed, "paste_dialog_height")),
+						inline : 1
+					});
+				});
+			}
+
+			// Register button for backwards compatibility
+			ed.addButton("pasteword", {title : "paste.paste_word_desc", cmd : "mcePasteWord"});
+		}
+	});
+
+	// Register plugin
+	tinymce.PluginManager.add("paste", tinymce.plugins.PastePlugin);
+})();
Index: wp-includes/js/tinymce/themes/advanced/editor_template.dev.js
===================================================================
--- wp-includes/js/tinymce/themes/advanced/editor_template.dev.js	(revision 0)
+++ wp-includes/js/tinymce/themes/advanced/editor_template.dev.js	(revision 0)
@@ -0,0 +1,1362 @@
+/**
+ * editor_template_src.js
+ *
+ * Copyright 2009, Moxiecode Systems AB
+ * Released under LGPL License.
+ *
+ * License: http://tinymce.moxiecode.com/license
+ * Contributing: http://tinymce.moxiecode.com/contributing
+ */
+
+(function(tinymce) {
+	var DOM = tinymce.DOM, Event = tinymce.dom.Event, extend = tinymce.extend, each = tinymce.each, Cookie = tinymce.util.Cookie, lastExtID, explode = tinymce.explode;
+
+	// Tell it to load theme specific language pack(s)
+	tinymce.ThemeManager.requireLangPack('advanced');
+
+	tinymce.create('tinymce.themes.AdvancedTheme', {
+		sizes : [8, 10, 12, 14, 18, 24, 36],
+
+		// 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']
+		},
+
+		stateControls : ['bold', 'italic', 'underline', 'strikethrough', 'bullist', 'numlist', 'justifyleft', 'justifycenter', 'justifyright', 'justifyfull', 'sub', 'sup', 'blockquote'],
+
+		init : function(ed, url) {
+			var t = this, s, v, o;
+	
+			t.editor = ed;
+			t.url = url;
+			t.onResolveName = new tinymce.util.Dispatcher(this);
+
+			ed.forcedHighContrastMode = ed.settings.detect_highcontrast && t._isHighContrast();
+			ed.settings.skin = ed.forcedHighContrastMode ? 'highcontrast' : ed.settings.skin;
+
+			// 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",
+				theme_advanced_font_selector : "span",
+				theme_advanced_show_current_color: 0,
+				readonly : ed.settings.readonly
+			}, ed.settings);
+
+			// Setup default font_size_style_values
+			if (!s.font_size_style_values)
+				s.font_size_style_values = "8pt,10pt,12pt,14pt,18pt,24pt,36pt";
+
+			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 || '');
+
+				// 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;
+
+					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');
+					}
+
+					if (/^\s*\./.test(v))
+						cl = v.replace(/\./g, '');
+
+					o[k] = cl ? {'class' : cl} : {fontSize : v};
+				});
+
+				s.theme_advanced_font_sizes = o;
+			}
+
+			if ((v = s.theme_advanced_path_location) && v != 'none')
+				s.theme_advanced_statusbar_location = s.theme_advanced_path_location;
+
+			if (s.theme_advanced_statusbar_location == 'none')
+				s.theme_advanced_statusbar_location = 0;
+
+			if (ed.settings.content_css !== false)
+				ed.contentCSS.push(ed.baseURI.toAbsolute(url + "/skins/" + ed.settings.skin + "/content.css"));
+
+			// Init editor
+			ed.onInit.add(function() {
+				if (!ed.settings.readonly) {
+					ed.onNodeChange.add(t._nodeChanged, t);
+					ed.onKeyUp.add(t._updateUndoStatus, t);
+					ed.onMouseUp.add(t._updateUndoStatus, t);
+					ed.dom.bind(ed.dom.getRoot(), 'dragend', function() {
+						t._updateUndoStatus(ed);
+					});
+				}
+			});
+
+			ed.onSetProgressState.add(function(ed, b, ti) {
+				var co, id = ed.id, tb;
+
+				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');
+
+						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);
+				}
+			});
+
+			DOM.loadCSS(s.editor_css ? ed.documentBaseURI.toAbsolute(s.editor_css) : url + "/skins/" + ed.settings.skin + "/ui.css");
+
+			if (s.skin_variant)
+				DOM.loadCSS(url + "/skins/" + ed.settings.skin + "/ui_" + s.skin_variant + ".css");
+		},
+
+		_isHighContrast : function() {
+			var actualColor, div = DOM.add(DOM.getRoot(), 'div', {'style': 'background-color: rgb(171,239,86);'});
+
+			actualColor = (DOM.getStyle(div, 'background-color', true) + '').toLowerCase().replace(/ /g, '');
+			DOM.remove(div);
+
+			return actualColor != 'rgb(171,239,86)' && actualColor != '#abef56';
+		},
+
+		createControl : function(n, cf) {
+			var cd, c;
+
+			if (c = cf.createControl(n))
+				return c;
+
+			switch (n) {
+				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 ((cd = this.controls[n]))
+				return cf.createButton(n, {title : "advanced." + cd[0], cmd : cd[1], ui : cd[2], value : cd[3]});
+		},
+
+		execCommand : function(cmd, ui, val) {
+			var f = this['_' + cmd];
+
+			if (f) {
+				f.call(this, ui, val);
+				return true;
+			}
+
+			return false;
+		},
+
+		_importClasses : function(e) {
+			var ed = this.editor, ctrl = ed.controlManager.get('styleselect');
+
+			if (ctrl.getLength() == 0) {
+				each(ed.dom.getClasses(), function(o, idx) {
+					var name = 'style_' + idx;
+
+					ed.formatter.register(name, {
+						inline : 'span',
+						attributes : {'class' : o['class']},
+						selector : '*'
+					});
+
+					ctrl.add(o['class'], name);
+				});
+			}
+		},
+
+		_createStyleSelect : function(n) {
+			var t = this, ed = t.editor, ctrlMan = ed.controlManager, ctrl;
+
+			// Setup style select box
+			ctrl = ctrlMan.createListBox('styleselect', {
+				title : 'advanced.style_select',
+				onselect : function(name) {
+					var matches, formatNames = [];
+
+					each(ctrl.items, function(item) {
+						formatNames.push(item.value);
+					});
+
+					ed.focus();
+					ed.undoManager.add();
+
+					// Toggle off the current format
+					matches = ed.formatter.matchAll(formatNames);
+					if (!name || matches[0] == name) {
+						if (matches[0]) 
+							ed.formatter.remove(matches[0]);
+					} else
+						ed.formatter.apply(name);
+
+					ed.undoManager.add();
+					ed.nodeChanged();
+
+					return false; // No auto select
+				}
+			});
+
+			// Handle specified format
+			ed.onInit.add(function() {
+				var counter = 0, formats = ed.getParam('style_formats');
+
+				if (formats) {
+					each(formats, function(fmt) {
+						var name, keys = 0;
+
+						each(fmt, function() {keys++;});
+
+						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;
+
+						if (val) {
+							name = 'style_' + (counter++);
+
+							ed.formatter.register(name, {
+								inline : 'span',
+								classes : val,
+								selector : '*'
+							});
+
+							ctrl.add(t.editor.translate(key), name);
+						}
+					});
+				}
+			});
+
+			// 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);
+				});
+			}
+
+			return ctrl;
+		},
+
+		_createFontSelect : function() {
+			var c, t = this, ed = t.editor;
+
+			c = ed.controlManager.createListBox('fontselect', {
+				title : 'advanced.fontdefault',
+				onselect : function(v) {
+					var cur = c.items[c.selectedIndex];
+
+					if (!v && cur) {
+						ed.execCommand('FontName', false, cur.value);
+						return;
+					}
+
+					ed.execCommand('FontName', false, v);
+
+					// Fake selection, execCommand will fire a nodeChange and update the selection
+					c.select(function(sv) {
+						return v == sv;
+					});
+
+					if (cur && cur.value == v) {
+						c.select(null);
+					}
+
+					return false; // No auto select
+				}
+			});
+
+			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 : ''});
+				});
+			}
+
+			return c;
+		},
+
+		_createFontSizeSelect : function() {
+			var t = this, ed = t.editor, c, i = 0, cl = [];
+
+			c = ed.controlManager.createListBox('fontsizeselect', {title : 'advanced.font_size', onselect : function(v) {
+				var cur = c.items[c.selectedIndex];
+
+				if (!v && cur) {
+					cur = cur.value;
+
+					if (cur['class']) {
+						ed.formatter.toggle('fontsize_class', {value : cur['class']});
+						ed.undoManager.add();
+						ed.nodeChanged();
+					} else {
+						ed.execCommand('FontSize', false, cur.fontSize);
+					}
+
+					return;
+				}
+
+				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);
+
+				// Fake selection, execCommand will fire a nodeChange and update the selection
+				c.select(function(sv) {
+					return v == sv;
+				});
+
+				if (cur && (cur.value.fontSize == v.fontSize || cur.value['class'] && cur.value['class'] == v['class'])) {
+					c.select(null);
+				}
+
+				return false; // No auto select
+			}});
+
+			if (c) {
+				each(t.settings.theme_advanced_font_sizes, function(v, k) {
+					var fz = v.fontSize;
+
+					if (fz >= 1 && fz <= 7)
+						fz = t.sizes[parseInt(fz) - 1] + 'pt';
+
+					c.add(k, v, {'style' : 'font-size:' + fz, 'class' : 'mceFontSize' + (i++) + (' ' + (v['class'] || ''))});
+				});
+			}
+
+			return c;
+		},
+
+		_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;
+
+			c = t.editor.controlManager.createListBox('formatselect', {title : 'advanced.block', onselect : function(v) {
+				t.editor.execCommand('FormatBlock', false, v);
+				return false;
+			}});
+
+			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});
+				});
+			}
+
+			return c;
+		},
+
+		_createForeColorMenu : function() {
+			var c, t = this, s = t.settings, o = {}, v;
+
+			if (s.theme_advanced_more_colors) {
+				o.more_colors_func = function() {
+					t._mceColorPicker(0, {
+						color : c.value,
+						func : function(co) {
+							c.setColor(co);
+						}
+					});
+				};
+			}
+
+			if (v = s.theme_advanced_text_colors)
+				o.colors = v;
+
+			if (s.theme_advanced_default_foreground_color)
+				o.default_color = s.theme_advanced_default_foreground_color;
+
+			o.title = 'advanced.forecolor_desc';
+			o.cmd = 'ForeColor';
+			o.scope = this;
+
+			c = t.editor.controlManager.createColorSplitButton('forecolor', o);
+
+			return c;
+		},
+
+		_createBackColorMenu : function() {
+			var c, t = this, s = t.settings, o = {}, v;
+
+			if (s.theme_advanced_more_colors) {
+				o.more_colors_func = function() {
+					t._mceColorPicker(0, {
+						color : c.value,
+						func : function(co) {
+							c.setColor(co);
+						}
+					});
+				};
+			}
+
+			if (v = s.theme_advanced_background_colors)
+				o.colors = v;
+
+			if (s.theme_advanced_default_background_color)
+				o.default_color = s.theme_advanced_default_background_color;
+
+			o.title = 'advanced.backcolor_desc';
+			o.cmd = 'HiliteColor';
+			o.scope = this;
+
+			c = t.editor.controlManager.createColorSplitButton('backcolor', o);
+
+			return c;
+		},
+
+		renderUI : function(o) {
+			var n, ic, tb, t = this, ed = t.editor, s = t.settings, sc, p, nl;
+
+			if (ed.settings) {
+				ed.settings.aria_label = s.aria_label + ed.getLang('advanced.help_shortcut');
+			}
+
+			// TODO: ACC Should have an aria-describedby attribute which is user-configurable to describe what this field is actually for.
+			// Maybe actually inherit it from the original textara?
+			n = p = DOM.create('span', {role : 'application', 'aria-labelledby' : ed.id + '_voice', id : ed.id + '_parent', 'class' : 'mceEditor ' + ed.settings.skin + 'Skin' + (s.skin_variant ? ' ' + ed.settings.skin + 'Skin' + t._ufirst(s.skin_variant) : '')});
+			DOM.add(n, 'span', {'class': 'mceVoiceLabel', 'style': 'display:none;', id: ed.id + '_voice'}, s.aria_label);
+
+			if (!DOM.boxModel)
+				n = DOM.add(n, 'div', {'class' : 'mceOldBoxModel'});
+
+			n = sc = DOM.add(n, 'table', {role : "presentation", id : ed.id + '_tbl', 'class' : 'mceLayout', cellSpacing : 0, cellPadding : 0});
+			n = tb = DOM.add(n, 'tbody');
+
+			switch ((s.theme_advanced_layout_manager || '').toLowerCase()) {
+				case "rowlayout":
+					ic = t._rowLayout(s, tb, o);
+					break;
+
+				case "customlayout":
+					ic = ed.execCallback("theme_advanced_custom_layout", s, tb, o, p);
+					break;
+
+				default:
+					ic = t._simpleLayout(s, tb, o, p);
+			}
+
+			n = o.targetNode;
+
+			// Add classes to first and last TRs
+			nl = sc.rows;
+			DOM.addClass(nl[0], 'mceFirst');
+			DOM.addClass(nl[nl.length - 1], 'mceLast');
+
+			// 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 (DOM.get(s.theme_advanced_toolbar_container))
+				DOM.get(s.theme_advanced_toolbar_container).appendChild(p);
+			else
+				DOM.insertAfter(p, n);
+
+			Event.add(ed.id + '_path_row', 'click', function(e) {
+				e = e.target;
+
+				if (e.nodeName == 'A') {
+					t._sel(e.className.replace(/^.*mcePath_([0-9]+).*$/, '$1'));
+
+					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 (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);
+					}
+				});
+
+				Event.add(ed.id + '_tbl', 'mouseout', function(e) {
+					if (t.lastPath) {
+						DOM.setHTML(ed.id + '_path_row', t.lastPath);
+						t.lastPath = 0;
+					}
+				});
+			}
+*/
+
+			if (!ed.getParam('accessibility_focus'))
+				Event.add(DOM.add(p, 'a', {href : '#'}, '<!-- IE -->'), 'focus', function() {tinyMCE.get(ed.id).focus();});
+
+			if (s.theme_advanced_toolbar_location == 'external')
+				o.deltaHeight = 0;
+
+			t.deltaHeight = o.deltaHeight;
+			o.targetNode = null;
+
+			ed.onKeyDown.add(function(ed, evt) {
+				var DOM_VK_F10 = 121, DOM_VK_F11 = 122;
+
+				if (evt.altKey) {
+		 			if (evt.keyCode === DOM_VK_F10) {
+						// Make sure focus is given to toolbar in Safari.
+						// We can't do this in IE as it prevents giving focus to toolbar when editor is in a frame
+						if (tinymce.isWebKit) {
+							window.focus();
+						}
+						t.toolbarGroup.focus();
+						return Event.cancel(evt);
+					} else if (evt.keyCode === DOM_VK_F11) {
+						DOM.get(ed.id + '_path_row').focus();
+						return Event.cancel(evt);
+					}
+				}
+			});
+
+			// alt+0 is the UK recommended shortcut for accessing the list of access controls.
+			ed.addShortcut('alt+0', '', 'mceShortcuts', t);
+
+			return {
+				iframeContainer : ic,
+				editorContainer : ed.id + '_parent',
+				sizeContainer : sc,
+				deltaHeight : o.deltaHeight
+			};
+		},
+
+		getInfo : function() {
+			return {
+				longname : 'Advanced theme',
+				author : 'Moxiecode Systems AB',
+				authorurl : 'http://tinymce.moxiecode.com',
+				version : tinymce.majorVersion + "." + tinymce.minorVersion
+			}
+		},
+
+		resizeBy : function(dw, dh) {
+			var e = DOM.get(this.editor.id + '_ifr');
+
+			this.resizeTo(e.clientWidth + dw, e.clientHeight + dh);
+		},
+
+		resizeTo : function(w, h, store) {
+			var ed = this.editor, s = this.settings, e = DOM.get(ed.id + '_tbl'), ifr = DOM.get(ed.id + '_ifr');
+
+			// 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);
+
+			// Resize iframe and container
+			DOM.setStyle(e, 'height', '');
+			DOM.setStyle(ifr, 'height', h);
+
+			if (s.theme_advanced_resize_horizontal) {
+				DOM.setStyle(e, 'width', '');
+				DOM.setStyle(ifr, 'width', w);
+
+				// Make sure that the size is never smaller than the over all ui
+				if (w < e.clientWidth) {
+					w = e.clientWidth;
+					DOM.setStyle(ifr, 'width', e.clientWidth);
+				}
+			}
+
+			// Store away the size
+			if (store && s.theme_advanced_resizing_use_cookie) {
+				Cookie.setHash("TinyMCE_" + ed.id + "_size", {
+					cw : w,
+					ch : h
+				});
+			}
+		},
+
+		destroy : function() {
+			var id = this.editor.id;
+
+			Event.clear(id + '_resize');
+			Event.clear(id + '_path_row');
+			Event.clear(id + '_external_close');
+		},
+
+		// Internal functions
+
+		_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;
+
+			if (s.readonly) {
+				n = DOM.add(tb, 'tr');
+				n = ic = DOM.add(n, 'td', {'class' : 'mceIframeContainer'});
+				return ic;
+			}
+
+			// Create toolbar container at top
+			if (lo == 'top')
+				t._addToolbars(tb, o);
+
+			// 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');
+
+				if (p.firstChild.className == 'mceOldBoxModel')
+					p.firstChild.appendChild(c);
+				else
+					p.insertBefore(c, p.firstChild);
+
+				t._addToolbars(etb, o);
+
+				ed.onMouseUp.add(function() {
+					var e = DOM.get(ed.id + '_external');
+					DOM.show(e);
+
+					DOM.hide(lastExtID);
+
+					var f = Event.add(ed.id + '_external_close', 'click', function() {
+						DOM.hide(ed.id + '_external');
+						Event.remove(ed.id + '_external_close', 'click', f);
+					});
+
+					DOM.show(e);
+					DOM.setStyle(e, 'top', 0 - DOM.getRect(ed.id + '_tblext').h - 1);
+
+					// Fixes IE rendering bug
+					DOM.hide(e);
+					DOM.show(e);
+					e.style.filter = '';
+
+					lastExtID = ed.id + '_external';
+
+					e = null;
+				});
+			}
+
+			if (sl == 'top')
+				t._addStatusBar(tb, o);
+
+			// Create iframe container
+			if (!s.theme_advanced_toolbar_container) {
+				n = DOM.add(tb, 'tr');
+				n = ic = DOM.add(n, 'td', {'class' : 'mceIframeContainer'});
+			}
+
+			// Create toolbar container at bottom
+			if (lo == 'bottom')
+				t._addToolbars(tb, o);
+
+			if (sl == 'bottom')
+				t._addStatusBar(tb, o);
+
+			return ic;
+		},
+
+		_rowLayout : function(s, tb, o) {
+			var t = this, ed = t.editor, dc, da, cf = ed.controlManager, n, ic, to, a;
+
+			dc = s.theme_advanced_containers_default_class || '';
+			da = s.theme_advanced_containers_default_align || 'center';
+
+			each(explode(s.theme_advanced_containers || ''), function(c, i) {
+				var v = s['theme_advanced_container_' + c] || '';
+
+				switch (c.toLowerCase()) {
+					case 'mceeditor':
+						n = DOM.add(tb, 'tr');
+						n = ic = DOM.add(n, 'td', {'class' : 'mceIframeContainer'});
+						break;
+
+					case 'mceelementpath':
+						t._addStatusBar(tb, o);
+						break;
+
+					default:
+						a = (s['theme_advanced_container_' + c + '_align'] || da).toLowerCase();
+						a = 'mce' + t._ufirst(a);
+
+						n = DOM.add(DOM.add(tb, 'tr'), 'td', {
+							'class' : 'mceToolbar ' + (s['theme_advanced_container_' + c + '_class'] || dc) + ' ' + a || da
+						});
+
+						to = cf.createToolbar("toolbar" + i);
+						t._addControls(v, to);
+						DOM.setHTML(n, to.renderHTML());
+						o.deltaHeight -= s.theme_advanced_row_height;
+				}
+			});
+
+			return ic;
+		},
+
+		_addControls : function(v, tb) {
+			var t = this, s = t.settings, di, cf = t.editor.controlManager;
+
+			if (s.theme_advanced_disable && !t._disabled) {
+				di = {};
+
+				each(explode(s.theme_advanced_disable), function(v) {
+					di[v] = 1;
+				});
+
+				t._disabled = di;
+			} else
+				di = t._disabled;
+
+			each(explode(v), function(n) {
+				var c;
+
+				if (di && di[n])
+					return;
+
+				// 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);
+
+						if (n)
+							tb.add(n);
+					});
+
+					return;
+				}
+
+				c = t.createControl(n, cf);
+
+				if (c)
+					tb.add(c);
+			});
+		},
+
+		_addToolbars : function(c, o) {
+			var t = this, i, tb, ed = t.editor, s = t.settings, v, cf = ed.controlManager, di, n, h = [], a, toolbarGroup;
+
+			toolbarGroup = cf.createToolbarGroup('toolbargroup', {
+				'name': ed.getLang('advanced.toolbar'),
+				'tab_focus_toolbar':ed.getParam('theme_advanced_tab_focus_toolbar')
+			});
+
+			t.toolbarGroup = toolbarGroup;
+
+			a = s.theme_advanced_toolbar_align.toLowerCase();
+			a = 'mce' + t._ufirst(a);
+
+			n = DOM.add(DOM.add(c, 'tr', {role: 'presentation'}), 'td', {'class' : 'mceToolbar ' + a, "role":"presentation"});
+
+			// Create toolbar and add the controls
+			for (i=1; (v = s['theme_advanced_buttons' + i]); i++) {
+				tb = cf.createToolbar("toolbar" + i, {'class' : 'mceToolbarRow' + i});
+
+				if (s['theme_advanced_buttons' + i + '_add'])
+					v += ',' + s['theme_advanced_buttons' + i + '_add'];
+
+				if (s['theme_advanced_buttons' + i + '_add_before'])
+					v = s['theme_advanced_buttons' + i + '_add_before'] + ',' + v;
+
+				t._addControls(v, tb);
+				toolbarGroup.add(tb);
+
+				o.deltaHeight -= s.theme_advanced_row_height;
+			}
+			h.push(toolbarGroup.renderHTML());
+			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(''));
+		},
+
+		_addStatusBar : function(tb, o) {
+			var n, t = this, ed = t.editor, s = t.settings, r, mf, me, td;
+
+			n = DOM.add(tb, 'tr');
+			n = td = DOM.add(n, 'td', {'class' : 'mceStatusbar'}); 
+			n = DOM.add(n, 'div', {id : ed.id + '_path_row', 'role': 'group', 'aria-labelledby': ed.id + '_path_voice'});
+			if (s.theme_advanced_path) {
+				DOM.add(n, 'span', {id: ed.id + '_path_voice'}, ed.translate('advanced.path'));
+				DOM.add(n, 'span', {}, ': ');
+			} else {
+				DOM.add(n, 'span', {}, '&#160;');
+			}
+			
+
+			if (s.theme_advanced_resizing) {
+				DOM.add(td, 'a', {id : ed.id + '_resize', href : 'javascript:;', onclick : "return false;", 'class' : 'mceResize', tabIndex:"-1"});
+
+				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');
+
+						if (!o)
+							return;
+
+						t.resizeTo(o.cw, o.ch);
+					});
+				}
+
+				ed.onPostRender.add(function() {
+					Event.add(ed.id + '_resize', 'click', function(e) {
+						e.preventDefault();
+					});
+
+					Event.add(ed.id + '_resize', 'mousedown', function(e) {
+						var mouseMoveHandler1, mouseMoveHandler2,
+							mouseUpHandler1, mouseUpHandler2,
+							startX, startY, startWidth, startHeight, width, height, ifrElm;
+
+						function resizeOnMove(e) {
+							e.preventDefault();
+
+							width = startWidth + (e.screenX - startX);
+							height = startHeight + (e.screenY - startY);
+
+							t.resizeTo(width, height);
+						};
+
+						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);
+
+							width = startWidth + (e.screenX - startX);
+							height = startHeight + (e.screenY - startY);
+							t.resizeTo(width, height, true);
+						};
+
+						e.preventDefault();
+
+						// 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;
+
+						// 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);
+					});
+				});
+			}
+
+			o.deltaHeight -= 21;
+			n = tb = null;
+		},
+
+		_updateUndoStatus : function(ed) {
+			var cm = ed.controlManager, um = ed.undoManager;
+
+			cm.setDisabled('undo', !um.hasUndo() && !um.typing);
+			cm.setDisabled('redo', !um.hasRedo());
+		},
+
+		_nodeChanged : function(ed, cm, n, co, ob) {
+			var t = this, p, de = 0, v, c, s = t.settings, cl, fz, fn, fc, bc, formatNames, matches;
+
+			tinymce.each(t.stateControls, function(c) {
+				cm.setActive(c, ed.queryCommandState(t.controls[c][1]));
+			});
+
+			function getParent(name) {
+				var i, parents = ob.parents, func = name;
+
+				if (typeof(name) == 'string') {
+					func = function(node) {
+						return node.nodeName == name;
+					};
+				}
+
+				for (i = 0; i < parents.length; i++) {
+					if (func(parents[i]))
+						return parents[i];
+				}
+			};
+
+			cm.setActive('visualaid', ed.hasVisual);
+			t._updateUndoStatus(ed);
+			cm.setDisabled('outdent', !ed.queryCommandState('Outdent'));
+
+			p = getParent('A');
+			if (c = cm.get('link')) {
+				if (!p || !p.name) {
+					c.setDisabled(!p && co);
+					c.setActive(!!p);
+				}
+			}
+
+			if (c = cm.get('unlink')) {
+				c.setDisabled(!p && co);
+				c.setActive(!!p && !p.name);
+			}
+
+			if (c = cm.get('anchor')) {
+				c.setActive(!co && !!p && p.name);
+			}
+
+			p = getParent('IMG');
+			if (c = cm.get('image'))
+				c.setActive(!co && !!p && n.className.indexOf('mceItem') == -1);
+
+			if (c = cm.get('styleselect')) {
+				t._importClasses();
+
+				formatNames = [];
+				each(c.items, function(item) {
+					formatNames.push(item.value);
+				});
+
+				matches = ed.formatter.matchAll(formatNames);
+				c.select(matches[0]);
+			}
+
+			if (c = cm.get('formatselect')) {
+				p = getParent(DOM.isBlock);
+
+				if (p)
+					c.select(p.nodeName.toLowerCase());
+			}
+
+			// Find out current fontSize, fontFamily and fontClass
+			getParent(function(n) {
+				if (n.nodeName === 'SPAN') {
+					if (!cl && n.className)
+						cl = n.className;
+				}
+
+				if (ed.dom.is(n, s.theme_advanced_font_selector)) {
+					if (!fz && n.style.fontSize)
+						fz = n.style.fontSize;
+
+					if (!fn && n.style.fontFamily)
+						fn = n.style.fontFamily.replace(/[\"\']+/g, '').replace(/^([^,]+).*/, '$1').toLowerCase();
+					
+					if (!fc && n.style.color)
+						fc = n.style.color;
+
+					if (!bc && n.style.backgroundColor)
+						bc = n.style.backgroundColor;
+				}
+
+				return false;
+			});
+
+			if (c = cm.get('fontselect')) {
+				c.select(function(v) {
+					return v.replace(/^([^,]+).*/, '$1').toLowerCase() == fn;
+				});
+			}
+
+			// 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);
+
+				c.select(function(v) {
+					if (v.fontSize && v.fontSize === fz)
+						return true;
+
+					if (v['class'] && v['class'] === cl)
+						return true;
+				});
+			}
+			
+			if (s.theme_advanced_show_current_color) {
+				function updateColor(controlId, color) {
+					if (c = cm.get(controlId)) {
+						if (!color)
+							color = c.settings.default_color;
+						if (color !== c.value) {
+							c.displayColor(color);
+						}
+					}
+				}
+				updateColor('forecolor', fc);
+				updateColor('backcolor', bc);
+			}
+
+			if (s.theme_advanced_show_current_color) {
+				function updateColor(controlId, color) {
+					if (c = cm.get(controlId)) {
+						if (!color)
+							color = c.settings.default_color;
+						if (color !== c.value) {
+							c.displayColor(color);
+						}
+					}
+				};
+
+				updateColor('forecolor', fc);
+				updateColor('backcolor', bc);
+			}
+
+			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'});
+
+				if (t.statusKeyboardNavigation) {
+					t.statusKeyboardNavigation.destroy();
+					t.statusKeyboardNavigation = null;
+				}
+
+				DOM.setHTML(p, '');
+
+				getParent(function(n) {
+					var na = n.nodeName.toLowerCase(), u, pi, ti = '';
+
+					// Ignore non element and bogus/hidden elements
+					if (n.nodeType != 1 || na === 'br' || n.getAttribute('data-mce-bogus') || DOM.hasClass(n, 'mceItemHidden') || DOM.hasClass(n, 'mceItemRemoved'))
+						return;
+
+					// Handle prefix
+					if (tinymce.isIE && n.scopeName !== 'HTML')
+						na = n.scopeName + ':' + na;
+
+					// Remove internal prefix
+					na = na.replace(/mce\:/g, '');
+
+					// Handle node name
+					switch (na) {
+						case 'b':
+							na = 'strong';
+							break;
+
+						case 'i':
+							na = 'em';
+							break;
+
+						case 'img':
+							if (v = DOM.getAttrib(n, 'src'))
+								ti += 'src: ' + v + ' ';
+
+							break;
+
+						case 'a':
+							if (v = DOM.getAttrib(n, 'name')) {
+								ti += 'name: ' + v + ' ';
+								na += '#' + v;
+							}
+
+							if (v = DOM.getAttrib(n, 'href'))
+								ti += 'href: ' + v + ' ';
+
+							break;
+
+						case 'font':
+							if (v = DOM.getAttrib(n, 'face'))
+								ti += 'font: ' + v + ' ';
+
+							if (v = DOM.getAttrib(n, 'size'))
+								ti += 'size: ' + v + ' ';
+
+							if (v = DOM.getAttrib(n, 'color'))
+								ti += 'color: ' + v + ' ';
+
+							break;
+
+						case 'span':
+							if (v = DOM.getAttrib(n, 'style'))
+								ti += 'style: ' + v + ' ';
+
+							break;
+					}
+
+					if (v = DOM.getAttrib(n, 'id'))
+						ti += 'id: ' + v + ' ';
+
+					if (v = n.className) {
+						v = v.replace(/\b\s*(webkit|mce|Apple-)\w+\s*\b/g, '')
+
+						if (v) {
+							ti += 'class: ' + v + ' ';
+
+							if (DOM.isBlock(n) || na == 'img' || na == 'span')
+								na += '.' + v;
+						}
+					}
+
+					na = na.replace(/(html:)/g, '');
+					na = {name : na, node : n, title : ti};
+					t.onResolveName.dispatch(t, na);
+					ti = na.title;
+					na = na.name;
+
+					//u = "javascript:tinymce.EditorManager.get('" + ed.id + "').theme._sel('" + (de++) + "');";
+					pi = DOM.create('a', {'href' : "javascript:;", role: 'button', onmousedown : "return false;", title : ti, 'class' : 'mcePath_' + (de++)}, na);
+
+					if (p.hasChildNodes()) {
+						p.insertBefore(DOM.create('span', {'aria-hidden': 'true'}, '\u00a0\u00bb '), p.firstChild);
+						p.insertBefore(pi, p.firstChild);
+					} else
+						p.appendChild(pi);
+				}, ed.getBody());
+
+				if (DOM.select('a', p).length > 0) {
+					t.statusKeyboardNavigation = new tinymce.ui.KeyboardNavigation({
+						root: ed.id + "_path_row",
+						items: DOM.select('a', p),
+						excludeFromTabOrder: true,
+						onCancel: function() {
+							ed.focus();
+						}
+					}, DOM);
+				}
+			}
+		},
+
+		// Commands gets called by execCommand
+
+		_sel : function(v) {
+			this.editor.execCommand('mceSelectNodeDepth', false, v);
+		},
+
+		_mceInsertAnchor : function(ui, v) {
+			var ed = this.editor;
+
+			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
+			});
+		},
+
+		_mceCharMap : function() {
+			var ed = this.editor;
+
+			ed.windowManager.open({
+				url : this.url + '/charmap.htm',
+				width : 550 + parseInt(ed.getLang('advanced.charmap_delta_width', 0)),
+				height : 265 + parseInt(ed.getLang('advanced.charmap_delta_height', 0)),
+				inline : true
+			}, {
+				theme_url : this.url
+			});
+		},
+
+		_mceHelp : function() {
+			var ed = this.editor;
+
+			ed.windowManager.open({
+				url : this.url + '/about.htm',
+				width : 480,
+				height : 380,
+				inline : true
+			}, {
+				theme_url : this.url
+			});
+		},
+
+		_mceShortcuts : function() {
+			var ed = this.editor;
+			ed.windowManager.open({
+				url: this.url + '/shortcuts.htm',
+				width: 480,
+				height: 380,
+				inline: true
+			}, {
+				theme_url: this.url
+			});
+		},
+
+		_mceColorPicker : function(u, v) {
+			var ed = this.editor;
+
+			v = v || {};
+
+			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
+			});
+		},
+
+		_mceCodeEditor : function(ui, val) {
+			var ed = this.editor;
+
+			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
+			});
+		},
+
+		_mceImage : function(ui, val) {
+			var ed = this.editor;
+
+			// Internal image object like a flash placeholder
+			if (ed.dom.getAttrib(ed.selection.getNode(), 'class').indexOf('mceItem') != -1)
+				return;
+
+			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
+			});
+		},
+
+		_mceLink : function(ui, val) {
+			var ed = this.editor;
+
+			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
+			});
+		},
+
+		_mceNewDocument : function() {
+			var ed = this.editor;
+
+			ed.windowManager.confirm('advanced.newdocument', function(s) {
+				if (s)
+					ed.execCommand('mceSetContent', false, '');
+			});
+		},
+
+		_mceForeColor : function() {
+			var t = this;
+
+			this._mceColorPicker(0, {
+				color: t.fgColor,
+				func : function(co) {
+					t.fgColor = co;
+					t.editor.execCommand('ForeColor', false, co);
+				}
+			});
+		},
+
+		_mceBackColor : function() {
+			var t = this;
+
+			this._mceColorPicker(0, {
+				color: t.bgColor,
+				func : function(co) {
+					t.bgColor = co;
+					t.editor.execCommand('HiliteColor', false, co);
+				}
+			});
+		},
+
+		_ufirst : function(s) {
+			return s.substring(0, 1).toUpperCase() + s.substring(1);
+		}
+	});
+
+	tinymce.ThemeManager.add('advanced', tinymce.themes.AdvancedTheme);
+}(tinymce));
Index: wp-includes/class-wp-editor.php
===================================================================
--- wp-includes/class-wp-editor.php	(revision 19934)
+++ wp-includes/class-wp-editor.php	(working copy)
@@ -523,7 +523,7 @@
 	<script type="text/javascript">
 		tinyMCEPreInit = {
 			base : "<?php echo self::$baseurl; ?>",
-			suffix : "",
+			suffix : '<?php echo ( defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ) ? '.dev' : ''; ?>',
 			query : "<?php echo $version; ?>",
 			mceInit : <?php echo $mceInit; ?>,
 			qtInit : <?php echo $qtInit; ?>,
