Index: /CKEditor/branches/prototype/_source/core/dom/node.js
===================================================================
--- /CKEditor/branches/prototype/_source/core/dom/node.js	(revision 2573)
+++ /CKEditor/branches/prototype/_source/core/dom/node.js	(revision 2574)
@@ -239,4 +239,15 @@
 		},
 
+		getAscendant : function( name )
+		{
+			var node = this.$;
+			while ( ( node = node.parentNode ) )
+			{
+				if ( node.nodeName && node.nodeName.toLowerCase() == name )
+					return new CKEDITOR.dom.node( node );
+			}
+			return null;
+		},
+
 		/**
 		 * Removes this node from the document DOM.
Index: /CKEditor/branches/prototype/_source/plugins/dialog/plugin.js
===================================================================
--- /CKEditor/branches/prototype/_source/plugins/dialog/plugin.js	(revision 2573)
+++ /CKEditor/branches/prototype/_source/plugins/dialog/plugin.js	(revision 2574)
@@ -63,5 +63,6 @@
 			definition : definition,
 			size : { width : 0, height : 0 },
-			contents : {}
+			contents : {},
+			buttons : {}
 		}, true);
 
@@ -192,6 +193,6 @@
 
 	// Insert buttons.
-	var buttonsHtml = [];
-	CKEDITOR.dialog._.uiElementBuilders.hbox.build( this,
+	var buttonsHtml = [],
+		buttons = CKEDITOR.dialog._.uiElementBuilders.hbox.build( this,
 			{
 				type : 'hbox',
@@ -199,6 +200,9 @@
 				widths : [],
 				children : definition.buttons
-			}, buttonsHtml );
+			}, buttonsHtml ).getChild();
 	this._.parts.footer.setHtml( buttonsHtml.join( '' ) );
+
+	for ( var i = 0 ; i < buttons.length ; i++ )
+		this._.buttons[ buttons[i].id ] = buttons[i];
 
 	CKEDITOR.skins.load( editor.config.skin, 'dialog' );
@@ -458,5 +462,5 @@
 	},
 
-	getChild : function( pageId, elementId )
+	getContentElement : function( pageId, elementId )
 	{
 		return this._.contents[pageId][elementId];
@@ -465,10 +469,30 @@
 	getValueOf : function( pageId, elementId )
 	{
-		return this.getChild( pageId, elementId ).getValue();
+		return this.getContentElement( pageId, elementId ).getValue();
 	},
 
 	setValueOf : function( pageId, elementId, value )
 	{
-		return this.getChild( pageId, elementId ).setValue( value );
+		return this.getContentElement( pageId, elementId ).setValue( value );
+	},
+
+	getButton : function( id )
+	{
+		return this._.buttons[ id ];
+	},
+
+	click : function( id )
+	{
+		return this._.buttons[ id ].click();
+	},
+
+	disableButton : function( id )
+	{
+		return this._.buttons[ id ].disable();
+	},
+
+	enableButton : function( id )
+	{
+		return this._.buttons[ id ].enable();
 	}
 };
@@ -483,4 +507,5 @@
 		okButton : 
 		{
+			id : 'ok',
 			type : 'button',
 			label : 'OK',
@@ -496,4 +521,5 @@
 		cancelButton :
 		{
+			id : 'cancel',
 			type : 'button',
 			label : 'Cancel',
@@ -845,6 +871,4 @@
 		for ( i = 0 ; i < dialogDefinition.contents.length && ( cursor = dialogDefinition.contents[i] ) ; i++ )
 			dialogDefinition.contents[i] = new CKEDITOR.dialog._.contentObject( dialog, cursor.id, cursor );
-		for ( i = 0 ; i < dialogDefinition.buttons.length && ( cursor = dialogDefinition.buttons[i] ) ; i++ )
-			dialogDefinition.buttons[i] = new CKEDITOR.dialog._.buttonObject( dialog, cursor );
 	},
 
@@ -859,10 +883,4 @@
 				});
 		CKEDITOR.tools.extend( this, contentDefinition );
-	},
-
-	buttonObject : function( dialog, buttonDefinition )
-	{
-		( this._ || ( this._ = {} ) ).dialog = dialog;
-		CKEDITOR.tools.extend( this, buttonDefinition );
 	}
 };
@@ -941,9 +959,4 @@
 CKEDITOR.dialog._.contentObject.prototype = 
 {
-	activate : function()
-	{
-		this._.dialog.selectPage( this._.id );
-	},
-
 	get : function( id )
 	{
@@ -978,19 +991,4 @@
 		}
 		return null;
-	}
-};
-
-CKEDITOR.dialog._.buttonObject.prototype =
-{
-	click : function()
-	{
-	},
-
-	enable : function()
-	{
-	},
-
-	disable : function()
-	{
 	}
 };
Index: /CKEditor/branches/prototype/_source/plugins/dialogui/plugin.js
===================================================================
--- /CKEditor/branches/prototype/_source/plugins/dialogui/plugin.js	(revision 2573)
+++ /CKEditor/branches/prototype/_source/plugins/dialogui/plugin.js	(revision 2574)
@@ -28,4 +28,9 @@
 		if ( 'default' in elementDefinition )
 			this._['default'] = elementDefinition['default'];
+		var args = [ this._ ];
+		for ( var i = 1 ; i < arguments.length ; i++ )
+			args.push( arguments[i] );
+		args.push( true );
+		CKEDITOR.tools.extend.apply( CKEDITOR.tools, args );
 		return this._;
 	},
@@ -153,6 +158,5 @@
 					return;
 
-				var _ = initPrivateObject.call( this, elementDefinition );
-				this._['default'] = elementDefinition.checked || false;
+				var _ = initPrivateObject.call( this, elementDefinition, { 'default' : elementDefinition.checked || false }  );
 
 				if ( elementDefinition.validate )
@@ -237,5 +241,5 @@
 					return;
 
-				initPrivateObject.call( this, elementDefinition );
+				initPrivateObject.call( this, elementDefinition, { disabled : false } );
 
 				var innerHTML = function()
@@ -258,10 +262,13 @@
 							element.on( 'mousedown', function( evt )
 								{
+									// If button is disabled, don't do anything.
+									if ( me._.disabled )
+										return;
+
 									// Change styles to indicate the button is being clicked.
-									var target = evt.data.getTarget();
-									target.addClass( 'cke_dialog_ui_button_active' );
+									me.getElement().addClass( 'active' );
 
 									// Store the currently active button.
-									CKEDITOR.ui.dialog.button._.activeButton = [ me, target ];
+									CKEDITOR.ui.dialog.button._.activeButton = [ me, me.getElement() ];
 								});
 
@@ -281,9 +288,9 @@
 
 										// Change styles to remove active status.
-										CKEDITOR.ui.dialog.button._.activeButton[1].removeClass( 'cke_dialog_ui_button_active' );
+										CKEDITOR.ui.dialog.button._.activeButton[1].removeClass( 'active' );
 
 										// Fire the click event - but only if the
 										// active button is the same as target.
-										if ( CKEDITOR.ui.dialog.button._.activeButton[1].$ == target.$ )
+										if ( CKEDITOR.ui.dialog.button._.activeButton[1].equals( target.getAscendant( 'table' ) ) )
 											CKEDITOR.ui.dialog.button._.activeButton[0].fire( 'click', { dialog : dialog } );
 
@@ -311,6 +318,26 @@
 
 	CKEDITOR.ui.dialog.labeledElement.prototype
-		= CKEDITOR.ui.dialog.button.prototype
 		= CKEDITOR.ui.dialog.html.prototype = new CKEDITOR.ui.dialog.uiElement;
+
+	CKEDITOR.ui.dialog.button.prototype = CKEDITOR.tools.extend( new CKEDITOR.ui.dialog.uiElement,
+			{
+				click : function()
+				{
+					if ( !this._.disabled )
+						this.fire( 'click', { dialog : this._.dialog } );
+				},
+
+				enable : function()
+				{
+					this._.disabled = false;
+					this.getElement().removeClass( 'disabled' );
+				},
+
+				disable : function()
+				{
+					this._.disabled = true;
+					this.getElement().addClass( 'disabled' );
+				}
+			}, true );
 
 	CKEDITOR.ui.dialog.textInput.prototype = CKEDITOR.tools.extend( new CKEDITOR.ui.dialog.labeledElement,
Index: /CKEditor/branches/prototype/_source/skins/default/dialog.css
===================================================================
--- /CKEditor/branches/prototype/_source/skins/default/dialog.css	(revision 2573)
+++ /CKEditor/branches/prototype/_source/skins/default/dialog.css	(revision 2574)
@@ -331,4 +331,9 @@
 }
 
+.cke_skin_default .cke_dialog_ui_button.disabled
+{
+	border: #898980 1px solid;
+}
+
 .cke_skin_default .cke_dialog_ui_button_txt
 {
@@ -339,5 +344,11 @@
 }
 
-.cke_skin_default .cke_dialog_ui_button_active
+.cke_skin_default .cke_dialog_ui_button.disabled .cke_dialog_ui_button_txt
+{
+	color: #5e5e55;
+	background-color: #c5c5b3;
+}
+
+.cke_skin_default .cke_dialog_ui_button.active .cke_dialog_ui_button_txt
 {
 	background-color: #e3e3c7;
