Index: /FCKeditor/trunk/editor/_source/classes/fckpanel.js
===================================================================
--- /FCKeditor/trunk/editor/_source/classes/fckpanel.js	(revision 1128)
+++ /FCKeditor/trunk/editor/_source/classes/fckpanel.js	(revision 1129)
@@ -27,4 +27,6 @@
 	this.IsRTL			= ( FCKLang.Dir == 'rtl' ) ;
 	this.IsContextMenu	= false ;
+	this.PanelListId	= parseInt(Math.random() * 0x100000000);
+	this.ShowTimestamp	= 0 ;
 	this._LockCounter	= 0 ;
 
@@ -125,4 +127,6 @@
 	var iMainWidth ;
 	var eMainNode = this.MainNode ;
+	FCK.ToolbarSet.CurrentInstance.OpenedPanels[this.PanelListId] = this ;
+	this.ShowTimestamp = (new Date()).getTime() ;
 
 	if ( this._Popup )
@@ -165,6 +169,8 @@
 	{
 		// Be sure we'll not have more than one Panel opened at the same time.
+		/*
 		if ( FCKPanel._OpenedPanel )
 			FCKPanel._OpenedPanel.Hide() ;
+		*/
 
 		// Do not fire OnBlur while the panel is opened.
@@ -257,5 +263,5 @@
 		this._IFrame.contentWindow.focus() ;
 
-		FCKPanel._OpenedPanel = this ;
+		//FCKPanel._OpenedPanel = this ;
 	}
 
@@ -290,4 +296,6 @@
 			FCKTools.RunFunction( this.OnHide, this ) ;
 	}
+
+	delete FCK.ToolbarSet.CurrentInstance.OpenedPanels[this.PanelListId] ;
 }
 
@@ -336,4 +344,18 @@
 }
 
+function FCKPanel_Global_OnClick( e, panelList )
+{
+	var currentTimestamp = (new Date()).getTime() ;
+	for ( var i in panelList )
+	{
+		// The timestamp check is needed because of a possible race condition,
+		// in which the global onclick handler is called right after FCKPanel.Show().
+		if ( panelList[i].ShowTimestamp < currentTimestamp - 100 )
+			FCKPanel_Window_OnBlur( e, panelList[i] ) ;
+	}
+}
+
+FCKPanel_Global_OnBlur = FCKPanel_Global_OnClick ;
+
 function CheckPopupOnHide( forceHide )
 {
@@ -353,3 +375,4 @@
 	this.Document = null ;
 	this.MainNode = null ;
-}
+	delete FCK.ToolbarSet.CurrentInstance.OpenedPanels[this.PanelListId] ;
+}
Index: /FCKeditor/trunk/editor/_source/internals/fck.js
===================================================================
--- /FCKeditor/trunk/editor/_source/internals/fck.js	(revision 1128)
+++ /FCKeditor/trunk/editor/_source/internals/fck.js	(revision 1129)
@@ -31,5 +31,6 @@
 	Toolbar			: null,
 	HasFocus		: false,
-	DataProcessor	: new FCKDataProcessor(),
+	DataProcessor		: new FCKDataProcessor(),
+	OpenedPanels		: {},
 
 	AttachToOnSelectionChange : function( functionPointer )
@@ -882,4 +883,7 @@
 	FCKCommands.GetCommand( 'ShowBlocks' ).RestoreState() ;
 
+	FCKTools.AddEventListenerEx( FCK.EditorDocument, 'click', FCKPanel_Global_OnClick, FCK.ToolbarSet.CurrentInstance.OpenedPanels ) ;
+	FCKTools.AddEventListenerEx( FCK.EditorDocument, 'blur', FCKPanel_Global_OnBlur, FCK.ToolbarSet.CurrentInstance.OpenedPanels ) ;
+
 	// Check if it is not a startup call, otherwise complete the startup.
 	if ( FCK.Status != FCK_STATUS_NOTLOADED )
@@ -888,4 +892,7 @@
 	if ( FCKConfig.Debug )
 		FCKDebug._GetWindow() ;
+
+	FCKTools.AddEventListenerEx( document, 'click', FCKPanel_Global_OnClick, FCK.ToolbarSet.CurrentInstance.OpenedPanels );
+	FCKTools.AddEventListenerEx( document, 'blur', FCKPanel_Global_OnBlur, FCK.ToolbarSet.CurrentInstance.OpenedPanels ) ;
 
 	FCK.SetStatus( FCK_STATUS_ACTIVE ) ;
