Index: /CKEditor/branches/prototype/_source/core/config.js
===================================================================
--- /CKEditor/branches/prototype/_source/core/config.js	(revision 2502)
+++ /CKEditor/branches/prototype/_source/core/config.js	(revision 2503)
@@ -195,4 +195,6 @@
 	 * config.basePopupZIndex = 2000
 	 */
-	basePopupZIndex : 10000
+	basePopupZIndex : 10000,
+	backgroundCoverColor : 'white',
+	backgroundCoverOpacity : 0.5
 };
Index: /CKEditor/branches/prototype/_source/core/dom/element.js
===================================================================
--- /CKEditor/branches/prototype/_source/core/dom/element.js	(revision 2502)
+++ /CKEditor/branches/prototype/_source/core/dom/element.js	(revision 2503)
@@ -670,4 +670,22 @@
 
 		/**
+		 * Sets the opacity of an element.
+		 * @param {Number} opacity A number within the range [0.0, 1.0].
+		 * @example
+		 * var element = CKEDITOR.dom.element.getById( 'myElement' );
+		 * <b>element.setOpacity( 0.75 )</b>;
+		 */
+		setOpacity : function( opacity )
+		{
+			if ( CKEDITOR.env.ie )
+			{
+				opacity = Math.round( opacity * 100 );
+				this.setStyle( 'filter', opacity >= 100 ? '' : 'progid:DXImageTransform.Microsoft.Alpha(opacity=' + opacity + ')' );
+			}
+			else
+				this.setStyle( 'opacity', opacity );
+		},
+
+		/**
 		 * Makes the element unselectable.
 		 * @function
Index: /CKEditor/branches/prototype/_source/plugins/dialog/plugin.js
===================================================================
--- /CKEditor/branches/prototype/_source/plugins/dialog/plugin.js	(revision 2502)
+++ /CKEditor/branches/prototype/_source/plugins/dialog/plugin.js	(revision 2503)
@@ -202,6 +202,8 @@
 		var element = this._.element;
 		var definition = this._.definition;
-		if ( element.getParent() != CKEDITOR.document.getBody() )
+		if ( !( element.getParent() && element.getParent().equals( CKEDITOR.document.getBody() ) ) )
 			element.appendTo( CKEDITOR.document.getBody() );
+		else
+			return;
 
 		// First, set the dialog to an appropriate size.
@@ -223,4 +225,12 @@
 		}
 
+		// Set z-index.
+		this._.element.getFirst().setStyle( 'z-index', CKEDITOR.dialog._.currentZIndex += 10 );
+
+		// Add self to global dialog stack, and display dialog cover if first in line.
+		CKEDITOR.dialog._.dialogStack.push( this );
+		if ( CKEDITOR.dialog._.dialogStack.length == 1 )
+			CKEDITOR.dialog._.addCover();
+		
 		// Execute onLoad for the first show.
 		this.fireOnce( 'load', {} );
@@ -234,4 +244,12 @@
 			return;
 		element.remove();
+
+		// Remove self from global dialog stack, and remove dialog cover if nothing is left.
+		CKEDITOR.dialog._.dialogStack.pop();
+		if ( CKEDITOR.dialog._.dialogStack.length < 1 )
+			CKEDITOR.dialog._.removeCover();
+
+		// Deduct the z-index.
+		CKEDITOR.dialog._.currentZIndex -= 10;
 	},
 
@@ -266,4 +284,5 @@
 		tab.appendTo( this._.parts.tabs );
 		tab.setAttribute( 'id', contents.id + '_' + CKEDITOR.tools.getNextNumber() );
+		page.setAttribute( 'name', contents.id );
 	},
 
@@ -442,6 +461,6 @@
 											if ( !valid )
 											{
+												this.select();
 												alert( 'Test Text 4 must only contain alphanumeric characters, space, or ! and must not be empty.' );
-												this.focus();
 											}
 											return valid;
@@ -529,5 +548,57 @@
 			};
 		}
-	}
+	},
+
+	addCover : function()
+	{
+		var html = [
+				'<div style="position: ', ( CKEDITOR.env.ie && CKEDITOR.env.version < 7 ? 'absolute' : 'fixed' ),
+				'; z-index: ', CKEDITOR.config.basePopupZIndex,
+				'; top: 0px; left: 0px; ',
+				'background-color: ', CKEDITOR.config.backgroundCoverColor,
+				'" id="cke_dialog_background_cover">'
+			];
+		if ( CKEDITOR.env.ie )
+		{
+			html.push( '<iframe hidefocus="true" frameborder="0" ' );
+			if ( Math.floor( CKEDITOR.env.version ) == 6 )
+				html.push( 'src="javascript: " ' );
+			else
+				html.push( 'src="" ' );
+			html.push( 'style="position: absolute; left: 0px; top: 0px; width: 100%; height: 100%; ',
+				   'progid:DXImageTransform.Microsoft.Alpha(opacity=0)" ></iframe>' );
+		}
+		html.push( '</div>' );
+		var element = CKEDITOR.dom.element.createFromHtml( html.join( '' ) ),
+			resizeFunc = function()
+			{
+				var size = CKEDITOR.document.getWindow().getViewPaneSize();
+				element.setStyles( 
+						{
+							width : size.width + 'px',
+							height : size.height + 'px'
+						});
+			};
+		CKEDITOR.dialog._.resizeCover = resizeFunc;
+		CKEDITOR.document.getWindow().on( 'resize', resizeFunc );
+		resizeFunc();
+		element.setOpacity( CKEDITOR.config.backgroundCoverOpacity );
+		element.appendTo( CKEDITOR.document.getBody() );
+	},
+
+	removeCover : function()
+	{
+		var element = CKEDITOR.document.getById( 'cke_dialog_background_cover' );
+		if ( element )
+		{
+			element.remove();
+			CKEDITOR.document.getWindow().removeListener( 'resize', CKEDITOR.dialog._.resizeCover );
+			CKEDITOR.dialog._.resizeCover = null;
+		}
+	},
+
+	dialogStack : [],
+
+	currentZIndex : CKEDITOR.config.basePopupZIndex
 };
 
@@ -597,4 +668,6 @@
 		if ( elementDefinition.onLoad )
 			dialog.on( 'load', elementDefinition.onLoad, this, null, CKEDITOR.tools.getNextNumber() );
+
+		( this._ || ( this._ = {} ) ).dialog = dialog;
 	},
 
@@ -699,5 +772,12 @@
 	focus : function()
 	{
-		this.getElement().focus();
+		var element = this.getElement(),
+			cursor = element,
+			tabId;
+		while ( ( cursor = cursor.getParent() ) && cursor.$.className.search( 'cke_dialog_page_contents' ) == -1 );
+		tabId = cursor.getAttribute( 'name' );
+
+		this._.dialog.selectPage( tabId );
+		element.focus();
 	}
 };
Index: /CKEditor/branches/prototype/_source/plugins/dialogui/plugin.js
===================================================================
--- /CKEditor/branches/prototype/_source/plugins/dialogui/plugin.js	(revision 2502)
+++ /CKEditor/branches/prototype/_source/plugins/dialogui/plugin.js	(revision 2503)
@@ -320,4 +320,10 @@
 				{
 					return CKEDITOR.document.getById( this._.inputId );
+				},
+
+				select : function()
+				{
+					this.focus();
+					this.getElement().$.select();
 				}
 			}, commonPrototype, true );
