Index: /CKEditor/branches/prototype/_source/core/dom/node.js
===================================================================
--- /CKEditor/branches/prototype/_source/core/dom/node.js	(revision 2430)
+++ /CKEditor/branches/prototype/_source/core/dom/node.js	(revision 2431)
@@ -152,4 +152,17 @@
 		{
 			node.$.parentNode.insertBefore( this.$, node.$ );
+		},
+
+		/**
+		 * Gets the (index+1)-th children under the current node.
+		 * @param {Number} index The child index under the node.
+		 * @returns {CKEDITOR.dom.node} The (index+1)-th children under the current node. Null if child does not exist.
+		 * @example
+		 * var strong = p.getChild(0);
+		 */
+		getChild : function( index )
+		{
+			var rawNode = this.$.childNodes[index];
+			return rawNode ? new CKEDITOR.dom.node( rawNode ) : null;
 		}
 	}
Index: /CKEditor/branches/prototype/_source/core/dom/window.js
===================================================================
--- /CKEditor/branches/prototype/_source/core/dom/window.js	(revision 2430)
+++ /CKEditor/branches/prototype/_source/core/dom/window.js	(revision 2431)
@@ -69,6 +69,6 @@
 			else
 				return {
-					width : this.$.document.clientWidth || this.$.document.body.clientWidth || 0,
-					height : this.$.document.clientHeight || this.$.document.body.clientHeight || 0
+					width : this.$.document.documentElement.clientWidth || this.$.document.body.clientWidth || 0,
+					height : this.$.document.documentElement.clientHeight || this.$.document.body.clientHeight || 0
 				};
 		},
Index: /CKEditor/branches/prototype/_source/plugins/dialog/plugin.js
===================================================================
--- /CKEditor/branches/prototype/_source/plugins/dialog/plugin.js	(revision 2430)
+++ /CKEditor/branches/prototype/_source/plugins/dialog/plugin.js	(revision 2431)
@@ -52,5 +52,11 @@
 				minWidth : 500,
 				minHeight : 400,
-				contents : []
+				contents : [
+					{
+						id : 'tab1',
+						label : 'First Tab',
+						title : ''
+					}
+				]
 			};
 		}
@@ -64,20 +70,57 @@
 			return;
 
-		var definitions = CKEDITOR.dialog.dialogDefinitions;
-		if ( !( dialogName in definitions ) )
+		// Load the dialog definition.
+		var definition = CKEDITOR.dialog.dialogDefinitions[dialogName];
+		if ( typeof( definition ) != 'function' )
 		{
 			alert( 'Error: The dialog "' + dialogName + '" is not defined.' );
 			return;
 		}
-
+		definition = CKEDITOR.tools.extend( {}, CKEDITOR.dialog._.defaultDialogDefinition, definition() );
+		if ( !( definition.title && definition.contents ) )
+		{
+			alert( 'Error: The dialog "' + dialogName + '" is missing its title or contents.' );
+			return;
+		}
+
+		// Initialize some basic parameters.
 		this._ = {
 			editor : editor,
 			element : editor.theme.buildDialog( editor ),
 			name : dialogName,
-			definition : CKEDITOR.tools.extend( {}, CKEDITOR.dialog._.defaultDialogDefinition, definitions[dialogName]() ),
+			definition : definition,
 			isShown : false,
 			size : { width : 0, height : 0 }
 		};
-		this._.dialogId = this._.element.dialogId;
+
+		// Initialize the parts map.
+		var element = this._.element.getFirst();
+		function getPart(elementIndices)
+		{
+			var e = element;
+			for ( var i = 0 ; i < elementIndices.length ; i++ )
+				e = e.getChild( elementIndices[i] );
+			return e;
+		}
+		this._.parts = {
+			'tl' : [0,0],
+			't' : [0,1],
+			'tr' : [0,2],
+			'l' : [1,0],
+			'c' : [1,1],
+			'r' : [1,2],
+			'bl' : [2,0],
+			'b' : [2,1],
+			'br' : [2,2],
+			'title' : [1,1,0],
+			'tabs' : [1,1,1],
+			'contents' : [1,1,2],
+			'buttons' : [1,1,3]
+		};
+		for ( var i in this._.parts )
+			this._.parts[i] = getPart( this._.parts[i] );
+
+		// Insert the title.
+		( new CKEDITOR.dom.text( definition.title, CKEDITOR.document ) ).appendTo( this._.parts['title'] );
 	}
 };
@@ -104,6 +147,5 @@
 		var setSize = function( dialog, partName, width, height )
 		{
-			var id = dialog._.dialogId;
-			var element = CKEDITOR.document.getById( partName ? 'cke_dialog_' + partName + '_' + id : 'cke_dialog_' + id);
+			var element = partName ? dialog._.parts[partName] : dialog._.element.getFirst();
 			element.setStyles( {
 				width : Math.max( width || 0, 0 ) + 'px',
@@ -118,9 +160,9 @@
 		return function( width, height )
 		{
-			setSize( this, 'T', width - 32, 16 );
-			setSize( this, 'L', 16, height - 67 );
-			setSize( this, 'C', width - 32, height - 67 );
-			setSize( this, 'R', 16, height - 67 );
-			setSize( this, 'B', width - 60, 51 );
+			setSize( this, 't', width - 32, 16 );
+			setSize( this, 'l', 16, height - 67 );
+			setSize( this, 'c', width - 32, height - 67 );
+			setSize( this, 'r', 16, height - 67 );
+			setSize( this, 'b', width - 60, 51 );
 			setSize( this, null, width, height );
 			this._.size = { width : width, height : height };
@@ -154,5 +196,5 @@
 		var element = this._.element;
 		var definition = this._.definition;
-		if ( !element.getParent() )
+		if ( element.getParent() != CKEDITOR.document.getBody() )
 			element.appendTo( CKEDITOR.document.getBody() );
 
Index: /CKEditor/branches/prototype/_source/skins/default/dialog.css
===================================================================
--- /CKEditor/branches/prototype/_source/skins/default/dialog.css	(revision 2430)
+++ /CKEditor/branches/prototype/_source/skins/default/dialog.css	(revision 2431)
@@ -32,81 +32,85 @@
 }
 
-.cke_skin_default .cke_dialog_TL, 
-.cke_skin_default .cke_dialog_T,
-.cke_skin_default .cke_dialog_TR, 
-.cke_skin_default .cke_dialog_L,
-.cke_skin_default .cke_dialog_C,
-.cke_skin_default .cke_dialog_R,
-.cke_skin_default .cke_dialog_BL,
-.cke_skin_default .cke_dialog_B,
-.cke_skin_default .cke_dialog_BR
+.cke_skin_default .cke_dialog_tl, 
+.cke_skin_default .cke_dialog_t,
+.cke_skin_default .cke_dialog_tr, 
+.cke_skin_default .cke_dialog_l,
+.cke_skin_default .cke_dialog_c,
+.cke_skin_default .cke_dialog_r,
+.cke_skin_default .cke_dialog_bl,
+.cke_skin_default .cke_dialog_b,
+.cke_skin_default .cke_dialog_br
 {
 	float: left;
 }
 
-.cke_skin_default .cke_dialog_TL,
-.cke_skin_default .cke_dialog_L,
-.cke_skin_default .cke_dialog_BL
+.cke_skin_default .cke_dialog_tl,
+.cke_skin_default .cke_dialog_l,
+.cke_skin_default .cke_dialog_bl
 {
 	clear: left;
 }
 
-.cke_skin_default .cke_dialog_TL, 
-.cke_skin_default .cke_dialog_TR,
-.cke_skin_default .cke_dialog_L,
-.cke_skin_default .cke_dialog_R
+.cke_skin_default .cke_dialog_tl, 
+.cke_skin_default .cke_dialog_tr,
+.cke_skin_default .cke_dialog_l,
+.cke_skin_default .cke_dialog_r
 {
 	width: 16px;
 }
 
-.cke_skin_default .cke_dialog_TL,
-.cke_skin_default .cke_dialog_T,
-.cke_skin_default .cke_dialog_TR
+.cke_skin_default .cke_dialog_tl,
+.cke_skin_default .cke_dialog_t,
+.cke_skin_default .cke_dialog_tr
 {
 	height: 16px;
 }
 
-.cke_skin_default .cke_dialog_TL,
-.cke_skin_default .cke_dialog_T,
-.cke_skin_default .cke_dialog_TR,
-.cke_skin_default .cke_dialog_BL,
-.cke_skin_default .cke_dialog_B,
-.cke_skin_default .cke_dialog_BR
+.cke_skin_default .cke_dialog_tl,
+.cke_skin_default .cke_dialog_t,
+.cke_skin_default .cke_dialog_tr,
+.cke_skin_default .cke_dialog_bl,
+.cke_skin_default .cke_dialog_b,
+.cke_skin_default .cke_dialog_br
 {
 	background-image: url(images/sprites.png);
+	/* IE6 does not support full color transparent PNG. */
+	_background-image: url(images/sprites.gif);
 	background-repeat: no-repeat;
 }
 
-.cke_skin_default .cke_dialog_L,
-.cke_skin_default .cke_dialog_R
+.cke_skin_default .cke_dialog_l,
+.cke_skin_default .cke_dialog_r
 {
 	background-image: url(images/dialog.sides.png);
+	/* IE6 does not support full color transparent PNG. */
+	_background-image: url(images/dialog.sides.gif);
 	background-repeat: repeat-y;
 }
 
-.cke_skin_default .cke_dialog_BL,
-.cke_skin_default .cke_dialog_B,
-.cke_skin_default .cke_dialog_BR
+.cke_skin_default .cke_dialog_bl,
+.cke_skin_default .cke_dialog_b,
+.cke_skin_default .cke_dialog_br
 {
 	height: 51px;
 }
 
-.cke_skin_default .cke_dialog_BL,
-.cke_skin_default .cke_dialog_BR
+.cke_skin_default .cke_dialog_bl,
+.cke_skin_default .cke_dialog_br
 {
 	width: 30px;
 }
 
-.cke_skin_default .cke_dialog_TL
+.cke_skin_default .cke_dialog_tl
 {
 	background-position: -16px -16px;
 }
 
-.cke_skin_default .cke_dialog_TR
+.cke_skin_default .cke_dialog_tr
 {
 	background-position: -16px -76px;
 }
 
-.cke_skin_default .cke_dialog_T
+.cke_skin_default .cke_dialog_t
 {
 	background-position: 0px -136px;
@@ -114,20 +118,20 @@
 }
 
-.cke_skin_default .cke_dialog_L
+.cke_skin_default .cke_dialog_l
 {
 	background-position: 0px 0px;
 }
 
-.cke_skin_default .cke_dialog_R
+.cke_skin_default .cke_dialog_r
 {
 	background-position: -16px 0px;
 }
 
-.cke_skin_default .cke_dialog_BL
+.cke_skin_default .cke_dialog_bl
 {
 	background-position: -16px -196px;
 }
 
-.cke_skin_default .cke_dialog_B
+.cke_skin_default .cke_dialog_b
 {
 	background-position: 0px -330px;
@@ -135,6 +139,62 @@
 }
 
-.cke_skin_default .cke_dialog_BR
+.cke_skin_default .cke_dialog_br
 {
 	background-position: -16px -263px;
 }
+
+.cke_skin_default .cke_dialog_title
+{
+	position: absolute;
+	top: 2px;
+	left: 16px;
+	height: 23px;
+	right: 16px;
+	_width: expression(this.offsetParent.offsetWidth - 52);		/* 16px left cell + 16px right cell + 10px left padding + 10px right padding */
+	font-weight: bold;
+	font-size: 14pt;
+	color: #737357;
+	background-color: #e3e3c7;
+	padding: 3px 10px 3px 10px;
+	overflow: hidden;
+}
+
+.cke_skin_default .cke_dialog_tabs
+{
+	position: absolute;
+	top: 31px;
+	left: 16px;
+	height: 23px;
+	right: 16px;
+	background-color: #e3e3c7;
+	/* 
+	 * IE6 and IE7+ quirks mode do not support CSS right and bottom attributes 
+	 * when left and top are defined. Use IE-specific expressions to
+	 * workaround.
+	 */
+	_width: expression(this.offsetParent.offsetWidth - 32);		/* 16px left cell + 16px right cell */
+}
+
+.cke_skin_default .cke_dialog_contents
+{
+	position: absolute;
+	background-color: #f1f1e3;
+	top: 54px;
+	left: 16px;
+	bottom: 51px;
+	right: 16px;
+	border: #d5d59d 1px solid;
+	_width: expression(this.offsetParent.offsetWidth - 34);		/* 16px left cell + 16px right cell + 1px left border + 1px right border */
+	_height: expression(this.offsetParent.offsetHeight - 107);	/* 16px top cell + 51px bottom cell + 1px top border + 1px bottom border */
+}
+
+.cke_skin_default .cke_dialog_buttons
+{
+	position: absolute;
+	background-color: #e3e3c7;
+	height: 31px;
+	left: 16px;
+	right: 16px;
+	bottom: 20px;
+	_width: expression(this.offsetParent.offsetWidth - 32);		/* 16px left cell + 16px right cell */
+}
Index: /CKEditor/branches/prototype/_source/skins/default/toolbar.css
===================================================================
--- /CKEditor/branches/prototype/_source/skins/default/toolbar.css	(revision 2430)
+++ /CKEditor/branches/prototype/_source/skins/default/toolbar.css	(revision 2431)
@@ -48,6 +48,6 @@
 	padding-left: 4px;
 	padding-right: 4px;
-    filter: alpha(opacity=70); /* IE */
-    opacity: 0.70; /* Safari, Opera and Mozilla */
+	filter: alpha(opacity=70); /* IE */
+	opacity: 0.70; /* Safari, Opera and Mozilla */
 	display:block;
 	float: left;
@@ -70,6 +70,6 @@
 	padding-left: 4px;
 	padding-right: 4px;
-    filter: alpha(opacity=100); /* IE */
-    opacity: 1; /* Safari, Opera and Mozilla */
+	filter: alpha(opacity=100); /* IE */
+	opacity: 1; /* Safari, Opera and Mozilla */
 	display:block;
 	float: left;
Index: /CKEditor/branches/prototype/_source/themes/default/theme.js
===================================================================
--- /CKEditor/branches/prototype/_source/themes/default/theme.js	(revision 2430)
+++ /CKEditor/branches/prototype/_source/themes/default/theme.js	(revision 2431)
@@ -107,27 +107,26 @@
 				'<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 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 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 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 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 ) );
 
-		container.dialogId = dialogId;
 		return container;
 	},
