Index: /CKEditor/branches/prototype/_source/core/dom/domobject.js
===================================================================
--- /CKEditor/branches/prototype/_source/core/dom/domobject.js	(revision 2486)
+++ /CKEditor/branches/prototype/_source/core/dom/domobject.js	(revision 2487)
@@ -101,5 +101,5 @@
 		{
 			// Call the original implementation.
-			CKEDITOR.event.prototype.fire.removeListener.apply( this, arguments );
+			CKEDITOR.event.prototype.removeListener.apply( this, arguments );
 
 			// If we don't have listeners for this event, clean the DOM up.
@@ -112,6 +112,6 @@
 					if ( this.$.removeEventListener )
 						this.$.removeEventListener( eventName, listener );
-					else if ( this.$.dettachEvent )
-						this.$.dettachEvent( eventName, listener );
+					else if ( this.$.detachEvent )
+						this.$.detachEvent( eventName, listener );
 
 					delete nativeListeners[ eventName ];
Index: /CKEditor/branches/prototype/_source/plugins/dialog/plugin.js
===================================================================
--- /CKEditor/branches/prototype/_source/plugins/dialog/plugin.js	(revision 2486)
+++ /CKEditor/branches/prototype/_source/plugins/dialog/plugin.js	(revision 2487)
@@ -59,5 +59,4 @@
 			name : dialogName,
 			definition : definition,
-			isShown : false,
 			size : { width : 0, height : 0 },
 			contents : {}
@@ -88,4 +87,9 @@
 	this._.tabs = {};
 
+	// Make the dialog an event hub.
+	CKEDITOR.event.implementOn( this );
+	if ( definition.onLoad )
+		this.on( 'load', definition.onLoad, this, null, CKEDITOR.tools.getNextNumber() );
+
 	// Insert the title.
 	( new CKEDITOR.dom.text( definition.title, CKEDITOR.document ) ).appendTo( this._.parts.title );
@@ -183,4 +187,7 @@
 		// Select the first tab by default.
 		this.selectPage( this._.definition.contents[0].id );
+
+		// Execute onLoad for the first show.
+		this.fireOnce( 'load', {} );
 	},
 
@@ -224,5 +231,4 @@
 		tab.appendTo( this._.parts['tabs'] );
 		tab.setAttribute( 'id', contents.id + '_' + CKEDITOR.tools.getNextNumber() );
-
 	},
 
@@ -253,4 +259,9 @@
 				});
 		selected[1].show();
+	},
+
+	getElement : function()
+	{
+		return this._.element;
 	}
 };
@@ -407,5 +418,6 @@
 										type : 'button',
 										label : 'Click Me',
-										title : 'Click me plz!'
+										title : 'Click me plz!',
+										onClick : function() { alert( 'Clicked!' ); } 
 									},
 
@@ -436,12 +448,9 @@
 			attributes = ( attributesArg && attributesArg.call ? attributesArg( elementDefinition ) : attributesArg ) || {},
 			innerHTML = ( contentsArg && contentsArg.call ? contentsArg( dialog, elementDefinition ) : contentsArg ) || '',
-			id = this.id = attributes.id || elementDefinition.id;
-
-		// Set the id.
-		if ( id )
-		{
-			attributes.id = id;
-			dialog._.contents[id] = this;
-		}
+			id = this.id = attributes.id || elementDefinition.id || CKEDITOR.tools.getNextNumber() + '_uiElement';
+
+		// Set the id, a unique id is required for getElement() to work.
+		attributes.id = id;
+		dialog._.contents[id] = this;
 
 		// Set the type and definition CSS class names.
@@ -482,4 +491,8 @@
 		// Add contents to the parent HTML array.
 		htmlList.push( html.join( '' ) );
+
+		// Add the onLoad event to dialog.
+		if ( elementDefinition.onLoad )
+			dialog.on( 'load', elementDefinition.onLoad, this, null, CKEDITOR.tools.getNextNumber() );
 	},
 
Index: /CKEditor/branches/prototype/_source/plugins/dialogui/plugin.js
===================================================================
--- /CKEditor/branches/prototype/_source/plugins/dialogui/plugin.js	(revision 2486)
+++ /CKEditor/branches/prototype/_source/plugins/dialogui/plugin.js	(revision 2487)
@@ -191,6 +191,49 @@
 				this._ = {};
 
-			CKEDITOR.ui.dialog.uiElement.call( this, dialog, elementDefinition, htmlList, 'input', null, 
-					{ value : elementDefinition.label, type : 'button' } );
+			var innerHTML = function()
+			{
+				return [ '<tbody><tr><td class="cke_dialog_ui_button_txt">', CKEDITOR.tools.htmlEncode( elementDefinition.label ),
+					   '</td></tr></tbody>' ].join( '' );
+			}
+
+			// Add OnClick event to this input.
+			CKEDITOR.event.implementOn( this );
+			if ( elementDefinition.onClick )
+				this.on( 'click', elementDefinition.onClick );
+
+			// Register an event handler for processing button clicks.
+			var classRegex = /cke_dialog_ui_button\w*/, me = this;
+			dialog.on( 'load', function( eventInfo )
+					{
+						if ( !eventInfo.data.buttonHandlerRegistered )
+						{
+							var mouseUpHandler = function( evt )
+							{
+								this.removeClass( 'cke_dialog_ui_button_active' );
+								this.removeListener( 'mouseup', mouseUpHandler );
+								me.fire( 'click' );
+							}
+
+							dialog.getElement().on( 'mousedown', function( evt )
+								{
+									var target = evt.data.getTarget();
+
+									// If we aren't inside a button, bail out.
+									if ( target.getName() != 'td' || !classRegex.test( target.$.className ) )
+										return;
+
+									// Change styles to indicate the button is being clicked.
+									target.addClass( 'cke_dialog_ui_button_active' );
+
+									// Add mouseup handler.
+									target.on( 'mouseup', mouseUpHandler );
+								});
+							eventInfo.data.buttonHandlerRegistered = true;
+						}
+
+						this.getElement().unselectable();
+					}, this);
+
+			CKEDITOR.ui.dialog.uiElement.call( this, dialog, elementDefinition, htmlList, 'table', null, null, innerHTML );
 		},
 
Index: /CKEditor/branches/prototype/_source/skins/default/dialog.css
===================================================================
--- /CKEditor/branches/prototype/_source/skins/default/dialog.css	(revision 2486)
+++ /CKEditor/branches/prototype/_source/skins/default/dialog.css	(revision 2487)
@@ -293,7 +293,17 @@
 {
 	border: #737357 1px solid;
+}
+
+.cke_skin_default .cke_dialog_ui_button_txt
+{
+	padding: 2px 10px;
+	text-align: center;
 	color: #3b3b1f;
 	background-color: #c7c78f;
-	padding: 0px 6px;
+}
+
+.cke_skin_default .cke_dialog_ui_button_active
+{
+	background-color: #e3e3c7;
 }
 
