Index: /CKEditor/branches/prototype/_source/plugins/forms/dialogs/button.js
===================================================================
--- /CKEditor/branches/prototype/_source/plugins/forms/dialogs/button.js	(revision 2918)
+++ /CKEditor/branches/prototype/_source/plugins/forms/dialogs/button.js	(revision 2919)
@@ -32,6 +32,5 @@
 
 	// Function called in onShow to load selected element.
-	var loadLink = function( editor, selection, ranges, element ){
-
+	var loadSelection = function( editor, selection, ranges, element ){
 		// Read attributes.
 		var type = element.getAttribute( 'type' );
@@ -56,17 +55,4 @@
 		minWidth : 400,
 		minHeight : 230,
-		onOk : function( data )
-		{
-			this.editObj.setAttributes( this.changedAttibutes );
-			
-			if ( this.editMode == false )
-			{			
-				// Doesn't work with IE.
-				this.restoreSelection();
-				this.clearSavedSelection();
-				editor.insertElement( this.editObj );
-			}
-			return true;
-		},
 		onShow : function()
 		{
@@ -93,5 +79,5 @@
 					if ( type == "button" || type == "reset" || type == "submit" )
 					{
-						loadLink.apply( this, [ editor, selection, ranges, element ] );
+						loadSelection.apply( this, [ editor, selection, ranges, element ] );
 						selection.selectElement( element );
 					}
@@ -100,10 +86,20 @@
 
 			if ( this.editMode == false )	//New object.
-			{
 				this.editObj = editor.document.createElement( 'input' );
-			}
 			this.getContentElement( 'info', 'txtName' ).focus();
 
 			this.changedAttibutes = new Array();
+		},
+		onOk : function()
+		{
+			this.editObj.setAttributes( this.changedAttibutes );
+			
+			if ( this.editMode == false )
+			{			
+				this.restoreSelection();
+				this.clearSavedSelection();
+				editor.insertElement( this.editObj );
+			}
+			return true;
 		},
 		contents : [
Index: /CKEditor/branches/prototype/_source/plugins/forms/dialogs/checkbox.js
===================================================================
--- /CKEditor/branches/prototype/_source/plugins/forms/dialogs/checkbox.js	(revision 2918)
+++ /CKEditor/branches/prototype/_source/plugins/forms/dialogs/checkbox.js	(revision 2919)
@@ -32,5 +32,5 @@
 
 	// Function called in onShow to load selected element.
-	var loadLink = function( editor, selection, ranges, element )
+	var loadSelection = function( editor, selection, ranges, element )
 	{
 		this.saveSelection();
@@ -39,16 +39,19 @@
 
 		// Fill out all fields.
-		readAttribute.apply( this, [ 'info', 'name', 'txtName' ] );
-		readAttribute.apply( this, [ 'info', 'value', 'txtValue' ] );
-		readAttribute.apply( this, [ 'info', 'checked', 'cmbSelected' ] );
+		readAttribute.apply( this, [ this.editObj, 'info', 'name', 'txtName', true ] );
+		readAttribute.apply( this, [ this.editObj, 'info', 'value', 'txtValue', true ] );
+		readAttribute.apply( this, [ this.editObj, 'info', 'checked', 'cmbSelected', true ] );
 
 		return false;
 	};
 	
-	var readAttribute = function( page, attribute, input )
+	var readAttribute = function( object, page, attribute, input, setIfNull )
 	{
-		var attributeValue = this.editObj.getAttribute( attribute );
-		this.setValueOf( page, input, attributeValue );
-
+		var attributeValue = object.getAttribute( attribute );
+		if ( attributeValue == null )
+			if ( setIfNull )
+				this.setValueOf( page, input, "" );
+		else
+			this.setValueOf( page, input, attributeValue );
 		return attributeValue;
 	}
@@ -59,23 +62,9 @@
 		minWidth : 400,
 		minHeight : 230,
-		onOk : function()
-		{
-			this.changedAttibutes[ 'type' ] = 'checkbox';
-
-			this.editObj.setAttributes( this.changedAttibutes );
-
-			if ( this.editMode == false )
-			{
-				// It doesn't work with IE.
-				this.restoreSelection();
-				this.clearSavedSelection();
-				editor.insertElement( this.editObj );
-			}
-			return true;
-		},
 		onShow : function()
 		{
 			// Default: create a new element.
 			this.editMode = false;
+			this.changedAttibutes = new Array();
 			
 			// IE BUG: Selection must be in the editor for getSelection() to work.
@@ -95,5 +84,5 @@
 				if ( element && element.getAttribute( 'type' ) == "checkbox" )
 				{
-					loadLink.apply( this, [ editor, selection, ranges, element ] );
+					loadSelection.apply( this, [ editor, selection, ranges, element ] );
 					selection.selectElement( element );
 				}
@@ -104,5 +93,18 @@
 
 			this.getContentElement( 'info', 'txtName' ).focus();
-			this.changedAttibutes = new Array();
+		},
+		onOk : function()
+		{
+			this.changedAttibutes[ 'type' ] = 'checkbox';
+
+			this.editObj.setAttributes( this.changedAttibutes );
+
+			if ( this.editMode == false )
+			{
+				this.restoreSelection();
+				this.clearSavedSelection();
+				editor.insertElement( this.editObj );
+			}
+			return true;
 		},
 		contents : [
Index: /CKEditor/branches/prototype/_source/plugins/forms/dialogs/form.js
===================================================================
--- /CKEditor/branches/prototype/_source/plugins/forms/dialogs/form.js	(revision 2918)
+++ /CKEditor/branches/prototype/_source/plugins/forms/dialogs/form.js	(revision 2919)
@@ -32,5 +32,5 @@
 
 	// Function called in onShow to load selected element.
-	var loadLink = function( editor, selection, ranges, element )
+	var loadSelection = function( editor, selection, ranges, element )
 	{
 		this.saveSelection();
@@ -39,19 +39,22 @@
 
 		// Fill out all fields.
-		readAttribute.apply( this, [ 'info', 'name', 'txtName' ] );
-		readAttribute.apply( this, [ 'info', 'action', 'txtAction' ] );
-		readAttribute.apply( this, [ 'info', 'method', 'cmbMethod' ] );
-		readAttribute.apply( this, [ 'info', 'encoding', 'cmbEncoding' ] );
-		readAttribute.apply( this, [ 'info', 'target', 'cmbTarget' ] );
-		readAttribute.apply( this, [ 'info', 'id', 'txtId' ] );
+		readAttribute.apply( this, [ this.editObj, 'info', 'name', 'txtName', true ] );
+		readAttribute.apply( this, [ this.editObj, 'info', 'action', 'txtAction', true ] );
+		readAttribute.apply( this, [ this.editObj, 'info', 'method', 'cmbMethod', true ] );
+		readAttribute.apply( this, [ this.editObj, 'info', 'encoding', 'cmbEncoding', true ] );
+		readAttribute.apply( this, [ this.editObj, 'info', 'target', 'cmbTarget', true ] );
+		readAttribute.apply( this, [ this.editObj, 'info', 'id', 'txtId', true ] );
 
 		return false;
 	};
 	
-	var readAttribute = function( page, attribute, input )
+	var readAttribute = function( object, page, attribute, input, setIfNull )
 	{
-		var attributeValue = this.editObj.getAttribute( attribute );
-		this.setValueOf( page, input, attributeValue );
-
+		var attributeValue = object.getAttribute( attribute );
+		if ( attributeValue == null )
+			if ( setIfNull )
+				this.setValueOf( page, input, "" );
+		else
+			this.setValueOf( page, input, attributeValue );
 		return attributeValue;
 	}
@@ -62,5 +65,5 @@
 		minWidth : 400,
 		minHeight : 270,
-		onOk : function( data )
+		onOk : function()
 		{
 			this.editObj.setAttributes( this.changedAttibutes );
@@ -68,5 +71,4 @@
 			if ( this.editMode == false )
 			{
-				// It doesn't work with IE.
 				this.restoreSelection();
 				this.clearSavedSelection();
@@ -79,4 +81,5 @@
 			// Default: create a new element.
 			this.editMode = false;
+			this.changedAttibutes = new Array();
 			
 			// IE BUG: Selection must be in the editor for getSelection() to work.
@@ -96,5 +99,5 @@
 				if ( element )
 				{
-					loadLink.apply( this, [ editor, selection, ranges, element ] );
+					loadSelection.apply( this, [ editor, selection, ranges, element ] );
 					selection.selectElement( element );
 				}
@@ -105,5 +108,4 @@
 
 			this.getContentElement( 'info', 'txtName' ).focus();
-			this.changedAttibutes = new Array();
 		},
 		contents : [
Index: /CKEditor/branches/prototype/_source/plugins/forms/dialogs/hiddenfield.js
===================================================================
--- /CKEditor/branches/prototype/_source/plugins/forms/dialogs/hiddenfield.js	(revision 2918)
+++ /CKEditor/branches/prototype/_source/plugins/forms/dialogs/hiddenfield.js	(revision 2919)
@@ -32,5 +32,5 @@
 
 	// Function called in onShow to load selected element.
-	var loadLink = function( editor, selection, ranges, element )
+	var loadSelection = function( editor, selection, ranges, element )
 	{
 		this.saveSelection();
@@ -39,18 +39,12 @@
 
 		// Fill out all fields.
-		readAttribute.apply( this, [ 'info', 'name', 'txtName' ] );
-		readAttribute.apply( this, [ 'info', 'value', 'txtValue' ] );
+		var name = element.getAttribute( 'name' );
+		var value = element.getAttribute( 'value' );
+		
+		this.setValueOf( 'info', 'txtName', name );
+		this.setValueOf( 'info', 'txtValue', value );
 
 		return false;
 	};
-	
-	var readAttribute = function( page, attribute, input )
-	{
-		var attributeValue = this.editObj.getAttribute( attribute );
-		this.setValueOf( page, input, attributeValue );
-
-		return attributeValue;
-	}
-
 	return {
 		title : editor.lang.hidden.title,
@@ -58,24 +52,10 @@
 		minWidth : 400,
 		minHeight : 200,
-		onOk : function()
-		{
-			this.changedAttibutes[ 'type' ] = 'hidden';
-
-			this.editObj.setAttributes( this.changedAttibutes );
-
-			if ( this.editMode == false )
-			{
-				// It doesn't work with IE.
-				this.restoreSelection();
-				this.clearSavedSelection();
-				editor.insertElement( this.editObj );
-			}
-			return true;
-		},
 		onShow : function()
 		{
 			// Default: create a new element.
 			this.editMode = false;
-			
+			this.changedAttibutes = new Array();
+
 			// IE BUG: Selection must be in the editor for getSelection() to work.
 			this.restoreSelection();
@@ -94,5 +74,5 @@
 				if ( element && element.getAttribute( 'type' ) == "hidden" )
 				{
-					loadLink.apply( this, [ editor, selection, ranges, element ] );
+					loadSelection.apply( this, [ editor, selection, ranges, element ] );
 					selection.selectElement( element );
 				}
@@ -103,5 +83,17 @@
 
 			this.getContentElement( 'info', 'txtName' ).focus();
-			this.changedAttibutes = new Array();
+		},
+		onOk : function()
+		{
+			this.changedAttibutes[ 'type' ] = 'hidden';
+			this.editObj.setAttributes( this.changedAttibutes );
+
+			if ( this.editMode == false )
+			{
+				this.restoreSelection();
+				this.clearSavedSelection();
+				editor.insertElement( this.editObj );
+			}
+			return true;
 		},
 		contents : [
Index: /CKEditor/branches/prototype/_source/plugins/forms/dialogs/radio.js
===================================================================
--- /CKEditor/branches/prototype/_source/plugins/forms/dialogs/radio.js	(revision 2918)
+++ /CKEditor/branches/prototype/_source/plugins/forms/dialogs/radio.js	(revision 2919)
@@ -32,5 +32,5 @@
 
 	// Function called in onShow to load selected element.
-	var loadLink = function( editor, selection, ranges, element )
+	var loadSelection = function( editor, selection, ranges, element )
 	{
 		this.saveSelection();
@@ -38,20 +38,16 @@
 		this.editMode = true;
 
+		// Read attributes.
+		var checked = element.getAttribute( 'checked' );
+		var name = element.getAttribute( 'name' );
+		var value = element.getAttribute( 'value' );
+
 		// Fill out all fields.
-		readAttribute.apply( this, [ 'info', 'name', 'txtName' ] );
-		readAttribute.apply( this, [ 'info', 'value', 'txtValue' ] );
-		readAttribute.apply( this, [ 'info', 'checked', 'cmbSelected' ] );
+		this.setValueOf( 'info', 'txtName', name );
+		this.setValueOf( 'info', 'txtValue', value );
+		this.setValueOf( 'info', 'cmbSelected', checked );
 
 		return false;
 	};
-	
-	var readAttribute = function( page, attribute, input )
-	{
-		var attributeValue = this.editObj.getAttribute( attribute );
-		this.setValueOf( page, input, attributeValue );
-
-		return attributeValue;
-	}
-
 	return {
 		title : editor.lang.checkboxAndRadio.radioTitle,
@@ -59,24 +55,10 @@
 		minWidth : 400,
 		minHeight : 200,
-		onOk : function()
-		{
-			this.changedAttibutes[ 'type' ] = 'radio';
-
-			this.editObj.setAttributes( this.changedAttibutes );
-
-			if ( this.editMode == false )
-			{
-				// It doesn't work with IE.
-				this.restoreSelection();
-				this.clearSavedSelection();
-				editor.insertElement( this.editObj );
-			}
-			return true;
-		},
 		onShow : function()
 		{
 			// Default: create a new element.
 			this.editMode = false;
-			
+			this.changedAttibutes = new Array();
+
 			// IE BUG: Selection must be in the editor for getSelection() to work.
 			this.restoreSelection();
@@ -95,5 +77,5 @@
 				if ( element && element.getAttribute( 'type' ) == "radio" )
 				{
-					loadLink.apply( this, [ editor, selection, ranges, element ] );
+					loadSelection.apply( this, [ editor, selection, ranges, element ] );
 					selection.selectElement( element );
 				}
@@ -104,5 +86,19 @@
 
 			this.getContentElement( 'info', 'txtName' ).focus();
-			this.changedAttibutes = new Array();
+		},
+		onOk : function()
+		{
+			this.changedAttibutes[ 'type' ] = 'radio';
+
+			this.editObj.setAttributes( this.changedAttibutes );
+
+			if ( this.editMode == false )
+			{
+				// It doesn't work with IE.
+				this.restoreSelection();
+				this.clearSavedSelection();
+				editor.insertElement( this.editObj );
+			}
+			return true;
 		},
 		contents : [
Index: /CKEditor/branches/prototype/_source/plugins/forms/dialogs/select.js
===================================================================
--- /CKEditor/branches/prototype/_source/plugins/forms/dialogs/select.js	(revision 2918)
+++ /CKEditor/branches/prototype/_source/plugins/forms/dialogs/select.js	(revision 2919)
@@ -21,4 +21,5 @@
 CKEDITOR.dialog.add( 'select', function( editor )
 {
+	var plugin = CKEDITOR.plugins.forms.select;
 	var addChange = function( name, input ){
 		var dialog = input.getDialog();
@@ -34,9 +35,9 @@
 		var names = dialog.getContentElement( 'info', 'cmbName' );
 		var values = dialog.getContentElement( 'info', 'cmbValue' );
-		var namesOptions = CKEDITOR.plugins.forms.select.getOptions( names );
-		var valuesOptions = CKEDITOR.plugins.forms.select.getOptions( values );
+		var namesOptions = plugin.getOptions( names );
+		var valuesOptions = plugin.getOptions( values );
 
 		// Reset dialog.
-		for ( var i = namesOptions.length-1 ; i >=0 ; i-- )
+		for ( var i = namesOptions.length-1 ; i >= 0 ; i-- )
 		{
 			namesOptions[i].parentNode.removeChild( namesOptions[i] );
@@ -48,5 +49,5 @@
 	
 	// Function called in onShow to load selected element.
-	var loadElements = function( editor, selection, ranges, element )
+	var loadSelection = function( editor, selection, ranges, element )
 	{
 		var dialog = this;
@@ -66,5 +67,5 @@
 		dialog.getContentElement( 'info', 'chkMulti' ).setValue( dialog.editObj.getAttribute( "multiple" ) );
 
-		var objOptions = CKEDITOR.plugins.forms.select.getOptions( dialog.editObj );
+		var objOptions = plugin.getOptions( dialog.editObj );
 
 		//Load Options into dialog.
@@ -75,6 +76,6 @@
 			if ( objOptions[i].getAttribute( 'selected' ) == 'selected' )
 				dialog.getContentElement( 'info', 'txtValue' ).setValue( objOptions[i].value );		
-			var oTOption = CKEDITOR.plugins.forms.select.addOption( names, oText, oText, editor.document );
-			var oVOption = CKEDITOR.plugins.forms.select.addOption( values, oValue, oValue, editor.document );
+			var oTOption = plugin.addOption( names, oText, oText, editor.document );
+			var oVOption = plugin.addOption( values, oValue, oValue, editor.document );
 		}
 	}
@@ -84,8 +85,9 @@
 		resizable : CKEDITOR.DIALOG_RESIZE_NONE,
 		minWidth : 400,
-		minHeight : 350,
+		minHeight : 370,
 		onShow : function()
 		{
 			this.editMode = false;
+			this.changedAttibutes = new Array();
 
 			// IE BUG: Selection must be in the editor for getSelection() to work.
@@ -104,5 +106,5 @@
 				if ( element )
 				{
-					loadElements.apply( this, [ editor, selection, ranges, element ] );
+					loadSelection.apply( this, [ editor, selection, ranges, element ] );
 					selection.selectElement( element );
 					this.saveSelection();
@@ -118,9 +120,8 @@
 			this.pushDefault();
 			this.getContentElement( 'info', 'txtName' ).focus();
-			this.changedAttibutes = new Array();
 		},
 		onOk : function()
 		{
-			var objOptions = CKEDITOR.plugins.forms.select.getOptions( this.editObj );
+			var objOptions = plugin.getOptions( this.editObj );
 
 			// Remove all options.
@@ -130,6 +131,6 @@
 
 			var selectValue = this.getContentElement( 'info', 'txtValue' ).getValue();
-			var optionsNames = CKEDITOR.plugins.forms.select.getOptions( this.getContentElement( 'info', 'cmbName' ) );
-			var optionsValues = CKEDITOR.plugins.forms.select.getOptions( this.getContentElement( 'info', 'cmbValue' ) );
+			var optionsNames = plugin.getOptions( this.getContentElement( 'info', 'cmbName' ) );
+			var optionsValues = plugin.getOptions( this.getContentElement( 'info', 'cmbValue' ) );
 
 			//Set added/changed attributes
@@ -145,5 +146,5 @@
 				if ( sValue.length == 0 ) sValue = sText;
 
-				var oOption = CKEDITOR.plugins.forms.select.addOption( this.editObj, sText, sValue, parentEditor.document );
+				var oOption = plugin.addOption( this.editObj, sText, sValue, parentEditor.document );
 				if ( sValue == selectValue )
 				{
@@ -191,5 +192,5 @@
 						style : 'width:350px',
 						'default' : '',
-						accessKey : 'V',
+						readonly : true,		//TODO: make it readonly
 						disabled : true
 					},
@@ -226,5 +227,4 @@
 							{
 								type : 'html',
-								align : 'center',
 								html : '<span>' + CKEDITOR.tools.htmlEncode( editor.lang.select.lines ) + '</span>'
 							}
@@ -233,125 +233,88 @@
 					{
 						type : 'html',
-						align : 'center',
 						html : '<span>' + CKEDITOR.tools.htmlEncode( editor.lang.select.opAvail ) + '</span>'
 					},
 					{
 						type : 'hbox',
-						widths : [ '35%', '35%', '15%', '15%' ],
+						widths : [ '35%', '35%' ,'30%' ],
+						padding : 2,
+						align : 'top',
 						children :
 						[
 							{
-								id : 'txtOptName',
-								type : 'text',
-								label : editor.lang.select.opText,
-								style : 'width:105px'
+								type : 'vbox',
+								padding : 0,
+								children :
+								[
+									{
+										id : 'txtOptName',
+										type : 'text',
+										label : editor.lang.select.opText,
+										style : 'width:100%;margin-bottom:10px'
+									},
+
+									{
+										type : 'select',
+										id : 'cmbName',
+										label : '',
+										title : '',
+										multiple : true,
+										size : 5,
+										style : 'width:100%;margin-bottom:5px',
+										items : [],
+										onChange : function()
+										{
+											var dialog = this.getDialog();
+											var names = dialog.getContentElement( 'info', 'cmbName' );
+											var values = dialog.getContentElement( 'info', 'cmbValue' );
+
+											var name = dialog.getContentElement( 'info', 'txtOptName' );
+											var value = dialog.getContentElement( 'info', 'txtOptValue' );
+
+											var iIndex = plugin.getSelectedIndex( names );
+											plugin.setSelectedIndex( values, iIndex );
+
+											name.setValue( names.getValue() );
+											value.setValue( values.getValue() );
+										}
+									}
+								]
 							},
 							{
-								id : 'txtOptValue',
-								type : 'text',
-								label : editor.lang.select.opValue,
-								style : 'width:105px'
-							},
-							{
-								type : 'button',
-								style : '',
-								label : editor.lang.select.btnAdd,
-								title : editor.lang.select.btnAdd,
-								onClick : function()
-								{
-									//Add new option.
-									var dialog = this.getDialog();
-									var parentEditor = dialog.getParentEditor();
-									var name = dialog.getContentElement( 'info', 'txtOptName' );
-									var value = dialog.getContentElement( 'info', 'txtOptValue' );
-
-									var names = dialog.getContentElement( 'info', 'cmbName' );
-									var values = dialog.getContentElement( 'info', 'cmbValue' );
-
-									CKEDITOR.plugins.forms.select.addOption(names, name.getValue(), name.getValue(), parentEditor.document );
-									CKEDITOR.plugins.forms.select.addOption(values, value.getValue(), value.getValue(), parentEditor.document );
-
-									name.setValue( "" );
-									value.setValue( "" );
-								}
-							},
-							{
-								type : 'button',
-								label : editor.lang.select.btnModify,
-								title : editor.lang.select.btnModify,
-								onClick : function()
-								{
-									//Modify selected option.
-									var dialog = this.getDialog();
-									var name = dialog.getContentElement( 'info', 'txtOptName' );
-									var value = dialog.getContentElement( 'info', 'txtOptValue' );
-
-									var names = dialog.getContentElement( 'info', 'cmbName' );
-									var values = dialog.getContentElement( 'info', 'cmbValue' );
-
-									var iIndex = CKEDITOR.plugins.forms.select.getSelectedIndex( names );
-									if ( iIndex >= 0 )
-									{
-										CKEDITOR.plugins.forms.select.modifyOption( names, iIndex, name.getValue(), name.getValue() );
-										CKEDITOR.plugins.forms.select.modifyOption( values, iIndex, value.getValue(), value.getValue() );
-									}
-								}
-							}
-						]
-					},
-					{
-						type : 'hbox',
-						widths : [ '35%','35%','30%'],
-						children :
-						[
-							{
-								type : 'select',
-								id : 'cmbName',
-								label : '',
-								title : '',
-								multiple : true,
-								size : 5,
-								style : 'width:105px',
-								items : [],
-								onChange : function()
-								{
-									var dialog = this.getDialog();
-									var names = dialog.getContentElement( 'info', 'cmbName' );
-									var values = dialog.getContentElement( 'info', 'cmbValue' );
-
-									var name = dialog.getContentElement( 'info', 'txtOptName' );
-									var value = dialog.getContentElement( 'info', 'txtOptValue' );
-
-									var iIndex = CKEDITOR.plugins.forms.select.getSelectedIndex( names );
-									CKEDITOR.plugins.forms.select.setSelectedIndex( values, iIndex );
-
-									name.setValue( names.getValue() );
-									value.setValue( values.getValue() );
-								}
-							},
-							{
-								type : 'select',
-								id : 'cmbValue',
-								label : '',
-								title : '',
-								multiple : true,
-								size : 5,
-								style : 'width:105px',
-								items : [],
-								onChange : function()
-								{
-									var dialog = this.getDialog();
-									var names = dialog.getContentElement( 'info', 'cmbName' );
-									var values = dialog.getContentElement( 'info', 'cmbValue' );
-
-									var name = dialog.getContentElement( 'info', 'txtOptName' );
-									var value = dialog.getContentElement( 'info', 'txtOptValue' );
-
-									var iIndex = CKEDITOR.plugins.forms.select.getSelectedIndex( values );
-									CKEDITOR.plugins.forms.select.setSelectedIndex( names, iIndex );
-
-									name.setValue( names.getValue() );
-									value.setValue( values.getValue() );
-								}
+								type : 'vbox',
+								padding : 0,
+								children :
+								[
+									{
+										id : 'txtOptValue',
+										type : 'text',
+										label : editor.lang.select.opValue,
+										style : 'width:100%;margin-bottom:10px;'
+									},
+									{
+										type : 'select',
+										id : 'cmbValue',
+										label : '',
+										multiple : true,
+										size : 5,
+										style : 'width:100%;margin-bottom:5px',
+										items : [],
+										onChange : function()
+										{
+											var dialog = this.getDialog();
+											var names = dialog.getContentElement( 'info', 'cmbName' );
+											var values = dialog.getContentElement( 'info', 'cmbValue' );
+
+											var name = dialog.getContentElement( 'info', 'txtOptName' );
+											var value = dialog.getContentElement( 'info', 'txtOptValue' );
+
+											var iIndex = plugin.getSelectedIndex( values );
+											plugin.setSelectedIndex( names, iIndex );
+
+											name.setValue( names.getValue() );
+											value.setValue( values.getValue() );
+										}
+									},
+								]
 							},
 							{
@@ -359,4 +322,51 @@
 								children :
 								[
+									{
+										type : 'button',
+										style : '',
+										label : editor.lang.select.btnAdd,
+										title : editor.lang.select.btnAdd,
+										style : 'width:100%;',
+										onClick : function()
+										{
+											//Add new option.
+											var dialog = this.getDialog();
+											var parentEditor = dialog.getParentEditor();
+											var name = dialog.getContentElement( 'info', 'txtOptName' );
+											var value = dialog.getContentElement( 'info', 'txtOptValue' );
+
+											var names = dialog.getContentElement( 'info', 'cmbName' );
+											var values = dialog.getContentElement( 'info', 'cmbValue' );
+
+											plugin.addOption(names, name.getValue(), name.getValue() );
+											plugin.addOption(values, value.getValue(), value.getValue() );
+
+											name.setValue( "" );
+											value.setValue( "" );
+										}
+									},
+									{
+										type : 'button',
+										label : editor.lang.select.btnModify,
+										title : editor.lang.select.btnModify,
+										style : 'width:100%;',
+										onClick : function()
+										{
+											//Modify selected option.
+											var dialog = this.getDialog();
+											var name = dialog.getContentElement( 'info', 'txtOptName' );
+											var value = dialog.getContentElement( 'info', 'txtOptValue' );
+
+											var names = dialog.getContentElement( 'info', 'cmbName' );
+											var values = dialog.getContentElement( 'info', 'cmbValue' );
+
+											var iIndex = plugin.getSelectedIndex( names );
+											if ( iIndex >= 0 )
+											{
+												plugin.modifyOption( names, iIndex, name.getValue(), name.getValue() );
+												plugin.modifyOption( values, iIndex, value.getValue(), value.getValue() );
+											}
+										}
+									},
 									{
 										type : 'button',
@@ -371,6 +381,6 @@
 											var values = dialog.getContentElement( 'info', 'cmbValue' );
 
-											CKEDITOR.plugins.forms.select.changeOptionPosition( names, -1 );
-											CKEDITOR.plugins.forms.select.changeOptionPosition( values, -1 );
+											plugin.changeOptionPosition( names, -1 );
+											plugin.changeOptionPosition( values, -1 );
 										}
 									},
@@ -387,6 +397,6 @@
 											var values = dialog.getContentElement( 'info', 'cmbValue' );
 
-											CKEDITOR.plugins.forms.select.changeOptionPosition( names, 1 );
-											CKEDITOR.plugins.forms.select.changeOptionPosition( values, 1 );
+											plugin.changeOptionPosition( names, 1 );
+											plugin.changeOptionPosition( values, 1 );
 										}
 									}
@@ -424,6 +434,6 @@
 									var values = dialog.getContentElement( 'info', 'cmbValue' );
 
-									CKEDITOR.plugins.forms.select.removeSelectedOptions( names );
-									CKEDITOR.plugins.forms.select.removeSelectedOptions( values );
+									plugin.removeSelectedOptions( names );
+									plugin.removeSelectedOptions( values );
 
 									var name = dialog.getContentElement( 'info', 'txtOptName' );
Index: /CKEditor/branches/prototype/_source/plugins/forms/dialogs/textarea.js
===================================================================
--- /CKEditor/branches/prototype/_source/plugins/forms/dialogs/textarea.js	(revision 2918)
+++ /CKEditor/branches/prototype/_source/plugins/forms/dialogs/textarea.js	(revision 2919)
@@ -32,5 +32,5 @@
 
 	// Function called in onShow to load selected element.
-	var loadLink = function( editor, selection, ranges, element )
+	var loadSelection = function( editor, selection, ranges, element )
 	{
 		this.saveSelection();
@@ -59,17 +59,4 @@
 		minWidth : 400,
 		minHeight : 230,
-		onOk : function( data )
-		{
-			this.editObj.setAttributes( this.changedAttibutes );
-
-			if ( this.editMode == false )
-			{
-				// It doesn't work with IE.
-				this.restoreSelection();
-				this.clearSavedSelection();
-				editor.insertElement( this.editObj );
-			}
-			return true;
-		},
 		onShow : function()
 		{
@@ -93,5 +80,5 @@
 				if ( element )
 				{
-					loadLink.apply( this, [ editor, selection, ranges, element ] );
+					loadSelection.apply( this, [ editor, selection, ranges, element ] );
 					selection.selectElement( element );
 				}
@@ -103,4 +90,16 @@
 			this.getContentElement( 'info', 'txtName' ).focus();
 			this.changedAttibutes = new Array();
+		},
+		onOk : function()
+		{
+			this.editObj.setAttributes( this.changedAttibutes );
+
+			if ( this.editMode == false )
+			{
+				this.restoreSelection();
+				this.clearSavedSelection();
+				editor.insertElement( this.editObj );
+			}
+			return true;
 		},
 		contents : [
Index: /CKEditor/branches/prototype/_source/plugins/forms/dialogs/textfield.js
===================================================================
--- /CKEditor/branches/prototype/_source/plugins/forms/dialogs/textfield.js	(revision 2918)
+++ /CKEditor/branches/prototype/_source/plugins/forms/dialogs/textfield.js	(revision 2919)
@@ -32,5 +32,5 @@
 
 	// Function called in onShow to load selected element.
-	var loadLink = function( editor, selection, ranges, element )
+	var loadSelection = function( editor, selection, ranges, element )
 	{
 		this.saveSelection();
@@ -55,5 +55,4 @@
 		return attributeValue;
 	}
-	
 	return {
 		title : editor.lang.textfield.title,
@@ -61,17 +60,5 @@
 		minWidth : 400,
 		minHeight : 230,
-		onOk : function()
-		{
-			this.editObj.setAttributes( this.changedAttibutes );
-
-			if ( this.editMode == false )
-			{
-				// It doesn't work with IE.
-				this.restoreSelection();
-				this.clearSavedSelection();
-				editor.insertElement( this.editObj );
-			}
-			return true;
-		},
+
 		onShow : function()
 		{
@@ -98,5 +85,5 @@
 					if ( type == "text" || type == null )
 					{
-						loadLink.apply( this, [ editor, selection, ranges, element ] );
+						loadSelection.apply( this, [ editor, selection, ranges, element ] );
 						selection.selectElement( element );
 					}
@@ -109,4 +96,16 @@
 			this.getContentElement( 'info', 'txtName' ).focus();
 			this.changedAttibutes = new Array();
+		},
+		onOk : function()
+		{
+			this.editObj.setAttributes( this.changedAttibutes );
+
+			if ( this.editMode == false )
+			{
+				this.restoreSelection();
+				this.clearSavedSelection();
+				editor.insertElement( this.editObj );
+			}
+			return true;
 		},
 		contents : [
Index: /CKEditor/branches/prototype/_source/plugins/forms/plugin.js
===================================================================
--- /CKEditor/branches/prototype/_source/plugins/forms/plugin.js	(revision 2918)
+++ /CKEditor/branches/prototype/_source/plugins/forms/plugin.js	(revision 2919)
@@ -115,4 +115,6 @@
 				oOption = document.createElement( "OPTION" );
 
+			oOption = this._getObject( oOption, false );
+			
 			if ( combo.$ && oOption.$ && oOption.$.tagName )
 			{
@@ -120,28 +122,9 @@
 				oOption.setText( optionText.length > 0 ? CKEDITOR.tools.htmlEncode( optionText ) : '' );
 				oOption.setValue( optionValue );
-				oOptionObj = oOption;	
-			}
-			else if ( combo )
-			{
-				if ( combo.$ )			//TODO: improve this case
-					combo = combo.$;
-
-				if ( oOption.$ && oOption.$.tagName )
-					oOptionObj = oOption.$;
-				else
-					oOptionObj = oOption;
-	
-				if ( !isNaN( parseInt( index, 10 ) ) )
-					combo.options.add( oOptionObj, index );
-				else
-					combo.options.add( oOptionObj );
-					
-				oOptionObj.innerHTML = optionText.length > 0 ? CKEDITOR.tools.htmlEncode( optionText ) : '';
-				oOptionObj.value     = optionValue;
 			}
 			else 
 				return false;
 				
-			return oOptionObj;
+			return oOption;
 		},
 
@@ -231,6 +214,15 @@
 		{
 			if ( obj ){
-				if ( obj.tagName && obj.tagName.toLowerCase() == 'select' )
-					return obj;
+				// Dialog element.
+				if ( obj.domId && obj.getInputElement().$ )
+					if ( getReal )
+						return obj.getInputElement().$;
+					else
+						return obj.getInputElement();
+				else if ( obj.tagName && ( obj.tagName.toLowerCase() == 'select' || obj.tagName.toLowerCase() == 'option' ) )
+					if ( getReal )
+						return obj;
+					else
+						return new CKEDITOR.dom.element( obj );
 				else if ( obj.$ )
 					if ( getReal )
@@ -238,9 +230,4 @@
 					else
 						return obj;
-				else if ( obj.domId && obj.getInputElement().$ )
-					if ( getReal )
-						return obj.getInputElement().$;
-					else
-						return obj.getInputElement();
 				return false;
 			}
