Index: /CKEditor/branches/prototype/_source/plugins/dialog/plugin.js
===================================================================
--- /CKEditor/branches/prototype/_source/plugins/dialog/plugin.js	(revision 2679)
+++ /CKEditor/branches/prototype/_source/plugins/dialog/plugin.js	(revision 2680)
@@ -1770,5 +1770,5 @@
 				dialog.on( 'load', function()
 				{
-					uiElement.getElement().on( eventName, func, uiElement );
+					uiElement.getInputElement().on( eventName, func, uiElement );
 				});
 			};
Index: /CKEditor/branches/prototype/_source/plugins/dialogui/plugin.js
===================================================================
--- /CKEditor/branches/prototype/_source/plugins/dialogui/plugin.js	(revision 2679)
+++ /CKEditor/branches/prototype/_source/plugins/dialogui/plugin.js	(revision 2680)
@@ -63,5 +63,16 @@
 			this.setValue( this._['default'] );
 		}
-	};
+	},
+	eventRegex = /^on([A-Z]\w+)/,
+	cleanInnerDefinition = function( def )
+	{
+		// An inner UI element should not have the parent's type, title or events.
+		for ( var i in def )
+		{
+			if ( eventRegex.test( i ) || i == 'title' || i == 'type' )
+				delete def[i];
+		}
+		return def;
+	}
 
 	CKEDITOR.tools.extend( CKEDITOR.ui.dialog,
@@ -234,10 +245,9 @@
 					var myDefinition = CKEDITOR.tools.extend( {}, elementDefinition,
 							{
-								id : elementDefinition.id ? elementDefinition.id + '_checkbox' : CKEDITOR.tools.getNextNumber() + '_checkbox',
-								title : null,
-								type : null
+								id : elementDefinition.id ? elementDefinition.id + '_checkbox' : CKEDITOR.tools.getNextNumber() + '_checkbox'
 							}, true ),
 						html = [],
 						attributes = { 'class' : 'cke_dialog_ui_checkbox_input', type : 'checkbox' };
+					cleanInnerDefinition( myDefinition );
 					if ( elementDefinition.checked )
 						attributes.checked = 'checked';
@@ -412,7 +422,5 @@
 					var myDefinition = CKEDITOR.tools.extend( {}, elementDefinition,
 							{
-								id : elementDefinition.id ? elementDefinition.id + '_select' : CKEDITOR.tools.getNextNumber() + '_select',
-								title : null,
-								type : null
+								id : elementDefinition.id ? elementDefinition.id + '_select' : CKEDITOR.tools.getNextNumber() + '_select'
 							}, true ),
 						html = [],
@@ -420,4 +428,5 @@
 						attributes = { 'class' : 'cke_dialog_ui_input_select' };
 
+					cleanInnerDefinition( myDefinition );
 					for ( var i = 0, item ; i < elementDefinition.items.length && ( item = elementDefinition.items[i] ) ; i++ )
 					{
@@ -450,6 +459,4 @@
 					this.validate = elementDefinition.validate;
 
-				var myDefinition = CKEDITOR.tools.extend( {}, elementDefinition );
-
 				/** @ignore */
 				var innerHTML = function()
@@ -461,5 +468,5 @@
 				};
 
-				CKEDITOR.ui.dialog.labeledElement.call( this, dialog, myDefinition, htmlList, innerHTML );
+				CKEDITOR.ui.dialog.labeledElement.call( this, dialog, elementDefinition, htmlList, innerHTML );
 			},
 
@@ -543,6 +550,6 @@
 				{
 					var node = CKEDITOR.document.getById( this._.labelId );
-					if ( node.$.getChildCount() < 1 )
-						( new CKEDITOR.dom.text( label, CKEDITOR.document ) ).appendTo( node);
+					if ( node.getChildCount() < 1 )
+						( new CKEDITOR.dom.text( label, CKEDITOR.document ) ).appendTo( node );
 					else
 						node.getChild( 0 ).$.nodeValue = label;
@@ -558,5 +565,5 @@
 						return node.getChild( 0 ).getText();
 				}
-			} );
+			}, true );
 
 	CKEDITOR.ui.dialog.button.prototype = CKEDITOR.tools.extend( new CKEDITOR.ui.dialog.uiElement,
@@ -650,5 +657,5 @@
 					return this._.select.getElement();
 				}
-			} );
+			}, true );
 
 	CKEDITOR.ui.dialog.checkbox.prototype = CKEDITOR.tools.extend( new CKEDITOR.ui.dialog.uiElement,
Index: /CKEditor/branches/prototype/_source/plugins/link/plugin.js
===================================================================
--- /CKEditor/branches/prototype/_source/plugins/link/plugin.js	(revision 2679)
+++ /CKEditor/branches/prototype/_source/plugins/link/plugin.js	(revision 2680)
@@ -43,4 +43,21 @@
 	dialog : function( editor )
 	{
+		// Handles the event when the "Target" selection box is changed.
+		var targetChanged = function()
+		{
+			var popupFeatures = this.getDialog().getContentElement( 'target', 'popupFeatures' ).getElement(),
+				targetName = this.getDialog().getContentElement( 'target', 'linkTargetName' );
+			if ( this.getValue() == 'popup' )
+			{
+				popupFeatures.show();
+				targetName.setLabel( editor.lang.linkTargetPopupName );
+			}
+			else
+			{
+				popupFeatures.hide();
+				targetName.setLabel( editor.lang.linkTargetFrameName );
+			}
+		};
+
 		return {
 			title : editor.lang.linkTitle,
@@ -121,8 +138,10 @@
 										[ editor.lang.linkTargetPopup, 'popup' ],
 										[ editor.lang.linkTargetNew, 'new' ],
-										[ editor.lang.linkTargetType, 'top' ],
+										[ editor.lang.linkTargetTop, 'top' ],
 										[ editor.lang.linkTargetSelf, 'self' ],
 										[ editor.lang.linkTargetParent, 'parent' ]
-									]
+									],
+									onChange : targetChanged,
+									onLoad : targetChanged
 								},
 								{
@@ -138,4 +157,5 @@
 							align : 'center',
 							padding : 2,
+							id : 'popupFeatures',
 							children : 
 							[
