Index: /CKEditor/branches/prototype/_source/core/config.js
===================================================================
--- /CKEditor/branches/prototype/_source/core/config.js	(revision 2401)
+++ /CKEditor/branches/prototype/_source/core/config.js	(revision 2402)
@@ -159,5 +159,5 @@
 	 * config.plugins = 'elementspath,toolbar,wysiwygarea';
 	 */
-	plugins : 'basicstyles,button,elementspath,htmldataprocessor,keystrokes,sourcearea,toolbar,wysiwygarea',
+	plugins : 'basicstyles,button,elementspath,htmldataprocessor,keystrokes,sourcearea,toolbar,wysiwygarea,dialog',
 
 	/**
@@ -186,4 +186,13 @@
 	 * @example
 	 */
-	width : '100%'
+	width : '100%',
+	
+	/**
+	 * The base Z-index for floating dialogs and popups.
+	 * @type Number
+	 * @default 10000
+	 * @example
+	 * config.basePopupZIndex = 2000
+	 */
+	basePopupZIndex : 10000
 };
Index: /CKEditor/branches/prototype/_source/core/skins.js
===================================================================
--- /CKEditor/branches/prototype/_source/core/skins.js	(revision 2401)
+++ /CKEditor/branches/prototype/_source/core/skins.js	(revision 2402)
@@ -35,13 +35,16 @@
 	var loaded = {};
 
-	var loadCss = function( cssUrl )
+	var loadFile = function( url, type )
 	{
 		// Ignore it if already loaded.
-		if ( loaded[ cssUrl ] )
+		if ( loaded[ url ] )
 			return;
 
-		loaded[ cssUrl ] = 1;
+		loaded[ url ] = 1;
 
-		CKEDITOR.document.appendStyleSheet( cssUrl );
+		if ( type == 'css' )
+			CKEDITOR.document.appendStyleSheet( url );
+		else
+			CKEDITOR.scriptLoader.load( url, function(){} ) ;		// TODO: how to properly load a JavaScript file?
 	};
 
@@ -59,7 +62,7 @@
 		load : function( skinName, skinPart )
 		{
-			loadCss( CKEDITOR.getUrl(
+			loadFile( CKEDITOR.getUrl(
 				'_source/' +	// TODO: Add @-Packager.RemoveLine to the final build process.
-				'skins/' + skinName + '/' + skinPart + '.css' ) );
+				'skins/' + skinName + '/' + skinPart + '.css' ), 'css' );
 		}
 	 };
Index: /CKEditor/branches/prototype/_source/plugins/dialog/plugin.js
===================================================================
--- /CKEditor/branches/prototype/_source/plugins/dialog/plugin.js	(revision 2402)
+++ /CKEditor/branches/prototype/_source/plugins/dialog/plugin.js	(revision 2402)
@@ -0,0 +1,96 @@
+/*
+ * CKEditor - The text editor for Internet - http://ckeditor.com
+ * Copyright (C) 2003-2008 Frederico Caldeira Knabben
+ *
+ * == BEGIN LICENSE ==
+ *
+ * Licensed under the terms of any of the following licenses at your
+ * choice:
+ *
+ *  - GNU General Public License Version 2 or later (the "GPL")
+ *    http://www.gnu.org/licenses/gpl.html
+ *
+ *  - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
+ *    http://www.gnu.org/licenses/lgpl.html
+ *
+ *  - Mozilla Public License Version 1.1 or later (the "MPL")
+ *    http://www.mozilla.org/MPL/MPL-1.1.html
+ *
+ * == END LICENSE ==
+ */
+
+CKEDITOR.plugins.add( 'dialog',
+	{
+		init : function( editor, pluginPath )
+		{
+		}
+	});
+
+CKEDITOR.DIALOG_RESIZE_NONE = 0;
+CKEDITOR.DIALOG_RESIZE_RESIZE_WIDTH = 1;
+CKEDITOR.DIALOG_RESIZE_RESIZE_HEIGHT = 2;
+CKEDITOR.DIALOG_RESIZE_RESIZE_BOTH = 3;
+
+CKEDITOR.dialog =
+{
+	add: function( name, callback )
+	{
+	},
+
+	okButton : null,
+
+	cancelButton : null,
+
+	addUIElement: null,
+
+	dialogDefinitions : {
+		'testOnly' : function()
+		{
+			return {
+				'title' : 'Test Dialog',
+				'resizable' : CKEDITOR.DIALOG_RESIZE_NONE,
+				'minWidth' : 500,
+				'minHeight' : 400,
+				'contents' : []
+			};
+		}
+	}
+};
+
+(function()
+{
+	var defaultDialogDefinition = {
+		'resizable' : CKEDITOR.DIALOG_RESIZE_NONE,
+		'minWidth' : 600,
+		'minHeight' : 400,
+		'buttons' : [CKEDITOR.dialog.okButton, CKEDITOR.dialog.cancelButton],
+		'onOk' : function(){alert('ok called');},
+		'onCancel' : function(){alert('cancel caled');},
+		'onLoad' : function(){alert('onload called');}
+	};
+
+	CKEDITOR.tools.extend( CKEDITOR.editor.prototype,
+		{
+			'openDialog' : function( dialogName )
+			{
+				if ( !( dialogName in CKEDITOR.dialog.dialogDefinitions) )
+				{
+					alert( 'The dialog "' + dialogName + '" is not defined.' );
+					return false;
+				}
+
+				// Add the dialog to the top document.
+				var dialogElement = this.theme.buildDialog( this ),
+					doc = CKEDITOR.document;
+				dialogElement.appendTo( doc.getBody() );
+
+				var dialogDefinition = CKEDITOR.tools.extend( {}, defaultDialogDefinition,
+					CKEDITOR.dialog.dialogDefinitions[dialogName]() );
+
+				// Resize the dialog to the minimum size.
+				this.theme.resizeDialog( this, dialogElement, dialogDefinition.minWidth, dialogDefinition.minHeight );
+
+				return true;
+			}
+		});
+})();
Index: /CKEditor/branches/prototype/_source/skins/default/editor.css
===================================================================
--- /CKEditor/branches/prototype/_source/skins/default/editor.css	(revision 2401)
+++ /CKEditor/branches/prototype/_source/skins/default/editor.css	(revision 2402)
@@ -24,2 +24,3 @@
 @import url("toolbar.css");
 @import url("elementspath.css");
+@import url("dialog.css");
Index: /CKEditor/branches/prototype/_source/themes/default/theme.js
===================================================================
--- /CKEditor/branches/prototype/_source/themes/default/theme.js	(revision 2401)
+++ /CKEditor/branches/prototype/_source/themes/default/theme.js	(revision 2402)
@@ -82,4 +82,56 @@
 	},
 
+	buildDialog : function( editor )
+	{
+		var name = editor.name,
+			element = editor.element,
+			dialogId = CKEDITOR.tools.getNextNumber(),
+			cover = null;
+
+		if ( !editor._.dialogCover )
+		{
+			cover = editor._.dialogCover = CKEDITOR.dom.element.createFromHtml( [
+						'<div id="cke_dialog_cover"></div>'
+					].join('') );
+		}
+
+		var container = CKEDITOR.dom.element.createFromHtml( [
+				'<span class="cke_skin_' + editor.config.skin + '"><div id="cke_dialog_%d" class="cke_dialog">',
+					'<div>',
+						'<div id="cke_dialog_TL_%d" class="cke_dialog_TL"></div>',
+						'<div id="cke_dialog_T_%d" class="cke_dialog_T"></div>',
+						'<div id="cke_dialog_TR_%d" class="cke_dialog_TR"></div>',
+					'</div>',
+					'<div>',
+						'<div id="cke_dialog_L_%d" class="cke_dialog_L"></div>',
+						'<div id="cke_dialog_C_%d" class="cke_dialog_C">',
+							'<div id="cke_dialog_Title_%d" class="cke_dialog_Title"></div>',
+							'<div id="cke_dialog_Tabs_%d" class="cke_dialog_Tabs"></div>',
+							'<div id="cke_dialog_Contents_%d" class="cke_dialog_Contents"></div>',
+							'<div id="cke_dialog_Buttons_%d" class="cke_dialog_Buttons"></div>',
+						'</div>',
+						'<div id="cke_dialog_R_%d" class="cke_dialog_R"></div>',
+					'</div>',
+					'<div>',
+						'<div id="cke_dialog_BL_%d" class="cke_dialog_BL"></div>',
+						'<div id="cke_dialog_B_%d" class="cke_dialog_B"></div>',
+						'<div id="cke_dialog_BR_%d" class="cke_dialog_BR"></div>',
+					'</div>',
+				'</div></span>'
+			].join( '' ).replace( /%d/g, dialogId ) );
+
+		return container;
+	},
+
+	resizeDialog : function( editor, dialog, width, height )
+	{
+		// Just let the skin handle the resize operation.
+		this.fire( 'dialogResize', {
+					dialog : dialog,
+					width : width,
+					height : height
+				});
+	},
+
 	destroy : function( editor )
 	{
