Index: /CKEditor/trunk/_source/plugins/clipboard/dialogs/paste.js
===================================================================
--- /CKEditor/trunk/_source/plugins/clipboard/dialogs/paste.js	(revision 3275)
+++ /CKEditor/trunk/_source/plugins/clipboard/dialogs/paste.js	(revision 3276)
@@ -56,6 +56,6 @@
 		title : editor.lang.clipboard.title,
 
-		minWidth : 400,
-		minHeight : 330,
+		minWidth : 350,
+		minHeight : 240,
 
 		onShow : function()
Index: /CKEditor/trunk/_source/plugins/dialog/plugin.js
===================================================================
--- /CKEditor/trunk/_source/plugins/dialog/plugin.js	(revision 3275)
+++ /CKEditor/trunk/_source/plugins/dialog/plugin.js	(revision 3276)
@@ -73,4 +73,7 @@
 		return null;
 	}
+
+	// Stores dialog related data from skin definitions. e.g. margin sizes.
+	var skinData = {};
 
 	/**
@@ -109,4 +112,6 @@
 			, editor ).definition;
 
+		var doc = CKEDITOR.document;
+
 		var themeBuilt = editor.theme.buildDialog( editor );
 
@@ -137,64 +142,6 @@
 		};
 
-		/**
-		 * An associative map of elements in the dialog. It has the following members:
-		 * <ul>
-		 * 	<li>tl - top left corner.</li>
-		 * 	<li>tl_resize - resize handle at the top left corner.</li>
-		 * 	<li>t - top side.</li>
-		 * 	<li>t_resize - resize handle at the top.</li>
-		 * 	<li>tr - top right corner.</li>
-		 * 	<li>tr_resize - resize handle at the top right.</li>
-		 * 	<li>l - left side.</li>
-		 * 	<li>l_resize - resize handle at the left side.</li>
-		 * 	<li>c - center area.</li>
-		 * 	<li>r - right side.</li>
-		 * 	<li>r_resize - resize handle at the right side.</li>
-		 * 	<li>bl - bottom left corner.</li>
-		 * 	<li>bl_resize - resize handle at the bottom left.</li>
-		 * 	<li>b - bottom side.</li>
-		 * 	<li>b_resize - resize handle at the bottom.</li>
-		 * 	<li>br - bottom right corner.</li>
-		 * 	<li>br_resize - resize handle at the bottom right.</li>
-		 * 	<li>title - title area.</li>
-		 * 	<li>close - close button.</li>
-		 * 	<li>tabs - tabs area.</li>
-		 * 	<li>contents - the content page area.</li>
-		 * 	<li>footer - the footer area.</li>
-		 * </ul>
-		 * @type Object
-		 * @field
-		 */
-		this.parts = {
-			'tl' : [0,0],
-			'tl_resize' : [0,0,0],
-			't' : [0,1],
-			't_resize' : [0,1,0],
-			'tr' : [0,2],
-			'tr_resize' : [0,2,0],
-			'l' : [1,0],
-			'l_resize' : [1,0,0],
-			'c' : [1,1],
-			'r' : [1,2],
-			'r_resize' : [1,2,0],
-			'bl' : [2,0],
-			'bl_resize' : [2,0,0],
-			'b' : [2,1],
-			'b_resize' : [2,1,0],
-			'br' : [2,2],
-			'br_resize' : [2,2,0],
-			'title' : [1,1,0],
-			'close' : [1,1,0,0],
-			'tabs' : [1,1,1,0,0],
-			'tabs_table' : [1,1,1],
-			'contents' : [1,1,2],
-			'footer' : [1,1,3]
-		};
-
-		// Initialize the parts map.
-		var element = this._.element.getFirst();
-		for ( var i in this.parts )
-			this.parts[i] = element.getChild( this.parts[i] );
-
+		this.parts = themeBuilt.parts;
+		
 		// Call the CKEDITOR.event constructor to initialize this instance.
 		CKEDITOR.event.call( this );
@@ -331,5 +278,5 @@
 					var nextId = shiftPressed ? getPreviousVisibleTab.call( me ) : getNextVisibleTab.call( me );
 					me.selectPage( nextId );
-					me._.tabs[ nextId ][ 0 ].getFirst().focus();
+					me._.tabs[ nextId ][ 0 ].focus();
 				}
 				else
@@ -345,5 +292,5 @@
 				// Alt-F10 puts focus into the current tab item in the tab bar.
 				me._.tabBarMode = true;
-				me._.tabs[ me._.currentTabId ][ 0 ].getFirst().focus();
+				me._.tabs[ me._.currentTabId ][ 0 ].focus();
 				processed = true;
 			}
@@ -353,5 +300,5 @@
 				var nextId = ( keystroke == 37 ? getPreviousVisibleTab.call( me ) : getNextVisibleTab.call( me ) );
 				me.selectPage( nextId );
-				me._.tabs[ nextId ][ 0 ].getFirst().focus();
+				me._.tabs[ nextId ][ 0 ].focus();
 				processed = true;
 			}
@@ -424,9 +371,5 @@
 
 					// Find the outer <td> container of the tab.
-					while ( target.getName() != 'td' || !tabOuterRegex.test( target.$.className ) )
-					{
-						target = target.getParent();
-					}
-					id = target.$.id.substr( 0, target.$.id.lastIndexOf( '_' ) );
+					var id = target.$.id.substr( 0, target.$.id.lastIndexOf( '_' ) );
 					this.selectPage( id );
 
@@ -455,5 +398,5 @@
 		// Insert dummy text box for grabbing focus away from the editing area.
 		this._.dummyText = CKEDITOR.dom.element.createFromHtml( '<input type="text" style="position: absolute; left: -100000px; top: -100000px" />' );
-		this._.dummyText.appendTo( element );
+		this._.dummyText.appendTo( themeBuilt.element );
 
 		CKEDITOR.skins.load( editor.config.skin, 'dialog' );
@@ -497,5 +440,6 @@
 		getSize : function()
 		{
-			return CKEDITOR.tools.extend( {}, this._.size );
+			var element = this._.element.getFirst();
+			return { width : element.$.offsetWidth, height : element.$.offsetHeight };
 		},
 
@@ -515,6 +459,7 @@
 				// The dialog may be fixed positioned or absolute positioned. Ask the
 				// browser what is the current situation first.
+				var element = this._.element.getElementsByTag( 'div' ).getItem( 0 );
 				if ( isFixed === undefined )
-					isFixed = this._.element.getFirst().getComputedStyle( 'position' ) == 'fixed';
+					isFixed = element.getComputedStyle( 'position' ) == 'fixed';
 
 				if ( isFixed && this._.position && this._.position.x == x && this._.position.y == y )
@@ -532,5 +477,5 @@
 				}
 
-				this._.element.getFirst().setStyles(
+				element.setStyles(
 						{
 							'left' : x + 'px',
@@ -733,5 +678,7 @@
 							className : 'cke_dialog_page_contents',
 							children : contents.elements,
-							expand : !!contents.expand
+							expand : !!contents.expand,
+							padding : contents.padding,
+							style : 'width: 100%; height: 100%;'
 						}, pageHtml );
 
@@ -739,26 +686,19 @@
 			var page = CKEDITOR.dom.element.createFromHtml( pageHtml.join( '' ) );
 			var tab = CKEDITOR.dom.element.createFromHtml( [
-					'<table><tbody><tr><td class="cke_dialog_tab">',
-					'<a href="javascript: void(0)"', titleHtml, ' style="display: block; outline: none;" hidefocus="true">',
-					'<table border="0" cellspacing="0" cellpadding="0"><tbody><tr>',
-						'<td class="cke_dialog_tab_left"></td>',
-						'<td class="cke_dialog_tab_center">',
-							CKEDITOR.tools.htmlEncode( contents.label.replace( / /g, '\xa0' ) ),
-						'</td>',
-						'<td class="cke_dialog_tab_right"></td>',
-					'</tr></tbody></table></a></td></tr></tbody></table>'
+					'<a class="cke_dialog_tab"',
+						( this._.pageCount > 0 ? ' cke_last' : 'cke_first' ),
+						titleHtml, 
+						' id="', contents.id + '_', CKEDITOR.tools.getNextNumber(), '"' +
+						' href="javascript:void(0)"', 
+						' hidefocus="true">',
+							contents.label,
+					'</a>'
 				].join( '' ) );
-			tab = tab.getChild( [0,0,0] );
-
-			// First and last tab styles classes.
-			if ( this._.lastTab )
-				this._.lastTab.removeClass( 'last' );
-			tab.addClass( this._.pageCount > 0 ? 'last' : 'first' );
 
 			// If only a single page exist, a different style is used in the central pane.
 			if ( this._.pageCount === 0 )
-				this.parts.c.addClass( 'single_page' );
+				this.parts.dialog.addClass( 'cke_single_page' );
 			else
-				this.parts.c.removeClass( 'single_page' );
+				this.parts.dialog.removeClass( 'cke_single_page' );
 
 			// Take records for the tabs and elements created.
@@ -767,7 +707,9 @@
 			this._.pageCount++;
 			this._.lastTab = tab;
+
 			var contentMap = this._.contents[ contents.id ] = {},
 				cursor,
 				children = vbox.getChild();
+
 			while ( ( cursor = children.shift() ) )
 			{
@@ -778,9 +720,10 @@
 
 			// Attach the DOM nodes.
+
+			page.setAttribute( 'name', contents.id );
+			page.appendTo( this.parts.contents );
+
 			tab.unselectable();
-			page.appendTo( this.parts.contents );
-			tab.insertBefore( this.parts.tabs.getChild( this.parts.tabs.getChildCount() - 1 ) );
-			tab.setAttribute( 'id', contents.id + '_' + CKEDITOR.tools.getNextNumber() );
-			page.setAttribute( 'name', contents.id );
+			this.parts.tabs.append( tab );
 
 			// Add access key handlers if access key is defined.
@@ -1061,5 +1004,4 @@
 						type : 'button',
 						label : editor.lang.common.ok,
-						style : 'width: 60px',
 						onClick : function( evt )
 						{
@@ -1095,5 +1037,4 @@
 						type : 'button',
 						label : editor.lang.common.cancel,
-						style : 'width: 60px',
 						onClick : function( evt )
 						{
@@ -1121,21 +1062,5 @@
 			addUIElement : function( typeName, builder )
 			{
-				this._.uiElementBuilders[typeName] = builder;
-			},
-
-			/**
-			 * Sets the width of margins of dialogs, which is used for the dialog moving and resizing logic.
-			 * The margin here means the area between the dialog's container <div> and the visual boundary of the dialog.
-			 * Typically this area is used for dialog shadows.
-			 * This function is typically called in a skin's JavaScript files.
-			 * @param {Number} top The top margin in pixels.
-			 * @param {Number} right The right margin in pixels.
-			 * @param {Number} bottom The bottom margin in pixels.
-			 * @param {Number} left The left margin in pixels.
-			 * @example
-			 */
-			setMargins : function( top, right, bottom, left )
-			{
-				this._.margins = [ top, right, bottom, left ];
+				this._.uiElementBuilders[ typeName ] = builder;
 			}
 		});
@@ -1149,7 +1074,5 @@
 		currentTop : null,
 
-		currentZIndex : null,
-
-		margins : [0, 0, 0, 0]
+		currentZIndex : null
 	};
 
@@ -1352,5 +1275,5 @@
 	 * 	} );
 	 */
-	var contentObject = function( dialog, contentDefinition )
+	function contentObject( dialog, contentDefinition )
 	{
 		this._ =
@@ -1360,5 +1283,5 @@
 
 		CKEDITOR.tools.extend( this, contentDefinition );
-	};
+	}
 
 	contentObject.prototype =
@@ -1405,75 +1328,79 @@
 	};
 
-	var initDragAndDrop = function( dialog )
+	function initDragAndDrop( dialog )
 	{
 		var lastCoords = null,
 			abstractDialogCoords = null,
 			element = dialog.getElement().getFirst(),
-			magnetDistance = dialog._.editor.config.dialog_magnetDistance,
-			mouseMoveHandler = function( evt )
-			{
-				var dialogSize = dialog.getSize(),
-					viewPaneSize = CKEDITOR.document.getWindow().getViewPaneSize(),
-					x = evt.data.$.screenX,
-					y = evt.data.$.screenY,
-					dx = x - lastCoords.x,
-					dy = y - lastCoords.y,
-					realX, realY;
-
-				lastCoords = { x : x, y : y };
-				abstractDialogCoords.x += dx;
-				abstractDialogCoords.y += dy;
-
-				if ( abstractDialogCoords.x + CKEDITOR.dialog._.margins[3] < magnetDistance )
-					realX = - CKEDITOR.dialog._.margins[3];
-				else if ( abstractDialogCoords.x - CKEDITOR.dialog._.margins[1] > viewPaneSize.width - dialogSize.width - magnetDistance )
-					realX = viewPaneSize.width - dialogSize.width + CKEDITOR.dialog._.margins[1];
-				else
-					realX = abstractDialogCoords.x;
-
-				if ( abstractDialogCoords.y + CKEDITOR.dialog._.margins[0] < magnetDistance )
-					realY = - CKEDITOR.dialog._.margins[0];
-				else if ( abstractDialogCoords.y - CKEDITOR.dialog._.margins[2] > viewPaneSize.height - dialogSize.height - magnetDistance )
-					realY = viewPaneSize.height - dialogSize.height + CKEDITOR.dialog._.margins[2];
-				else
-					realY = abstractDialogCoords.y;
-
-				dialog.move( realX, realY );
+			editor = dialog.getParentEditor(),
+			magnetDistance = editor.config.dialog_magnetDistance,
+			margins = skinData[ editor.config.skin ].margins || [ 0, 0, 0, 0 ];
+
+		function mouseMoveHandler( evt )
+		{
+			var dialogSize = dialog.getSize(),
+				viewPaneSize = CKEDITOR.document.getWindow().getViewPaneSize(),
+				x = evt.data.$.screenX,
+				y = evt.data.$.screenY,
+				dx = x - lastCoords.x,
+				dy = y - lastCoords.y,
+				realX, realY;
+
+			lastCoords = { x : x, y : y };
+			abstractDialogCoords.x += dx;
+			abstractDialogCoords.y += dy;
+
+			if ( abstractDialogCoords.x + margins[3] < magnetDistance )
+				realX = - margins[3];
+			else if ( abstractDialogCoords.x - margins[1] > viewPaneSize.width - dialogSize.width - magnetDistance )
+				realX = viewPaneSize.width - dialogSize.width + margins[1];
+			else
+				realX = abstractDialogCoords.x;
+
+			if ( abstractDialogCoords.y + margins[0] < magnetDistance )
+				realY = - margins[0];
+			else if ( abstractDialogCoords.y - margins[2] > viewPaneSize.height - dialogSize.height - magnetDistance )
+				realY = viewPaneSize.height - dialogSize.height + margins[2];
+			else
+				realY = abstractDialogCoords.y;
+
+			dialog.move( realX, realY );
+
+			evt.data.preventDefault();
+		}
+
+		function mouseUpHandler( evt )
+		{
+			CKEDITOR.document.removeListener( 'mousemove', mouseMoveHandler );
+			CKEDITOR.document.removeListener( 'mouseup', mouseUpHandler );
+
+			if ( CKEDITOR.env.ie6Compat )
+			{
+				var coverDoc = CKEDITOR.document.getById( 'cke_dialog_background_iframe' ).getFrameDocument();
+				coverDoc.removeListener( 'mousemove', mouseMoveHandler );
+				coverDoc.removeListener( 'mouseup', mouseUpHandler );
+			}
+		}
+
+		dialog.parts.title.on( 'mousedown', function( evt )
+			{
+				lastCoords = { x : evt.data.$.screenX, y : evt.data.$.screenY };
+
+				CKEDITOR.document.on( 'mousemove', mouseMoveHandler );
+				CKEDITOR.document.on( 'mouseup', mouseUpHandler );
+				abstractDialogCoords = dialog.getPosition();
+
+				if ( CKEDITOR.env.ie6Compat )
+				{
+					var coverDoc = CKEDITOR.document.getById( 'cke_dialog_background_iframe' ).getFrameDocument();
+					coverDoc.on( 'mousemove', mouseMoveHandler );
+					coverDoc.on( 'mouseup', mouseUpHandler );
+				}
 
 				evt.data.preventDefault();
-			},
-			mouseUpHandler = function( evt )
-			{
-				CKEDITOR.document.removeListener( 'mousemove', mouseMoveHandler );
-				CKEDITOR.document.removeListener( 'mouseup', mouseUpHandler );
-
-				if ( CKEDITOR.env.ie6Compat )
-				{
-					var coverDoc = CKEDITOR.document.getById( 'cke_dialog_background_iframe' ).getFrameDocument();
-					coverDoc.removeListener( 'mousemove', mouseMoveHandler );
-					coverDoc.removeListener( 'mouseup', mouseUpHandler );
-				}
-			};
-
-		dialog.parts.title.on( 'mousedown', function( evt )
-				{
-					lastCoords = { x : evt.data.$.screenX, y : evt.data.$.screenY };
-
-					CKEDITOR.document.on( 'mousemove', mouseMoveHandler );
-					CKEDITOR.document.on( 'mouseup', mouseUpHandler );
-					abstractDialogCoords = dialog.getPosition();
-
-					if ( CKEDITOR.env.ie6Compat )
-					{
-						var coverDoc = CKEDITOR.document.getById( 'cke_dialog_background_iframe' ).getFrameDocument();
-						coverDoc.on( 'mousemove', mouseMoveHandler );
-						coverDoc.on( 'mouseup', mouseUpHandler );
-					}
-
-					evt.data.preventDefault();
-				}, dialog );
-	};
-
-	var initResizeHandles = function( dialog )
+			}, dialog );
+	}
+
+	function initResizeHandles( dialog )
 	{
 		var definition = dialog.definition,
@@ -1481,130 +1408,140 @@
 			minHeight = definition.minHeight || 0,
 			resizable = definition.resizable,
-			topSizer = function( coords, dy )
-			{
-				coords.y += dy;
-			},
-			rightSizer = function( coords, dx )
-			{
-				coords.x2 += dx;
-			},
-			bottomSizer = function( coords, dy )
-			{
-				coords.y2 += dy;
-			},
-			leftSizer = function( coords, dx )
-			{
-				coords.x += dx;
-			},
-			lastCoords = null,
+			margins = skinData[ dialog.getParentEditor().config.skin ].margins || [ 0, 0, 0, 0 ];
+
+		function topSizer( coords, dy )
+		{
+			coords.y += dy;
+		}
+
+		function rightSizer( coords, dx )
+		{
+			coords.x2 += dx;
+		}
+
+		function bottomSizer( coords, dy )
+		{
+			coords.y2 += dy;
+		}
+
+		function leftSizer( coords, dx )
+		{
+			coords.x += dx;
+		}
+
+		var lastCoords = null,
 			abstractDialogCoords = null,
 			magnetDistance = dialog._.editor.config.magnetDistance,
-			parts = [ 'tl', 't', 'tr', 'l', 'r', 'bl', 'b', 'br' ],
-			mouseDownHandler = function( evt )
-			{
-				var partName = evt.listenerData.part, size = dialog.getSize();
-				abstractDialogCoords = dialog.getPosition();
-				CKEDITOR.tools.extend( abstractDialogCoords,
-					{
-						x2 : abstractDialogCoords.x + size.width,
-						y2 : abstractDialogCoords.y + size.height
-					} );
-				lastCoords = { x : evt.data.$.screenX, y : evt.data.$.screenY };
-
-				CKEDITOR.document.on( 'mousemove', mouseMoveHandler, dialog, { part : partName } );
-				CKEDITOR.document.on( 'mouseup', mouseUpHandler, dialog, { part : partName } );
-
-				if ( CKEDITOR.env.ie6Compat )
-				{
-					var coverDoc = CKEDITOR.document.getById( 'cke_dialog_background_iframe' ).getFrameDocument();
-					coverDoc.on( 'mousemove', mouseMoveHandler, dialog, { part : partName } );
-					coverDoc.on( 'mouseup', mouseUpHandler, dialog, { part : partName } );
-				}
-
-				evt.data.preventDefault();
-			},
-			mouseMoveHandler = function( evt )
-			{
-				var x = evt.data.$.screenX,
-					y = evt.data.$.screenY,
-					dx = x - lastCoords.x,
-					dy = y - lastCoords.y,
-					viewPaneSize = CKEDITOR.document.getWindow().getViewPaneSize(),
-					partName = evt.listenerData.part;
-
-				if ( partName.search( 't' ) != -1 )
-					topSizer( abstractDialogCoords, dy );
-				if ( partName.search( 'l' ) != -1 )
-					leftSizer( abstractDialogCoords, dx );
-				if ( partName.search( 'b' ) != -1 )
-					bottomSizer( abstractDialogCoords, dy );
-				if ( partName.search( 'r' ) != -1 )
-					rightSizer( abstractDialogCoords, dx );
-
-				lastCoords = { x : x, y : y };
-
-				var realX, realY, realX2, realY2;
-
-				if ( abstractDialogCoords.x + CKEDITOR.dialog._.margins[3] < magnetDistance )
-					realX = - CKEDITOR.dialog._.margins[3];
-				else if ( partName.search( 'l' ) != -1 && abstractDialogCoords.x2 - abstractDialogCoords.x < minWidth + magnetDistance )
-					realX = abstractDialogCoords.x2 - minWidth;
-				else
-					realX = abstractDialogCoords.x;
-
-				if ( abstractDialogCoords.y + CKEDITOR.dialog._.margins[0] < magnetDistance )
-					realY = - CKEDITOR.dialog._.margins[0];
-				else if ( partName.search( 't' ) != -1 && abstractDialogCoords.y2 - abstractDialogCoords.y < minHeight + magnetDistance )
-					realY = abstractDialogCoords.y2 - minHeight;
-				else
-					realY = abstractDialogCoords.y;
-
-				if ( abstractDialogCoords.x2 - CKEDITOR.dialog._.margins[1] > viewPaneSize.width - magnetDistance )
-					realX2 = viewPaneSize.width + CKEDITOR.dialog._.margins[1] ;
-				else if ( partName.search( 'r' ) != -1 && abstractDialogCoords.x2 - abstractDialogCoords.x < minWidth + magnetDistance )
-					realX2 = abstractDialogCoords.x + minWidth;
-				else
-					realX2 = abstractDialogCoords.x2;
-
-				if ( abstractDialogCoords.y2 - CKEDITOR.dialog._.margins[2] > viewPaneSize.height - magnetDistance )
-					realY2= viewPaneSize.height + CKEDITOR.dialog._.margins[2] ;
-				else if ( partName.search( 'b' ) != -1 && abstractDialogCoords.y2 - abstractDialogCoords.y < minHeight + magnetDistance )
-					realY2 = abstractDialogCoords.y + minHeight;
-				else
-					realY2 = abstractDialogCoords.y2 ;
-
-				dialog.move( realX, realY );
-				dialog.resize( realX2 - realX, realY2 - realY );
-
-				evt.data.preventDefault();
-			},
-			mouseUpHandler = function( evt )
-			{
-				CKEDITOR.document.removeListener( 'mouseup', mouseUpHandler );
-				CKEDITOR.document.removeListener( 'mousemove', mouseMoveHandler );
-
-				if ( CKEDITOR.env.ie6Compat )
-				{
-					var coverDoc = CKEDITOR.document.getById( 'cke_dialog_background_iframe' ).getFrameDocument();
-					coverDoc.removeListener( 'mouseup', mouseUpHandler );
-					coverDoc.removeListener( 'mousemove', mouseMoveHandler );
-				}
-			};
-
-		var widthTest = /[lr]/,
-			heightTest = /[tb]/;
-		for ( var i = 0 ; i < parts.length ; i++ )
-		{
-			var element = dialog.parts[ parts[i] + '_resize' ];
-			if ( resizable == CKEDITOR.DIALOG_RESIZE_NONE ||
-					resizable == CKEDITOR.DIALOG_RESIZE_HEIGHT && widthTest.test( parts[i] ) ||
-			  		resizable == CKEDITOR.DIALOG_RESIZE_WIDTH && heightTest.test( parts[i] ) )
-			{
-				element.hide();
-				continue;
-			}
-			element.on( 'mousedown', mouseDownHandler, dialog, { part : parts[i] } );
-		}
-	};
+			parts = [ 'tl', 't', 'tr', 'l', 'r', 'bl', 'b', 'br' ];
+
+		function mouseDownHandler( evt )
+		{
+			var partName = evt.listenerData.part, size = dialog.getSize();
+			abstractDialogCoords = dialog.getPosition();
+			CKEDITOR.tools.extend( abstractDialogCoords,
+				{
+					x2 : abstractDialogCoords.x + size.width,
+					y2 : abstractDialogCoords.y + size.height
+				} );
+			lastCoords = { x : evt.data.$.screenX, y : evt.data.$.screenY };
+
+			CKEDITOR.document.on( 'mousemove', mouseMoveHandler, dialog, { part : partName } );
+			CKEDITOR.document.on( 'mouseup', mouseUpHandler, dialog, { part : partName } );
+
+			if ( CKEDITOR.env.ie6Compat )
+			{
+				var coverDoc = CKEDITOR.document.getById( 'cke_dialog_background_iframe' ).getFrameDocument();
+				coverDoc.on( 'mousemove', mouseMoveHandler, dialog, { part : partName } );
+				coverDoc.on( 'mouseup', mouseUpHandler, dialog, { part : partName } );
+			}
+
+			evt.data.preventDefault();
+		}
+
+		function mouseMoveHandler( evt )
+		{
+			var x = evt.data.$.screenX,
+				y = evt.data.$.screenY,
+				dx = x - lastCoords.x,
+				dy = y - lastCoords.y,
+				viewPaneSize = CKEDITOR.document.getWindow().getViewPaneSize(),
+				partName = evt.listenerData.part;
+
+			if ( partName.search( 't' ) != -1 )
+				topSizer( abstractDialogCoords, dy );
+			if ( partName.search( 'l' ) != -1 )
+				leftSizer( abstractDialogCoords, dx );
+			if ( partName.search( 'b' ) != -1 )
+				bottomSizer( abstractDialogCoords, dy );
+			if ( partName.search( 'r' ) != -1 )
+				rightSizer( abstractDialogCoords, dx );
+
+			lastCoords = { x : x, y : y };
+
+			var realX, realY, realX2, realY2;
+
+			if ( abstractDialogCoords.x + margins[3] < magnetDistance )
+				realX = - margins[3];
+			else if ( partName.search( 'l' ) != -1 && abstractDialogCoords.x2 - abstractDialogCoords.x < minWidth + magnetDistance )
+				realX = abstractDialogCoords.x2 - minWidth;
+			else
+				realX = abstractDialogCoords.x;
+
+			if ( abstractDialogCoords.y + margins[0] < magnetDistance )
+				realY = - margins[0];
+			else if ( partName.search( 't' ) != -1 && abstractDialogCoords.y2 - abstractDialogCoords.y < minHeight + magnetDistance )
+				realY = abstractDialogCoords.y2 - minHeight;
+			else
+				realY = abstractDialogCoords.y;
+
+			if ( abstractDialogCoords.x2 - margins[1] > viewPaneSize.width - magnetDistance )
+				realX2 = viewPaneSize.width + margins[1] ;
+			else if ( partName.search( 'r' ) != -1 && abstractDialogCoords.x2 - abstractDialogCoords.x < minWidth + magnetDistance )
+				realX2 = abstractDialogCoords.x + minWidth;
+			else
+				realX2 = abstractDialogCoords.x2;
+
+			if ( abstractDialogCoords.y2 - margins[2] > viewPaneSize.height - magnetDistance )
+				realY2= viewPaneSize.height + margins[2] ;
+			else if ( partName.search( 'b' ) != -1 && abstractDialogCoords.y2 - abstractDialogCoords.y < minHeight + magnetDistance )
+				realY2 = abstractDialogCoords.y + minHeight;
+			else
+				realY2 = abstractDialogCoords.y2 ;
+
+			dialog.move( realX, realY );
+			dialog.resize( realX2 - realX, realY2 - realY );
+
+			evt.data.preventDefault();
+		}
+
+		function mouseUpHandler( evt )
+		{
+			CKEDITOR.document.removeListener( 'mouseup', mouseUpHandler );
+			CKEDITOR.document.removeListener( 'mousemove', mouseMoveHandler );
+
+			if ( CKEDITOR.env.ie6Compat )
+			{
+				var coverDoc = CKEDITOR.document.getById( 'cke_dialog_background_iframe' ).getFrameDocument();
+				coverDoc.removeListener( 'mouseup', mouseUpHandler );
+				coverDoc.removeListener( 'mousemove', mouseMoveHandler );
+			}
+		}
+
+// TODO : Simplify the resize logic, having just a single resize grip <div>.
+//		var widthTest = /[lr]/,
+//			heightTest = /[tb]/;
+//		for ( var i = 0 ; i < parts.length ; i++ )
+//		{
+//			var element = dialog.parts[ parts[i] + '_resize' ];
+//			if ( resizable == CKEDITOR.DIALOG_RESIZE_NONE ||
+//					resizable == CKEDITOR.DIALOG_RESIZE_HEIGHT && widthTest.test( parts[i] ) ||
+//			  		resizable == CKEDITOR.DIALOG_RESIZE_WIDTH && heightTest.test( parts[i] ) )
+//			{
+//				element.hide();
+//				continue;
+//			}
+//			element.on( 'mousedown', mouseDownHandler, dialog, { part : parts[i] } );
+//		}
+	}
 
 	var resizeCover;
@@ -1664,8 +1601,8 @@
 			var size = win.getViewPaneSize();
 			element.setStyles(
-					{
-						width : size.width + 'px',
-						height : size.height + 'px'
-					});
+				{
+					width : size.width + 'px',
+					height : size.height + 'px'
+				} );
 		};
 
@@ -2025,7 +1962,13 @@
 				};
 
-				CKEDITOR.ui.dialog.uiElement.call( this, dialog, elementDefinition || { type : 'hbox' }, htmlList, 'table', styles,
-						{ align : ( elementDefinition && elementDefinition.align ) ||
-							( dialog.getParentEditor().lang.dir == 'ltr' ? 'left' : 'right' ) }, innerHTML );
+				CKEDITOR.ui.dialog.uiElement.call( 
+					this, 
+					dialog, 
+					elementDefinition || { type : 'hbox' }, 
+					htmlList, 
+					'table', 
+					styles,
+					elementDefinition && elementDefinition.align && { align : elementDefinition.align } || null,
+					innerHTML );
 			},
 
@@ -2598,4 +2541,14 @@
 	})();
 
+	// Grab the margin data from skin definition and store it away.
+	CKEDITOR.skins.add = ( function()
+	{
+		var original = CKEDITOR.skins.add;
+		return function( skinName, skinDefinition )
+		{
+			skinData[ skinName ] = { margins : skinDefinition.margins };
+			return original.apply( this, arguments );
+		};
+	} )();
 })();
 
Index: /CKEditor/trunk/_source/plugins/dialogui/plugin.js
===================================================================
--- /CKEditor/trunk/_source/plugins/dialogui/plugin.js	(revision 3275)
+++ /CKEditor/trunk/_source/plugins/dialogui/plugin.js	(revision 3276)
@@ -435,111 +435,87 @@
 			button : function( dialog, elementDefinition, htmlList )
 			{
-				if ( arguments.length < 3)
+				if ( !arguments.length )
 					return;
 
-				if ( typeof( elementDefinition ) == 'function' )
+				if ( typeof elementDefinition == 'function' )
 					elementDefinition = elementDefinition( dialog.getParentEditor() );
+
 				initPrivateObject.call( this, elementDefinition, { disabled : elementDefinition.disabled || false } );
-
-				/** @ignore */
-				var innerHTML = function()
-				{
-					var styles = [],
-						align = elementDefinition.align || ( dialog.getParentEditor().lang.dir == 'ltr' ? 'left' : 'right' );
-
-					if ( elementDefinition.style )
-					{
-						var defStyle = CKEDITOR.tools.trim( elementDefinition.style );
-						styles.push( defStyle );
-						if ( defStyle.charAt( defStyle.length - 1 ) != ';' )
-							styles.push( ';' );
-					}
-
-					// IE6 & 7 BUG: Need to set margin as well as align.
-					if ( CKEDITOR.env.ie && CKEDITOR.env.version < 8 )
-					{
-						styles.push( [
-							'margin:',
-							'auto',
-							align == 'right' ? '0px' : 'auto',
-							'auto',
-							align == 'left' ? '0px' : 'auto' ].join( ' ' ), ';' );
-					}
-
-					return [
-						'<table align="', align, '" ', styles.length > 0 ? 'style="' + styles.join( '' ) + '">' : '>',
-						'<tbody><tr><td class="cke_dialog_ui_button_txt">',
-						CKEDITOR.tools.htmlEncode( elementDefinition.label ),
-						'</td></tr></tbody></table>'
-					].join( '' );
-				};
 
 				// Add OnClick event to this input.
 				CKEDITOR.event.implementOn( this );
 
+				var me = this;
+
 				// Register an event handler for processing button clicks.
-				var me = this;
 				dialog.on( 'load', function( eventInfo )
+					{
+						var element = this.getElement();
+
+						element.on( 'mousedown', function( evt )
+							{
+								// If button is disabled, don't do anything.
+								if ( me._.disabled )
+									return;
+
+								// Store the currently active button.
+								CKEDITOR.ui.dialog.button._.activeButton = [ me, me.getElement() ];
+							} );
+
+						element.on( 'keydown', function( evt )
+							{
+								// Click if Enter is pressed.
+								if ( evt.data.$.keyCode == 13 )
+								{
+									me.fire( 'click', { dialog : me.getDialog() } );
+									evt.data.preventDefault();
+								}
+							} );
+
+						if ( !eventInfo.data.buttonHandlerRegistered )
 						{
-							var element = this.getElement();
-							(function()
-							{
-								element.on( 'mousedown', function( evt )
-									{
-										// If button is disabled, don't do anything.
-										if ( me._.disabled )
-											return;
-
-										// Store the currently active button.
-										CKEDITOR.ui.dialog.button._.activeButton = [ me, me.getElement() ];
-									} );
-
-								element.on( 'keydown', function( evt )
-									{
-										// Click if Enter is pressed.
-										if ( evt.data.$.keyCode == 13 )
-										{
-											me.fire( 'click', { dialog : me.getDialog() } );
-											evt.data.preventDefault();
-										}
-									} );
-							})();
-
-							// IE BUG: Padding attributes are ignored for <td> cells.
-							if ( CKEDITOR.env.ie )
-								element.getChild( [0, 0, 0, 0] ).$.innerHTML += '';
-
-							if ( !eventInfo.data.buttonHandlerRegistered )
-							{
-								CKEDITOR.document.on( 'mouseup', function( evt )
-									{
-										var target = evt.data.getTarget(),
-											activeButton = CKEDITOR.ui.dialog.button._.activeButton;
-
-										// If there's no active button, bail out.
-										if ( !activeButton )
-											return;
-
-										// Fire the click event - but only if the
-										// active button is the same as target.
-										if ( activeButton[1].equals( target.getAscendant( 'a' ) ) )
-											activeButton[0].fire( 'click', { dialog : activeButton[0].getDialog() } );
-
-										// Clear active button flag.
-										CKEDITOR.ui.dialog.button._.activeButton = null;
-									} );
-
-								eventInfo.data.buttonHandlerRegistered = true;
-							}
-
-							this.getElement().getFirst().unselectable();
-						}, this );
+							CKEDITOR.document.on( 'mouseup', function( evt )
+								{
+									var target = evt.data.getTarget(),
+										activeButton = CKEDITOR.ui.dialog.button._.activeButton;
+
+									// If there's no active button, bail out.
+									if ( !activeButton )
+										return;
+
+									// Fire the click event - but only if the
+									// active button is the same as target.
+									if ( activeButton[1].equals( target.getAscendant( 'a' ) ) )
+										activeButton[0].fire( 'click', { dialog : activeButton[0].getDialog() } );
+
+									// Clear active button flag.
+									CKEDITOR.ui.dialog.button._.activeButton = null;
+								} );
+
+							eventInfo.data.buttonHandlerRegistered = true;
+						}
+
+						this.getElement().getFirst().unselectable();
+					}, this );
 
 				var outerDefinition = CKEDITOR.tools.extend( {}, elementDefinition );
 				delete outerDefinition.style;
 
-				CKEDITOR.ui.dialog.uiElement.call( this, dialog, outerDefinition, htmlList, 'a', { display : 'block', outline : 'none' },
-						{ href : 'javascript:void(0);', title : elementDefinition.label, hidefocus : 'true' },
-						innerHTML );
+				CKEDITOR.ui.dialog.uiElement.call(
+					this, 
+					dialog, 
+					outerDefinition, 
+					htmlList, 
+					'a', 
+					null,
+					{
+						style : elementDefinition.style,
+						href : 'javascript:void(0);', 
+						title : elementDefinition.label, 
+						hidefocus : 'true'
+					},
+					'<span class="cke_dialog_ui_button">' + 
+						CKEDITOR.tools.htmlEncode( elementDefinition.label ) + 
+					'</span>' );
 			},
 
Index: /CKEditor/trunk/_source/plugins/find/dialogs/find.js
===================================================================
--- /CKEditor/trunk/_source/plugins/find/dialogs/find.js	(revision 3275)
+++ /CKEditor/trunk/_source/plugins/find/dialogs/find.js	(revision 3276)
@@ -555,6 +555,6 @@
 			title : editor.lang.findAndReplace.title,
 			resizable : CKEDITOR.DIALOG_RESIZE_NONE,
-			minWidth : 400,
-			minHeight : 255,
+			minWidth : 350,
+			minHeight : 165,
 			buttons : [ CKEDITOR.dialog.cancelButton ],		//Cancel button only.
 			contents : [
Index: /CKEditor/trunk/_source/plugins/flash/dialogs/flash.js
===================================================================
--- /CKEditor/trunk/_source/plugins/flash/dialogs/flash.js	(revision 3275)
+++ /CKEditor/trunk/_source/plugins/flash/dialogs/flash.js	(revision 3276)
@@ -180,6 +180,6 @@
 		return {
 			title : editor.lang.flash.title,
-			minWidth : 450,
-			minHeight : 400,
+			minWidth : 400,
+			minHeight : 310,
 			onLoad : function()
 			{
Index: /CKEditor/trunk/_source/plugins/forms/dialogs/button.js
===================================================================
--- /CKEditor/trunk/_source/plugins/forms/dialogs/button.js	(revision 3275)
+++ /CKEditor/trunk/_source/plugins/forms/dialogs/button.js	(revision 3276)
@@ -7,6 +7,6 @@
 	return {
 		title : editor.lang.button.title,
-		minWidth : 400,
-		minHeight : 230,
+		minWidth : 350,
+		minHeight : 140,
 		onShow : function()
 		{
Index: /CKEditor/trunk/_source/plugins/forms/dialogs/checkbox.js
===================================================================
--- /CKEditor/trunk/_source/plugins/forms/dialogs/checkbox.js	(revision 3275)
+++ /CKEditor/trunk/_source/plugins/forms/dialogs/checkbox.js	(revision 3276)
@@ -7,6 +7,6 @@
 	return {
 		title : editor.lang.checkboxAndRadio.checkboxTitle,
-		minWidth : 400,
-		minHeight : 230,
+		minWidth : 350,
+		minHeight : 140,
 		onShow : function()
 		{
Index: /CKEditor/trunk/_source/plugins/forms/dialogs/form.js
===================================================================
--- /CKEditor/trunk/_source/plugins/forms/dialogs/form.js	(revision 3275)
+++ /CKEditor/trunk/_source/plugins/forms/dialogs/form.js	(revision 3276)
@@ -7,6 +7,6 @@
 	return {
 		title : editor.lang.form.title,
-		minWidth : 400,
-		minHeight : 270,
+		minWidth : 350,
+		minHeight : 190,
 		onShow : function()
 		{
Index: /CKEditor/trunk/_source/plugins/forms/dialogs/hiddenfield.js
===================================================================
--- /CKEditor/trunk/_source/plugins/forms/dialogs/hiddenfield.js	(revision 3275)
+++ /CKEditor/trunk/_source/plugins/forms/dialogs/hiddenfield.js	(revision 3276)
@@ -7,6 +7,6 @@
 	return {
 		title : editor.lang.hidden.title,
-		minWidth : 400,
-		minHeight : 200,
+		minWidth : 350,
+		minHeight : 110,
 		onShow : function()
 		{
Index: /CKEditor/trunk/_source/plugins/forms/dialogs/radio.js
===================================================================
--- /CKEditor/trunk/_source/plugins/forms/dialogs/radio.js	(revision 3275)
+++ /CKEditor/trunk/_source/plugins/forms/dialogs/radio.js	(revision 3276)
@@ -7,6 +7,6 @@
 	return {
 		title : editor.lang.checkboxAndRadio.radioTitle,
-		minWidth : 400,
-		minHeight : 200,
+		minWidth : 350,
+		minHeight : 130,
 		onShow : function()
 		{
Index: /CKEditor/trunk/_source/plugins/forms/dialogs/select.js
===================================================================
--- /CKEditor/trunk/_source/plugins/forms/dialogs/select.js	(revision 3275)
+++ /CKEditor/trunk/_source/plugins/forms/dialogs/select.js	(revision 3276)
@@ -131,6 +131,6 @@
 	return {
 		title : editor.lang.select.title,
-		minWidth : 400,
-		minHeight : 370,
+		minWidth : 375,
+		minHeight : 270,
 		onShow : function()
 		{
Index: /CKEditor/trunk/_source/plugins/forms/dialogs/textarea.js
===================================================================
--- /CKEditor/trunk/_source/plugins/forms/dialogs/textarea.js	(revision 3275)
+++ /CKEditor/trunk/_source/plugins/forms/dialogs/textarea.js	(revision 3276)
@@ -7,6 +7,6 @@
 	return {
 		title : editor.lang.textarea.title,
-		minWidth : 400,
-		minHeight : 230,
+		minWidth : 350,
+		minHeight : 140,
 		onShow : function()
 		{
Index: /CKEditor/trunk/_source/plugins/forms/dialogs/textfield.js
===================================================================
--- /CKEditor/trunk/_source/plugins/forms/dialogs/textfield.js	(revision 3275)
+++ /CKEditor/trunk/_source/plugins/forms/dialogs/textfield.js	(revision 3276)
@@ -7,6 +7,6 @@
 	return {
 		title : editor.lang.textfield.title,
-		minWidth : 400,
-		minHeight : 230,
+		minWidth : 350,
+		minHeight : 140,
 		onShow : function()
 		{
Index: /CKEditor/trunk/_source/plugins/image/dialogs/image.js
===================================================================
--- /CKEditor/trunk/_source/plugins/image/dialogs/image.js	(revision 3275)
+++ /CKEditor/trunk/_source/plugins/image/dialogs/image.js	(revision 3276)
@@ -187,6 +187,6 @@
 		return {
 			title : ( dialogType == 'image' ) ? editor.lang.image.title : editor.lang.image.titleButton,
-			minWidth : 450,
-			minHeight : 400,
+			minWidth : 420,
+			minHeight : 310,
 			onShow : function()
 			{
Index: /CKEditor/trunk/_source/plugins/link/dialogs/anchor.js
===================================================================
--- /CKEditor/trunk/_source/plugins/link/dialogs/anchor.js	(revision 3275)
+++ /CKEditor/trunk/_source/plugins/link/dialogs/anchor.js	(revision 3276)
@@ -22,6 +22,6 @@
 	return {
 		title : editor.lang.anchor.title,
-		minWidth : 350,
-		minHeight : 150,
+		minWidth : 300,
+		minHeight : 60,
 		onOk : function()
 		{
Index: /CKEditor/trunk/_source/plugins/link/dialogs/link.js
===================================================================
--- /CKEditor/trunk/_source/plugins/link/dialogs/link.js	(revision 3275)
+++ /CKEditor/trunk/_source/plugins/link/dialogs/link.js	(revision 3276)
@@ -240,6 +240,6 @@
 	return {
 		title : editor.lang.link.title,
-		minWidth : 400,
-		minHeight : 320,
+		minWidth : 350,
+		minHeight : 230,
 		contents : [
 			{
Index: /CKEditor/trunk/_source/plugins/pastefromword/dialogs/pastefromword.js
===================================================================
--- /CKEditor/trunk/_source/plugins/pastefromword/dialogs/pastefromword.js	(revision 3275)
+++ /CKEditor/trunk/_source/plugins/pastefromword/dialogs/pastefromword.js	(revision 3276)
@@ -8,6 +8,6 @@
 	return {
 		title : editor.lang.pastefromword.title,
-		minWidth : 400,
-		minHeight : 340,
+		minWidth : 350,
+		minHeight : 250,
 		htmlToLoad : '<!doctype html><script type="text/javascript">'
 				+ 'window.onload = function()'
Index: /CKEditor/trunk/_source/plugins/pastetext/dialogs/pastetext.js
===================================================================
--- /CKEditor/trunk/_source/plugins/pastetext/dialogs/pastetext.js	(revision 3275)
+++ /CKEditor/trunk/_source/plugins/pastetext/dialogs/pastetext.js	(revision 3276)
@@ -13,6 +13,6 @@
 				title : editor.lang.pasteText.title,
 
-				minWidth : 400,
-				minHeight : 330,
+				minWidth : 350,
+				minHeight : 240,
 
 				onShow : function()
Index: /CKEditor/trunk/_source/plugins/smiley/dialogs/smiley.js
===================================================================
--- /CKEditor/trunk/_source/plugins/smiley/dialogs/smiley.js	(revision 3275)
+++ /CKEditor/trunk/_source/plugins/smiley/dialogs/smiley.js	(revision 3276)
@@ -80,6 +80,6 @@
 	return {
 		title : editor.lang.smiley.title,
-		minWidth : 320,
-		minHeight : 210,
+		minWidth : 270,
+		minHeight : 120,
 		contents : [
 			{
@@ -88,4 +88,5 @@
 				title : '',
 				expand : true,
+				padding : 0,
 				elements : [
 						smileySelector
Index: /CKEditor/trunk/_source/plugins/specialchar/dialogs/specialchar.js
===================================================================
--- /CKEditor/trunk/_source/plugins/specialchar/dialogs/specialchar.js	(revision 3275)
+++ /CKEditor/trunk/_source/plugins/specialchar/dialogs/specialchar.js	(revision 3276)
@@ -8,6 +8,6 @@
 	return {
 		title : editor.lang.specialChar.title,
-		minWidth : 450,
-		minHeight : 350,
+		minWidth : 420,
+		minHeight : 270,
 		buttons : [ CKEDITOR.dialog.cancelButton ],
 		charColumns : 17,
@@ -83,4 +83,5 @@
 				label : editor.lang.common.generalTab,
 				title : editor.lang.common.generalTab,
+				padding : 0,
 				align : top,
 				elements : [
Index: /CKEditor/trunk/_source/plugins/table/dialogs/table.js
===================================================================
--- /CKEditor/trunk/_source/plugins/table/dialogs/table.js	(revision 3275)
+++ /CKEditor/trunk/_source/plugins/table/dialogs/table.js	(revision 3276)
@@ -85,6 +85,6 @@
 		return {
 			title : editor.lang.table.title,
-			minWidth : 480,
-			minHeight : 260,
+			minWidth : 430,
+			minHeight : 180,
 			onShow : function()
 			{
Index: /CKEditor/trunk/_source/plugins/templates/dialogs/templates.js
===================================================================
--- /CKEditor/trunk/_source/plugins/templates/dialogs/templates.js	(revision 3275)
+++ /CKEditor/trunk/_source/plugins/templates/dialogs/templates.js	(revision 3276)
@@ -109,6 +109,6 @@
 				title :editor.lang.templates.title,
 
-				minWidth :450,
-				minHeight :400,
+				minWidth : 400,
+				minHeight : 310,
 
 				contents :
Index: /CKEditor/trunk/_source/plugins/wsc/dialogs/wsc.js
===================================================================
--- /CKEditor/trunk/_source/plugins/wsc/dialogs/wsc.js	(revision 3275)
+++ /CKEditor/trunk/_source/plugins/wsc/dialogs/wsc.js	(revision 3276)
@@ -119,6 +119,6 @@
 	return {
 		title : editor.lang.spellCheck.title,
-		minWidth : 540,
-		minHeight : 480,
+		minWidth : 490,
+		minHeight : 390,
 		buttons : [ CKEDITOR.dialog.cancelButton ],
 		onShow : function()
Index: /CKEditor/trunk/_source/skins/default/dialog.css
===================================================================
--- /CKEditor/trunk/_source/skins/default/dialog.css	(revision 3275)
+++ /CKEditor/trunk/_source/skins/default/dialog.css	(revision 3276)
@@ -10,250 +10,160 @@
 }
 
-.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
-{
-	clear: left;
+.cke_skin_default .cke_dialog_body
+{
+	margin-left: 16px;
+	margin-right: 16px;
+	margin-top: 2px;
+	margin-bottom: 20px;
+	position: relative;
+	z-index: 1;
 }
 
 .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
-{
-	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_tc,
 .cke_skin_default .cke_dialog_bl,
-.cke_skin_default .cke_dialog_b,
-.cke_skin_default .cke_dialog_br
+.cke_skin_default .cke_dialog_br,
+.cke_skin_default .cke_dialog_bc
 {
 	background-image: url(images/sprites.png);
+	background-repeat: no-repeat;
+	position: absolute;
+
 	/* 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_tl
+{
+	background-position: -16px -16px;
+	height: 16px;
+	width: 16px;
+	top: 0;
+	left: 0;
+}
+
+.cke_skin_default .cke_dialog_tr
+{
+	background-position: -16px -76px;
+	height: 16px;
+	width: 16px;
+	top: 0;
+	right: 0;
+}
+
+.cke_skin_default .cke_dialog_tc
+{
+	background-position: 0 -136px;
+	background-repeat: repeat-x;
+	height: 16px;
+	top: 0;
+	left: 16px;
+	right: 16px;
+}
+
+.cke_skin_default .cke_dialog_bl
+{
+	background-position: -16px -196px;
+	height: 51px;
+	width: 30px;
+	bottom: 0;
+	left: 0;
+}
+
+.cke_skin_default .cke_dialog_br
+{
+	background-position: -16px -263px;
+	height: 51px;
+	width: 30px;
+	bottom: 0;
+	right: 0;
+}
+
+.cke_skin_default .cke_dialog_bc
+{
+	background-position: 0 -330px;
+	background-repeat: repeat-x;
+	height: 51px;
+	bottom: 0;
+	left: 30px;
+	right: 30px;
+}
+
+.cke_skin_default .cke_dialog_ml,
+.cke_skin_default .cke_dialog_mr
 {
 	background-image: url(images/dialog.sides.png);
+	background-repeat: repeat-y;
+	position: absolute;
+	width: 16px;
+	top: 16px;
+	bottom: 51px;
+
 	/* IE6 does not support full color transparent PNG. */
 	_background-image: url(images/dialog.sides.gif);
-	background-repeat: repeat-y;
-}
-
-.cke_skin_default.cke_rtl .cke_dialog_l,
-.cke_skin_default.cke_rtl .cke_dialog_r
-{
-	background-image: url(images/dialog.sides.rtl.png);
-	_background-image: url(images/dialog.sides.gif);
-}
-
-.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
-{
-	width: 30px;
-}
-
-.cke_skin_default .cke_dialog_tl
-{
-	background-position: -16px -16px;
-}
-
-.cke_skin_default.cke_rtl .cke_dialog_tl
-{
-	background-position: -16px -397px;
-}
-
-.cke_skin_default .cke_dialog_tr
-{
-	background-position: -16px -76px;
-}
-
-.cke_skin_default.cke_rtl .cke_dialog_tr
-{
-	background-position: -16px -457px;
-}
-
-.cke_skin_default .cke_dialog_t
-{
-	background-position: 0px -136px;
-	background-repeat: repeat-x;
-}
-
-.cke_skin_default .cke_dialog_l
-{
-	background-position: 0px 0px;
-}
-
-.cke_skin_default .cke_dialog_r
-{
-	background-position: -16px 0px;
-}
-
-.cke_skin_default .cke_dialog_bl
-{
-	background-position: -16px -196px;
-}
-
-.cke_skin_default.cke_rtl .cke_dialog_bl
-{
-	background-position: -16px -517px;
-}
-
-.cke_skin_default .cke_dialog_b
-{
-	background-position: 0px -330px;
-	background-repeat: repeat-x;
-}
-
-.cke_skin_default .cke_dialog_br
-{
-	background-position: -16px -263px;
-}
-
-.cke_skin_default.cke_rtl .cke_dialog_br
-{
-	background-position: -16px -584px;
+}
+
+.cke_skin_default .cke_dialog_ml
+{
+	background-position: 0 0;
+	left: 0;
+}
+
+.cke_skin_default .cke_dialog_mr
+{
+	background-position: -16px 0;
+	right: 0;
+}
+
+.cke_skin_default .cke_browser_iequirks .cke_dialog_ml,
+.cke_skin_default .cke_browser_iequirks .cke_dialog_mr
+{
+	margin-top: 3px;
 }
 
 .cke_skin_default .cke_dialog_title
 {
-	position: absolute;
-	top: 2px;
-	left: 16px;
-	height: 23px;
-	right: 16px;
 	font-weight: bold;
 	font-size: 14pt;
 	color: #737357;
 	background-color: #e3e3c7;
-	padding: 3px 10px 3px 10px;
-	overflow: hidden;
+	padding: 3px 10px 26px 10px;
 	cursor: move;
-}
-
-.cke_skin_default .single_page .cke_dialog_tabs
-{
-	display: none;
-}
+	position: relative;
+}
+
+.cke_skin_default .cke_dialog_contents
+{
+	background-color: #f1f1e3;
+	border: #d5d59d 1px solid;
+	overflow: auto;
+	padding: 5px 10px;
+}
+
+.cke_skin_default .cke_dialog_footer
+{
+	background-color: #e3e3c7;
+	text-align: right;
+}
+
+/* tabs */
 
 .cke_skin_default .cke_dialog_tabs
 {
+	height: 23px;
+	background-color: #e3e3c7;
+	float:left;
+	margin-left:10px;
+	margin-top:-23px;
 	position: absolute;
-	top: 31px;
-	left: 16px;
-	height: 23px;
-	right: 16px;
-	background-color: #e3e3c7;
-	z-index: 1;
-	border-collapse: separate;
-}
-
-.cke_skin_default.cke_browser_ie .cke_dialog_tabs
-{
-	border-collapse: collapse;
-}
-
-.cke_skin_default .cke_dialog_tabs .head_filler
-{
-	padding-left: 10px;
-	border-bottom: 1px solid #D5D59D;
-	line-height: 50%;
-}
-
-.cke_skin_default .cke_dialog_tabs .tail_filler
-{
-	width: 100%;
-	border-bottom: 1px solid #D5D59D;
-	line-height: 50%;
-}
-
-.cke_skin_default .cke_dialog_contents
-{
-	position: absolute;
-	background-color: #f1f1e3;
-	top: 54px;
-	left: 16px;
-	bottom: 51px;
-	right: 16px;
-	border: #d5d59d 1px solid;
-	border-top: none;
-}
-
-.cke_skin_default .single_page .cke_dialog_contents
-{
-	top: 31px;
-	border-top: #d5d59d 1px solid;
-}
-
-.cke_skin_default .cke_dialog_footer
-{
-	position: absolute;
-	background-color: #e3e3c7;
-	height: 31px;
-	left: 16px;
-	right: 16px;
-	bottom: 20px;
-}
-
-.cke_skin_default .cke_dialog_page_contents
-{
-	position: absolute;
-	top: 0px;
-	bottom: 0px;
-	left: 0px;
-	right: 0px;
-	padding: 5px 10px;
-}
-
-.cke_skin_default .cke_dialog_tab_center
-{
-	cursor: pointer;
-}
-
-.cke_skin_default .cke_dialog_tab
-{
-	border-bottom: 1px solid #D5D59D;
-}
-
-.cke_skin_default .cke_dialog_tab_left,
-.cke_skin_default .cke_dialog_tab_right
-{
-	cursor: pointer;
-}
-
-.cke_skin_default .cke_dialog_tab_center
+	z-index: 2;
+}
+
+.cke_skin_default a.cke_dialog_tab,
+.cke_skin_default a:link.cke_dialog_tab,
+.cke_skin_default a:active.cke_dialog_tab,
+.cke_skin_default a:hover.cke_dialog_tab,
+.cke_skin_default a:visited.cke_dialog_tab
 {
 	color: #737357;
@@ -261,35 +171,38 @@
 	border-right: 1px solid #d5d59d;
 	border-top: 1px solid #d5d59d;
-	height: 15px;
+	height: 14px;
 	padding: 4px 5px;
-}
-
-.cke_skin_default.cke_browser_webkit.cke_mode_quirks .cke_dialog_tab_center
-{
-	padding: 4px 5px 5px 5px;
-}
-
-.cke_skin_default.cke_browser_webkit.cke_mode_standards .cke_dialog_tab_center
-{
-	padding: 4px 5px 2px 5px;
-}
-
-
-.cke_skin_default .cke_dialog_tab_selected
-{
-	border-bottom: 1px solid #F1F1E3;
-}
-
-.cke_skin_default .cke_dialog_tab_selected .cke_dialog_tab_left,
-.cke_skin_default .cke_dialog_tab_selected .cke_dialog_tab_center,
-.cke_skin_default .cke_dialog_tab_selected .cke_dialog_tab_right
-{
-	cursor: default;
-}
-
-.cke_skin_default .cke_dialog_tab_selected .cke_dialog_tab_center
-{
+	display: block;
+	float: left;
+	cursor: pointer;
+}
+
+.cke_skin_default a:hover.cke_dialog_tab
+{
+	background-color: #f1f1e3;
+}
+
+.cke_skin_default a.cke_dialog_tab_selected,
+.cke_skin_default a:link.cke_dialog_tab_selected,
+.cke_skin_default a:active.cke_dialog_tab_selected,
+.cke_skin_default a:hover.cke_dialog_tab_selected,
+.cke_skin_default a:visited.cke_dialog_tab_selected
+{
+	border-bottom: 1px solid #f1f1e3;
 	background-color: #f1f1e3;
 	font-weight: bold;
+	cursor: default;
+}
+
+/* single_page */
+
+.cke_skin_default .cke_single_page .cke_dialog_tabs
+{
+	display: none;
+}
+
+.cke_skin_default .cke_single_page .cke_dialog_title
+{
+	padding-bottom: 3px;
 }
 
@@ -376,34 +289,48 @@
 }
 
-.cke_skin_default .cke_dialog_ui_button table
+/* button */
+
+.cke_skin_default a.cke_dialog_ui_button
+{
+	border-collapse: separate;
+}
+
+.cke_skin_default span.cke_dialog_ui_button
 {
 	border: #737357 1px solid;
-}
-
-.cke_skin_default .cke_dialog_ui_button.disabled table
-{
-	border: #898980 1px solid;
-}
-
-.cke_skin_default .cke_dialog_ui_button_txt
-{
 	padding: 2px 10px;
 	text-align: center;
 	color: #3b3b1f;
 	background-color: #c7c78f;
-}
-
-.cke_skin_default .cke_dialog_ui_button.disabled .cke_dialog_ui_button_txt
-{
+	display: inline-block;
+}
+
+.cke_skin_default a.cke_dialog_ui_button span.cke_disabled
+{
+	border: #898980 1px solid;
 	color: #5e5e55;
 	background-color: #c5c5b3;
 }
 
-.cke_skin_default a:focus.cke_dialog_ui_button .cke_dialog_ui_button_txt,
-.cke_skin_default a:active.cke_dialog_ui_button .cke_dialog_ui_button_txt
+.cke_skin_default a:focus span.cke_dialog_ui_button,
+.cke_skin_default a:active span.cke_dialog_ui_button
 {
 	background-color: #e3e3c7;
 }
 
+.cke_skin_default .cke_dialog_footer_buttons
+{
+	display: inline-table;
+	margin-right: 12px;
+	width: auto;
+	position: relative;
+}
+
+.cke_skin_default .cke_dialog_footer_buttons span.cke_dialog_ui_button
+{
+	width: 60px;
+	margin: 7px 0;
+}
+
 .cke_skin_default strong
 {
@@ -411,23 +338,9 @@
 }
 
-.cke_skin_default .cke_dialog_footer_buttons
-{
-	width: auto;
-	position: absolute;
-	right: 10px;
-	top: 7px;
-}
-
-.cke_skin_default.cke_rtl .cke_dialog_footer_buttons
-{
-	right: auto;
-	left: 10px;
-}
+/* close_button */
 
 .cke_skin_default .cke_dialog_close_button
 {
 	background-image: url(images/sprites.png);
-	/* IE6 does not support full color transparent PNG. */
-	_background-image: url(images/sprites.gif);
 	background-repeat: no-repeat;
 	background-position: -16px -651px;
@@ -438,4 +351,9 @@
 	right: 10px;
 	top: 5px;
+
+	_right: 22px;
+
+	/* IE6 does not support full color transparent PNG. */
+	_background-image: url(images/sprites.gif);
 }
 
@@ -451,87 +369,4 @@
 }
 
-.cke_skin_default .cke_dialog_tl_resize,
-.cke_skin_default .cke_dialog_t_resize,
-.cke_skin_default .cke_dialog_tr_resize,
-.cke_skin_default .cke_dialog_bl_resize,
-.cke_skin_default .cke_dialog_b_resize,
-.cke_skin_default .cke_dialog_br_resize
-{
-	position: absolute;
-	height: 5px;
-	overflow: hidden;
-	background-color: transparent;
-}
-
-.cke_skin_default .cke_dialog_l_resize,
-.cke_skin_default .cke_dialog_r_resize
-{
-	position: absolute;
-	width: 5px;
-	overflow: hidden;
-	background-color: transparent;
-}
-
-.cke_skin_default .cke_dialog_tl_resize
-{
-	width: 5px;
-	left: 11px;
-	top: -3px;
-	cursor: nw-resize;
-}
-
-.cke_skin_default .cke_dialog_t_resize
-{
-	left: 16px;
-	top: -3px;
-	cursor: n-resize;
-}
-
-.cke_skin_default .cke_dialog_tr_resize
-{
-	width: 5px;
-	right: 14px;
-	top: -3px;
-	cursor: ne-resize;
-}
-
-.cke_skin_default .cke_dialog_l_resize
-{
-	top: 2px;
-	left: 11px;
-	cursor: w-resize;
-}
-
-.cke_skin_default .cke_dialog_r_resize
-{
-	top: 2px;
-	right: 14px;
-	cursor: e-resize;
-}
-
-.cke_skin_default .cke_dialog_bl_resize
-{
-	bottom: 18px;
-	left: 11px;
-	width: 5px;
-	cursor: sw-resize;
-}
-
-.cke_skin_default .cke_dialog_b_resize
-{
-	bottom: 18px;
-	left: 16px;
-	cursor: s-resize;
-}
-
-.cke_skin_default .cke_dialog_br_resize
-{
-	bottom: 18px;
-	right: 14px;
-	width: 8px;
-	height: 8px;
-	cursor: se-resize;
-}
-
 .cke_skin_default .cke_dialog_ui_input_select
 {
@@ -549,40 +384,4 @@
 {
 	height: 25px;
-}
-
-/*
- * Safari and Gecko on Mac actually distinguish between single-sided and
- * double-sided resize cursors. The double-sided resize cursors should be used.
- */
-.cke_skin_default.cke_browser_gecko .cke_dialog_tl_resize,
-.cke_skin_default.cke_browser_webkit .cke_dialog_tl_resize,
-.cke_skin_default.cke_browser_gecko .cke_dialog_br_resize,
-.cke_skin_default.cke_browser_webkit .cke_dialog_br_resize
-{
-	cursor: nwse-resize;
-}
-
-.cke_skin_default.cke_browser_gecko .cke_dialog_tr_resize,
-.cke_skin_default.cke_browser_webkit .cke_dialog_tr_resize,
-.cke_skin_default.cke_browser_gecko .cke_dialog_bl_resize,
-.cke_skin_default.cke_browser_webkit .cke_dialog_bl_resize
-{
-	cursor: nesw-resize;
-}
-
-.cke_skin_default.cke_browser_gecko .cke_dialog_l_resize,
-.cke_skin_default.cke_browser_webkit .cke_dialog_l_resize,
-.cke_skin_default.cke_browser_gecko .cke_dialog_r_resize,
-.cke_skin_default.cke_browser_webkit .cke_dialog_r_resize
-{
-	cursor: ew-resize;
-}
-
-.cke_skin_default.cke_browser_gecko .cke_dialog_t_resize,
-.cke_skin_default.cke_browser_webkit .cke_dialog_t_resize,
-.cke_skin_default.cke_browser_gecko .cke_dialog_b_resize,
-.cke_skin_default.cke_browser_webkit .cke_dialog_b_resize
-{
-	cursor: ns-resize;
 }
 
Index: /CKEditor/trunk/_source/skins/default/skin.js
===================================================================
--- /CKEditor/trunk/_source/skins/default/skin.js	(revision 3275)
+++ /CKEditor/trunk/_source/skins/default/skin.js	(revision 3276)
@@ -7,105 +7,67 @@
 {
 	var preload = [];
-	var dialogJs = [];
 
-	if ( CKEDITOR.env.ie && CKEDITOR.env.version <= 6 )
+	if ( CKEDITOR.env.ie && CKEDITOR.env.version < 7 )
 	{
 		// For IE6, we need to preload some images, otherwhise they will be
 		// downloaded several times (CSS background bug).
 		preload.push( 'icons.gif', 'images/sprites.gif', 'images/dialog.sides.gif' );
-
-		// The dialog must be fixed by code in IE6, as it doesn't support
-		// several CSS features (absolute positioning).
-		// dialogJs.push( 'dialog_ie6.js' );
 	}
 
 	return {
-		preload : preload,
-		editor : { css : [ 'editor.css' ] },
-		dialog : { css : [ 'dialog.css' ],  js : dialogJs },
-		templates : { css : [ 'templates.css' ] }
+		preload		: preload,
+		editor		: { css : [ 'editor.css' ] },
+		dialog		: { css : [ 'dialog.css' ] },
+		templates	: { css : [ 'templates.css' ] },
+		margins		: [ 0, 14, 18, 14 ]
 	};
 })() );
 
-(function()
+if ( CKEDITOR.dialog )
 {
-	// Define the function for resizing dialog parts at load to speed up
-	// the actual resize operation.
-	var skinName = 'default',
-		setSize = function( dialog, partName, width, height )
+	CKEDITOR.dialog.on( 'resize', function( evt )
 		{
-			var element = partName ? dialog.parts[partName] : dialog._.element.getFirst();
-			if ( width )
-				element.setStyle( 'width', width + 'px' );
-			if ( height )
-				element.setStyle( 'height', height + 'px' );
-		};
+			var data = evt.data,
+				width = data.width,
+				height = data.height,
+				dialog = data.dialog,
+				standardsMode = !CKEDITOR.env.quirk;
 
-	if ( CKEDITOR.dialog )
-	{
-		CKEDITOR.dialog.setMargins( 0, 14, 18, 14 );
+			if ( data.skin != 'default' )
+				return;
 
-		CKEDITOR.dialog.on( 'resize', function( evt )
-			{
-				var data = evt.data,
-					width = data.width,
-					height = data.height,
-					dialog = data.dialog,
-					standardsMode = ( CKEDITOR.document.$.compatMode == 'CSS1Compat' );
-				if ( data.skin != skinName )
-					return;
+			dialog.parts.contents.setStyles(
+				{
+					width : width + 'px',
+					height : height + 'px'
+				});
 
-				// Dialog parts dimensions.
-				//  16x16  |  ?x16  |  16x16
-				//  16x?   |  ?x?   |  16x?
-				//  30x51  |  ?x51  |  30x51
-				setSize( dialog, 't', width - 32, 16 );
-				setSize( dialog, 't_resize', width - 32, null );
-				setSize( dialog, 'l', 16, height - 67 );
-				setSize( dialog, 'l_resize', null, height - 22 );
-				setSize( dialog, 'c', width - 32, height - 67 );
-				setSize( dialog, 'r', 16, height - 67 );
-				setSize( dialog, 'r_resize', null, height - 22 );
-				setSize( dialog, 'b', width - 60, 51 );
-				setSize( dialog, 'b_resize', width - 32, null );
-				setSize( dialog, 'tabs_table', width - 32, null );
+			if ( !CKEDITOR.env.ie )
+				return;
 
-				/*
-				 * Although the following fix seems to be for IE6 only, it's also for IE7.
-				 * While IE7 can render DIV nodes with left: and right: defined, it cannot
-				 * put 100% height TABLES correctly inside those DIVs. Unless the width is
-				 * set as well.
-				 */
-				if ( CKEDITOR.env.ie )
+			// Fix the size of the elements which have flexible lengths.
+			setTimeout( function()
 				{
-					var contentWidth = width - 34,
-						contentHeight = dialog.getPageCount() > 1 ? height - 106 : height - 84,
-						contentsLength = dialog.parts.contents.getChildCount();
+					var content = dialog.parts.contents,
+						body = content.getParent(),
+						innerDialog = body.getParent();
 
-					if ( !standardsMode )
-					{
-						contentWidth += 2;
-						contentHeight += 2;
-						dialog.parts.tabs.setStyle( 'top', '33px' );
-					}
+					// tc
+					el = innerDialog.getChild( 2 );
+					el.setStyle( 'width', ( body.$.offsetWidth ) + 'px' );
 
-					setSize( dialog, 'title', standardsMode ? width - 52 : width - 32, standardsMode ? null : 31 );
-					setSize( dialog, 'contents', contentWidth, contentHeight );
-					setSize( dialog, 'footer', width - 32);
+					// bc
+					el = innerDialog.getChild( 7 );
+					el.setStyle( 'width', ( body.$.offsetWidth - 28 ) + 'px' );
 
-					for ( var i = 0 ; i < contentsLength ; i++ )
-					{
-						var child = dialog.parts.contents.getChild( i );
-						if ( ( child instanceof CKEDITOR.dom.element ) && ( child.$.className || '' ).search( 'cke_dialog_page_contents' ) > -1 )
-							child.setStyles(
-								{
-									width : contentWidth - ( standardsMode ? 20 : 0 ) + 'px',
-									height : contentHeight - ( standardsMode ? 20 : 0 ) + 'px'
-								} );
-					}
-				}
+					// ml
+					el = innerDialog.getChild( 4 );
+					el.setStyle( 'height', ( body.$.offsetHeight - 31 - 14 ) + 'px' );
 
-				setSize( dialog, null, width, height );
-			});
-	}
-})();
+					// mr
+					el = innerDialog.getChild( 5 );
+					el.setStyle( 'height', ( body.$.offsetHeight - 31 - 14 ) + 'px' );
+				}, 
+				0 );
+		});
+}
Index: /CKEditor/trunk/_source/themes/default/theme.js
===================================================================
--- /CKEditor/trunk/_source/themes/default/theme.js	(revision 3275)
+++ /CKEditor/trunk/_source/themes/default/theme.js	(revision 3276)
@@ -113,69 +113,53 @@
 
 			var element = CKEDITOR.dom.element.createFromHtml( [
-					'<div class="cke_skin_', editor.config.skin, ' ', browserCssClass, ' ',
-						CKEDITOR.document.$.compatMode == 'CSS1Compat' ? 'cke_mode_standards' : 'cke_mode_quirks',
+					'<div class="cke_skin_', editor.config.skin,
+						' ', browserCssClass,
+						' ', CKEDITOR.env.quirks ? 'cke_mode_quirks' : 'cke_mode_standards',
 						' cke_', editor.lang.dir,
 						'" dir="', editor.lang.dir, '">' +
-						'<div id="%#" class="cke_dialog" style="position:',
-							( CKEDITOR.env.ie6Compat ? 'absolute;' : 'fixed;' ), '">',
-							'<div>'+
-								'<div id="%tl_#" class="%tl">' +
-									'<div id="%tl_resize_#" class="%tl_resize"></div>' +
-								'</div>' +
-								'<div id="%t_#" class="%t">' +
-									'<div id="%t_resize_#" class="%t_resize"></div>' +
-								'</div>' +
-								'<div id="%tr_#" class="%tr">' +
-									'<div id="%tr_resize_#" class="%tr_resize"></div>' +
-								'</div>' +
+
+						'<div class="cke_dialog" style="position:absolute">' +
+							'<div class="%body">' +
+								'<div id="%title#" class="%title"></div>' +
+								'<div id="%close_button#" class="%close_button"></div>' +
+								'<div id="%tabs#" class="%tabs"></div>' +
+								'<div id="%contents#" class="%contents"></div>' +
+								'<div id="%footer#" class="%footer"></div>' +
 							'</div>' +
-							'<div>' +
-								'<div id="%l_#" class="%l">' +
-									'<div id="%l_resize_#" class="%l_resize"></div>' +
-								'</div>' +
-								'<div id="%c_#" class="%c">' +
-									'<div id="%title_#" class="%title">' +
-										'<div id="%close_button_#" class="%close_button"></div>' +
-									'</div>' +
-									'<table id="%tabs_#" class="%tabs" cellpadding="0" border="0" cellspacing="0"><tbody><tr>' +
-									'<td class="head_filler">&nbsp;</td>' +
-									'<td class="tail_filler">&nbsp;</td>' +
-									'</tr></tbody></table>' +
-									'<div id="%contents_#" class="%contents"></div>' +
-									'<div id="%footer_#" class="%footer"></div>' +
-								'</div>' +
-								'<div id="%r_#" class="%r">' +
-									'<div id="%r_resize_#" class="%r_resize"></div>' +
-								'</div>' +
-							'</div>' +
-							'<div>' +
-								'<div id="%bl_#" class="%bl">' +
-									'<div id="%bl_resize_#" class="%bl_resize"></div>' +
-								'</div>' +
-								'<div id="%b_#" class="%b">' +
-									'<div id="%b_resize_#" class="%b_resize"></div>' +
-								'</div>' +
-								'<div id="%br_#" class="%br">' +
-									'<div id="%br_resize_#" class="%br_resize"></div>' +
-								'</div>' +
-							'</div>' +
+							'<div id="%tl#" class="%tl"></div>' +
+							'<div id="%tc#" class="%tc"></div>' +
+							'<div id="%tr#" class="%tr"></div>' +
+							'<div id="%ml#" class="%ml"></div>' +
+							'<div id="%mr#" class="%mr"></div>' +
+							'<div id="%bl#" class="%bl"></div>' +
+							'<div id="%bc#" class="%bc"></div>' +
+							'<div id="%br#" class="%br"></div>' +
 						'</div>',
+
 						//Hide the container when loading skins, later restored by skin css.
 						( CKEDITOR.env.ie ? '' : '<style>.cke_dialog{visibility:hidden;}</style>' ),
+
 					'</div>'
 				].join( '' )
-					.replace( /#/g, baseIdNumber )
+					.replace( /#/g, '_' + baseIdNumber )
 					.replace( /%/g, 'cke_dialog_' ) );
 
+			var body = element.getChild( [ 0, 0 ] );
+
 			// Make the Title unselectable.
-			element.getChild( [0, 1, 1, 0] ).unselectable();
+			body.getChild( 0 ).unselectable();
+
 
 			return {
 				element : element,
-				titleId : 'cke_dialog_title_' + baseIdNumber,
-				contentsId : 'cke_dialog_contents_' + baseIdNumber,
-				footerId : 'cke_dialog_footer_' + baseIdNumber,
-				closeIds : [ 'cke_dialog_close_button_' + baseIdNumber ],
-				dragIds : [ 'cke_dialog_title_' + baseIdNumber, 'cke_dialog_tabs_' + baseIdNumber ]
+				parts :
+				{
+					dialog		: element.getChild( 0 ),
+					title		: body.getChild( 0 ),
+					close		: body.getChild( 1 ),
+					tabs		: body.getChild( 2 ),
+					contents	: body.getChild( 3 ),
+					footer		: body.getChild( 4 )
+				}
 			};
 		},
