Index: editor/_source/internals/fck.js
===================================================================
--- editor/_source/internals/fck.js	(revision 1274)
+++ editor/_source/internals/fck.js	(working copy)
@@ -32,6 +32,15 @@
 	HasFocus		: false,
 	DataProcessor	: new FCKDataProcessor(),
 
+	GetInstanceObject	: (function()
+	{
+		var w = window ;
+		return function( name )
+		{
+			return w[name] ;
+		}
+	})(),
+
 	AttachToOnSelectionChange : function( functionPointer )
 	{
 		this.Events.AttachEvent( 'OnSelectionChange', functionPointer ) ;
Index: editor/_source/internals/fcktoolbarset.js
===================================================================
--- editor/_source/internals/fcktoolbarset.js	(revision 1274)
+++ editor/_source/internals/fcktoolbarset.js	(working copy)
@@ -107,6 +107,8 @@
 	}
 
 	oToolbarSet.CurrentInstance = FCK ;
+	if ( !oToolbarSet.ToolbarItems )
+		oToolbarSet.ToolbarItems = FCKToolbarItems ;
 
 	FCK.AttachToOnSelectionChange( oToolbarSet.RefreshItemsState ) ;
 
Index: editor/_source/commandclasses/fcktextcolorcommand.js
===================================================================
--- editor/_source/commandclasses/fcktextcolorcommand.js	(revision 1274)
+++ editor/_source/commandclasses/fcktextcolorcommand.js	(working copy)
@@ -42,6 +42,7 @@
 	this._Panel.AppendStyleSheet( FCKConfig.SkinPath + 'fck_editor.css' ) ;
 	this._Panel.MainNode.className = 'FCK_Panel' ;
 	this._CreatePanelBody( this._Panel.Document, this._Panel.MainNode ) ;
+	FCK.ToolbarSet.ToolbarItems.GetItem( this.Name ).RegisterPanel( this._Panel ) ;
 
 	FCKTools.DisableSelection( this._Panel.Document.body ) ;
 }
Index: editor/_source/classes/fcktoolbarpanelbutton.js
===================================================================
--- editor/_source/classes/fcktoolbarpanelbutton.js	(revision 1274)
+++ editor/_source/classes/fcktoolbarpanelbutton.js	(working copy)
@@ -48,13 +48,21 @@
 	this._UIButton.Create( parentElement ) ;
 
 	var oPanel = FCK.ToolbarSet.CurrentInstance.Commands.GetCommand( this.CommandName )._Panel ;
+	this.RegisterPanel( oPanel ) ;
+}
+
+FCKToolbarPanelButton.prototype.RegisterPanel = function( oPanel )
+{
+	if ( oPanel._FCKToolbarPanelButton )
+		return ;
+
 	oPanel._FCKToolbarPanelButton = this ;
 
 	var eLineDiv = oPanel.Document.body.appendChild( oPanel.Document.createElement( 'div' ) ) ;
 	eLineDiv.style.position = 'absolute' ;
 	eLineDiv.style.top = '0px' ;
 
-	var eLine = this.LineImg = eLineDiv.appendChild( oPanel.Document.createElement( 'IMG' ) ) ;
+	var eLine = oPanel._FCKToolbarPanelButtonLineDiv = eLineDiv.appendChild( oPanel.Document.createElement( 'IMG' ) ) ;
 	eLine.className = 'TB_ConnectionLine' ;
 	eLine.style.position = 'absolute' ;
 //	eLine.style.backgroundColor = 'Red' ;
@@ -74,9 +82,12 @@
 
 	oButton._UIButton.ChangeState( FCK_TRISTATE_ON ) ;
 
-	oButton.LineImg.style.width = ( e.offsetWidth - 2 ) + 'px' ;
+	// oButton.LineImg.style.width = ( e.offsetWidth - 2 ) + 'px' ;
 
-	FCK.ToolbarSet.CurrentInstance.Commands.GetCommand( oButton.CommandName ).Execute( 0, e.offsetHeight - 1, e ) ; // -1 to be over the border
+	var oCommand = FCK.ToolbarSet.CurrentInstance.Commands.GetCommand( oButton.CommandName ) ;
+	var oPanel = oCommand._Panel ;
+	oPanel._FCKToolbarPanelButtonLineDiv.style.width = ( e.offsetWidth - 2 ) + 'px' ;
+	oCommand.Execute( 0, e.offsetHeight - 1, e ) ; // -1 to be over the border
 }
 
 function FCKToolbarPanelButton_OnPanelHide()
Index: editor/_source/classes/fckpanel.js
===================================================================
--- editor/_source/classes/fckpanel.js	(revision 1274)
+++ editor/_source/classes/fckpanel.js	(working copy)
@@ -64,24 +64,7 @@
 				zIndex		: FCKConfig.FloatingPanelsZIndex
 			} ) ;
 
-		if ( this._Window == window.parent && window.frameElement )
-		{
-			var scrollPos = null ;
-			if ( FCKBrowserInfo.IsGecko && FCK && FCK.EditorDocument )
-				scrollPos = [ FCK.EditorDocument.body.scrollLeft, FCK.EditorDocument.body.scrollTop ] ;
-			window.frameElement.parentNode.insertBefore( oIFrame, window.frameElement ) ;
-			if ( scrollPos )
-			{
-				var restoreFunc = function()
-				{
-					FCK.EditorDocument.body.scrollLeft = scrollPos[0] ;
-					FCK.EditorDocument.body.scrollTop = scrollPos[1] ;
-				}
-				setTimeout( restoreFunc, 500 ) ;
-			}
-		}
-		else
-			this._Window.document.body.appendChild( oIFrame ) ;
+		this._Window.document.body.appendChild( oIFrame ) ;
 
 		var oIFrameWindow = oIFrame.contentWindow ;
 
@@ -187,8 +170,11 @@
 		}
 
 		// Be sure we'll not have more than one Panel opened at the same time.
-		if ( FCKPanel._OpenedPanel )
-			FCKPanel._OpenedPanel.Hide() ;
+		// Do not unlock focus manager here because we're displaying another floating panel
+		// instead of returning the editor to a "no panel" state (Bug #1514).
+		if ( FCK.ToolbarSet.CurrentInstance.GetInstanceObject( 'FCKPanel' )._OpenedPanel && 
+				FCK.ToolbarSet.CurrentInstance.GetInstanceObject( 'FCKPanel' )._OpenedPanel != this )
+			FCK.ToolbarSet.CurrentInstance.GetInstanceObject( 'FCKPanel' )._OpenedPanel.Hide( false, true ) ;
 
 		FCKDomTools.SetElementStyles( eMainNode,
 			{
@@ -253,9 +239,6 @@
 				y -= y + eMainNode.offsetHeight - iViewPaneHeight ;
 		}
 
-		if ( x < 0 )
-			 x = 0 ;
-
 		// Set the context menu DIV in the specified location.
 		FCKDomTools.SetElementStyles( this._IFrame,
 			{
@@ -263,16 +246,20 @@
 				top		: y + 'px'
 			} ) ;
 
-		var iWidth	= iMainWidth ;
-		var iHeight	= eMainNode.offsetHeight ;
+		var me = this ;
+		var resizeFunc = function()
+		{
+			var iWidth = eMainNode.offsetWidth || eMainNode.firstChild.offsetWidth ;
+			var iHeight = eMainNode.offsetHeight ;
+			me._IFrame.width = iWidth ;
+			me._IFrame.height = iHeight ;
+		}
+		setTimeout( resizeFunc, 1 ) ;
 
-		this._IFrame.width	= iWidth ;
-		this._IFrame.height = iHeight ;
-
 		// Move the focus to the IFRAME so we catch the "onblur".
 		this._IFrame.contentWindow.focus() ;
 
-		FCKPanel._OpenedPanel = this ;
+		FCK.ToolbarSet.CurrentInstance.GetInstanceObject( 'FCKPanel' )._OpenedPanel = this ;
 	}
 
 	this._IsOpened = true ;
@@ -280,7 +267,7 @@
 	FCKTools.RunFunction( this.OnShow, this ) ;
 }
 
-FCKPanel.prototype.Hide = function( ignoreOnHide )
+FCKPanel.prototype.Hide = function( ignoreOnHide, ignoreFocusManagerUnlock )
 {
 	if ( this._Popup )
 		this._Popup.hide() ;
@@ -290,7 +277,7 @@
 			return ;
 
 		// Enable the editor to fire the "OnBlur".
-		if ( typeof( FCKFocusManager ) != 'undefined' )
+		if ( typeof( FCKFocusManager ) != 'undefined' && !ignoreFocusManagerUnlock )
 			FCKFocusManager.Unlock() ;
 
 		// It is better to set the sizes to 0, otherwise Firefox would have
