Index: /CKEditor/branches/prototype/_source/plugins/dialog/plugin.js
===================================================================
--- /CKEditor/branches/prototype/_source/plugins/dialog/plugin.js	(revision 2494)
+++ /CKEditor/branches/prototype/_source/plugins/dialog/plugin.js	(revision 2495)
@@ -39,5 +39,5 @@
 	if ( typeof( definition ) != 'function' )
 	{
-		alert( 'Error: The dialog "' + dialogName + '" is not defined.' );
+		console.log( 'Error: The dialog "' + dialogName + '" is not defined.' );
 		return;
 	}
@@ -45,10 +45,10 @@
 	if ( !( definition.title && definition.contents ) )
 	{
-		alert( 'Error: The dialog "' + dialogName + '" is missing its title or contents.' );
+		console.log( 'Error: The dialog "' + dialogName + '" is missing its title or contents.' );
 		return;
 	}
 	if ( definition.contents.length < 1 )
 	{
-		alert( 'Error: The dialog "' + dialogName + '" has no contents.' );
+		console.log( 'Error: The dialog "' + dialogName + '" has no contents.' );
 		return;
 	}
@@ -326,7 +326,5 @@
 		minWidth : 600,
 		minHeight : 400,
-		buttons : [ CKEDITOR.dialog.okButton, CKEDITOR.dialog.cancelButton ],
-		onOk : function(){ alert( 'ok called' ); },
-		onCancel : function(){ alert( 'cancel caled' ); }
+		buttons : [ CKEDITOR.dialog.okButton, CKEDITOR.dialog.cancelButton ]
 	},
 
@@ -450,5 +448,9 @@
 										type : 'button',
 										label : 'Click Me',
-										title : 'Click me plz!'
+										title : 'Click me plz!',
+										onClick : function( evt )
+										{
+											console.log( 'Clicked!!' );
+										}
 									},
 
Index: /CKEditor/branches/prototype/_source/plugins/dialogui/plugin.js
===================================================================
--- /CKEditor/branches/prototype/_source/plugins/dialogui/plugin.js	(revision 2494)
+++ /CKEditor/branches/prototype/_source/plugins/dialogui/plugin.js	(revision 2495)
@@ -197,4 +197,8 @@
 			};
 
+			if ( !window.debugButtons )
+				window.debugButtons = [];
+			debugButtons.push(this);
+
 			// Add OnClick event to this input.
 			CKEDITOR.event.implementOn( this );
@@ -206,21 +210,16 @@
 			dialog.on( 'load', function( eventInfo )
 					{
+						this.getElement().on( 'mousedown', function( evt )
+							{
+								// Change styles to indicate the button is being clicked.
+								var target = evt.data.getTarget();
+								target.addClass( 'cke_dialog_ui_button_active' );
+
+								// Store the currently active button.
+								CKEDITOR.ui.dialog.button._.activeButton = [ me, target ];
+							});
+
 						if ( !eventInfo.data.buttonHandlerRegistered )
 						{
-							dialog.getElement().on( 'mousedown', function( evt )
-								{
-									var target = evt.data.getTarget();
-
-									// If we aren't inside an inactive button, bail out.
-									if ( target.getName() != 'td' || target.$.className.search( 'cke_dialog_ui_button_txt' ) == -1 )
-										return;
-
-									// Change styles to indicate the button is being clicked.
-									target.addClass( 'cke_dialog_ui_button_active' );
-
-									// Store the currently active button.
-									CKEDITOR.ui.dialog.button._.activeButton = target;
-								});
-
 							CKEDITOR.document.on( 'mouseup', function( evt )
 								{
@@ -232,10 +231,10 @@
 
 									// Change styles to remove active status.
-									CKEDITOR.ui.dialog.button._.activeButton.removeClass( 'cke_dialog_ui_button_active' );
+									CKEDITOR.ui.dialog.button._.activeButton[1].removeClass( 'cke_dialog_ui_button_active' );
 
 									// Fire the click event - but only if the
 									// active button is the same as target.
-									if ( CKEDITOR.ui.dialog.button._.activeButton.$ == target.$ )
-										me.fire( 'click', { dialog : dialog } );
+									if ( CKEDITOR.ui.dialog.button._.activeButton[1].$ == target.$ )
+										CKEDITOR.ui.dialog.button._.activeButton[0].fire( 'click', { dialog : dialog } );
 
 									// Clear active button flag.
