Index: /CKEditor/branches/prototype/_source/core/skins.js
===================================================================
--- /CKEditor/branches/prototype/_source/core/skins.js	(revision 2608)
+++ /CKEditor/branches/prototype/_source/core/skins.js	(revision 2609)
@@ -76,5 +76,5 @@
 		// Call the callback immediately if already loaded.
 		if ( partIsLoaded )
-			callback();
+			callback && callback();
 		else
 		{
Index: /CKEditor/branches/prototype/_source/plugins/dialog/plugin.js
===================================================================
--- /CKEditor/branches/prototype/_source/plugins/dialog/plugin.js	(revision 2608)
+++ /CKEditor/branches/prototype/_source/plugins/dialog/plugin.js	(revision 2609)
@@ -102,5 +102,36 @@
 	var element = this._.element.getFirst(),
 		i, me = this;
-	this._.parts = {
+
+	/**
+	 * 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>bridge - the bridge between the active tab and the content page.</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],
@@ -127,6 +158,6 @@
 		'footer' : [1,1,4]
 	};
-	for ( i in this._.parts )
-		this._.parts[i] = element.getChild( this._.parts[i] );
+	for ( i in this.parts )
+		this.parts[i] = element.getChild( this.parts[i] );
 
 	// Initialize the tab and page map.
@@ -198,5 +229,5 @@
 			}, this, null, 0 );
 
-	this._.parts.close.on( 'click', function( evt )
+	this.parts.close.on( 'click', function( evt )
 			{
 				if ( this.fire( 'cancel', { hide : true } ).hide !== false )
@@ -208,5 +239,5 @@
 
 	// Insert the title.
-	( new CKEDITOR.dom.text( definition.title, CKEDITOR.document ) ).appendTo( this._.parts.title );
+	( new CKEDITOR.dom.text( definition.title, CKEDITOR.document ) ).appendTo( this.parts.title );
 
 	// Insert the tabs and contents.
@@ -215,5 +246,5 @@
 
 	var classRegex = /cke_dialog_tab(\s|$|_)/;
-	this._.parts['tabs'].on( 'click', function( evt )
+	this.parts['tabs'].on( 'click', function( evt )
 			{
 				var target = evt.data.getTarget(), firstNode = target, id, page;
@@ -239,5 +270,5 @@
 				children : definition.buttons
 			}, buttonsHtml ).getChild();
-	this._.parts.footer.setHtml( buttonsHtml.join( '' ) );
+	this.parts.footer.setHtml( buttonsHtml.join( '' ) );
 
 	for ( var i = 0 ; i < buttons.length ; i++ )
@@ -259,19 +290,4 @@
 	resize : (function()
 	{
-		// Define the function for resizing dialog parts at load to speed up
-		// the actual resize operation.
-		var setSize = function( dialog, partName, width, height )
-		{
-			var element = partName ? dialog._.parts[partName] : dialog._.element.getFirst();
-			if ( width )
-				element.setStyle( 'width', width + 'px' );
-			if ( height )
-				element.setStyle( 'height', height + 'px' );
-		};
-
-		// Dialog parts dimensions.
-		//  16x16  |  ?x16  |  16x16
-		//  16x?   |  ?x?   |  16x?
-		//  30x51  |  ?x51  |  30x51
 		return function( width, height )
 		{
@@ -279,15 +295,12 @@
 				return;
 
-			// TODO: Move these all to the skin.
-			setSize( this, 't', width - 32, 16 );
-			setSize( this, 't_resize', width - 32, null );
-			setSize( this, 'l', 16, height - 67 );
-			setSize( this, 'l_resize', null, height - 67 + 45 );
-			setSize( this, 'c', width - 32, height - 67 );
-			setSize( this, 'r', 16, height - 67 );
-			setSize( this, 'r_resize', null, height - 67 + 45 );
-			setSize( this, 'b', width - 60, 51 );
-			setSize( this, 'b_resize', width - 60 + 28, null );
-			setSize( this, null, width, height );
+			CKEDITOR.dialog.fire( 'resize',
+				{
+					dialog : this,
+					skin : this._.editor.config.skin,
+					width : width,
+					height : height
+				}, this._.editor );
+
 			this._.size = { width : width, height : height };
 		};
@@ -404,5 +417,5 @@
 			var parentElement = this._.parentDialog.getElement().getFirst();
 			parentElement.$.style.zIndex  -= Math.floor( this._.editor.config.basePopupZIndex / 2 );
-			CKEditor.dialog._.currentTop = this;
+			CKEDITOR.dialog._.currentTop = this;
 		}
 		
@@ -458,5 +471,5 @@
 						className : 'cke_dialog_page_contents',
 						children : contents.elements,
-						expand : true
+						expand : !!contents.expand 
 					}, pageHtml );
 
@@ -480,7 +493,7 @@
 		// 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.c.addClass( 'single_page' );
 		else
-			this._.parts.c.removeClass( 'single_page' );
+			this.parts.c.removeClass( 'single_page' );
 
 		// Take records for the tabs and elements created.
@@ -500,6 +513,6 @@
 		// Attach the DOM nodes.
 		tab.getFirst().unselectable();
-		page.appendTo( this._.parts.contents );
-		tab.appendTo( this._.parts.tabs );
+		page.appendTo( this.parts.contents );
+		tab.appendTo( this.parts.tabs );
 		tab.setAttribute( 'id', contents.id + '_' + CKEDITOR.tools.getNextNumber() );
 		page.setAttribute( 'name', contents.id );
@@ -514,5 +527,5 @@
 	selectPage : function( id )
 	{
-		var bridge = this._.parts.bridge;
+		var bridge = this.parts.bridge;
 
 		// Hide the non-selected tabs and pages.
@@ -646,4 +659,13 @@
 	{
 		return this._.buttons[ id ].enable();
+	},
+
+	/**
+	 * Gets the number of pages in the dialog.
+	 * @returns {Number} Page count.
+	 */
+	getPageCount : function()
+	{
+		return this._.pageCount;
 	}
 };
@@ -895,5 +917,5 @@
 			};
 
-		dialog._.parts.title.on( 'mousedown', function( evt )
+		dialog.parts.title.on( 'mousedown', function( evt )
 				{
 					lastCoords = { x : evt.data.$.screenX, y : evt.data.$.screenY };
@@ -1035,5 +1057,5 @@
 		for ( var i = 0 ; i < parts.length ; i++ )
 		{
-			var element = dialog._.parts[ parts[i] + '_resize' ];
+			var element = dialog.parts[ parts[i] + '_resize' ];
 			if ( resizable == CKEDITOR.DIALOG_RESIZE_NONE || 
 					resizable == CKEDITOR.DIALOG_RESIZE_HEIGHT && widthTest.test( parts[i] ) ||
@@ -1107,4 +1129,6 @@
 	}
 };
+
+CKEDITOR.event.implementOn( CKEDITOR.dialog );
 
 CKEDITOR.dialog._.definitionObject.prototype = 
Index: /CKEditor/branches/prototype/_source/plugins/dialogui/plugin.js
===================================================================
--- /CKEditor/branches/prototype/_source/plugins/dialogui/plugin.js	(revision 2608)
+++ /CKEditor/branches/prototype/_source/plugins/dialogui/plugin.js	(revision 2609)
@@ -353,5 +353,5 @@
 			{
 				var myHtmlRe = /^\s*<[\w:]+\s+([^>]*)?>/,
-					theirHtmlRe = /^(\s*<[\w:]+\s+(?:[^>]*)?)((?:.|\r|\n)+)$/,
+					theirHtmlRe = /^(\s*<[\w:]+(?:\s+[^>]*)?)((?:.|\r|\n)+)$/,
 					emptyTagRe = /\/$/;
 				return function( dialog, elementDefinition, htmlList )
@@ -377,5 +377,5 @@
 					}
 
-					htmlList.push( [ theirMatch[1], myMatch[1] || '', theirMatch[2] ].join( '' ) );
+					htmlList.push( [ theirMatch[1], ' ', myMatch[1] || '', theirMatch[2] ].join( '' ) );
 				}
 			})()
Index: /CKEditor/branches/prototype/_source/plugins/smiley/plugin.js
===================================================================
--- /CKEditor/branches/prototype/_source/plugins/smiley/plugin.js	(revision 2608)
+++ /CKEditor/branches/prototype/_source/plugins/smiley/plugin.js	(revision 2609)
@@ -99,4 +99,5 @@
 					label : '',
 					title : '',
+					expand : true,
 					elements : [
 							smileySelector
Index: /CKEditor/branches/prototype/_source/skins/default/dialog.css
===================================================================
--- /CKEditor/branches/prototype/_source/skins/default/dialog.css	(revision 2608)
+++ /CKEditor/branches/prototype/_source/skins/default/dialog.css	(revision 2609)
@@ -174,5 +174,4 @@
 	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;
@@ -194,10 +193,4 @@
 	clear: both;
 	padding-left: 10px;
-	/*
-	 * 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 - 42);		/* 16px left cell + 16px right cell + 10px left padding */
 }
 
@@ -211,8 +204,4 @@
 	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);	/* 54px top offset + 51px bottom cell + 1px top border + 1px bottom border */
-	#bottom: default;
-	#right: default;
 }
 
@@ -220,5 +209,4 @@
 {
 	top: 31px;
-	#height: expression(this.offsetParent.offsetHeight - 84);	/* 31px top offset + 51px bottom cell + 1px top border + 1px bottom border */
 }
 
@@ -231,5 +219,4 @@
 	right: 16px;
 	bottom: 20px;
-	_width: expression(this.offsetParent.offsetWidth - 32);		/* 16px left cell + 16px right cell */
 }
 
@@ -241,6 +228,4 @@
 	left: 0px;
 	right: 0px;
-	#width: expression(this.offsetParent.offsetWidth - 20);
-	#height: expression(this.offsetParent.offsetHeight - 20);
 	padding: 5px 10px;
 }
Index: /CKEditor/branches/prototype/_source/skins/default/skin.js
===================================================================
--- /CKEditor/branches/prototype/_source/skins/default/skin.js	(revision 2608)
+++ /CKEditor/branches/prototype/_source/skins/default/skin.js	(revision 2609)
@@ -43,3 +43,62 @@
 })() );
 
-CKEDITOR.dialog.setMargins( 0, 14, 18, 14 );
+(function()
+{
+	// 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 )
+		{
+			var element = partName ? dialog.parts[partName] : dialog._.element.getFirst();
+			if ( width )
+				element.setStyle( 'width', width + 'px' );
+			if ( height )
+				element.setStyle( 'height', height + 'px' );
+		};
+
+	CKEDITOR.dialog.setMargins( 0, 14, 18, 14 );
+
+	CKEDITOR.dialog.on( 'resize', function( evt )
+		{
+			var data = evt.data,
+				width = data.width,
+				height = data.height,
+				dialog = data.dialog;
+			if ( data.skin != skinName )
+				return;
+
+			// 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 );
+
+			if ( CKEDITOR.env.ie )
+			{
+				var contentWidth = width - 34,
+					contentHeight = dialog.getPageCount() > 1 ? height - 107 : height - 84,
+					contentsLength = dialog.parts.contents.getChildCount();
+				setSize( dialog, 'title', width - 52, null );
+				setSize( dialog, 'tabs', width - 42, null );
+				setSize( dialog, 'contents', contentWidth, contentHeight );
+				setSize( dialog, 'footer', width - 32);
+
+				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 - 20 + 'px', height : contentHeight - 20 + 'px' } );
+				}
+			}
+
+			setSize( dialog, null, width, height );
+		});
+})();
