Index: /FCKeditor/branches/features/floating_dialog/_test/manual/fckdialog/test1.html
===================================================================
--- /FCKeditor/branches/features/floating_dialog/_test/manual/fckdialog/test1.html	(revision 1256)
+++ /FCKeditor/branches/features/floating_dialog/_test/manual/fckdialog/test1.html	(revision 1257)
@@ -56,5 +56,5 @@
 {
 	if ( OpenDialog )
-		FCKeditorAPI.GetInstance( 'FCKeditor1' ).Commands.GetCommand( 'Smiley' ).Execute() ;
+		FCKeditorAPI.GetInstance( 'FCKeditor1' ).Commands.GetCommand( 'About' ).Execute() ;
 	else
 	{
Index: /FCKeditor/branches/features/floating_dialog/editor/fckdialog.html
===================================================================
--- /FCKeditor/branches/features/floating_dialog/editor/fckdialog.html	(revision 1256)
+++ /FCKeditor/branches/features/floating_dialog/editor/fckdialog.html	(revision 1257)
@@ -423,4 +423,96 @@
 }() ;
 
+// Tab related functions.
+var Tabs = function()
+{
+	// Only element ids should be stored here instead of element references since setSelectedTab and TabDiv_OnClick
+	// would build circular references with the element references inside and cause memory leaks in IE6.
+	var oTabs = new Object() ;
+
+	var setSelectedTab = function( tabCode )
+	{
+		for ( var sCode in oTabs )
+		{
+			if ( sCode == tabCode )
+				$( oTabs[sCode] ).className = 'DialogTabSelected' ;
+			else
+				$( oTabs[sCode] ).className = 'DialogTab' ;
+		}
+
+		if ( typeof( window.frames["frmMain"].OnDialogTabChange ) == 'function' )
+			window.frames["frmMain"].OnDialogTabChange( tabCode ) ;
+	}
+
+	function TabDiv_OnClick()
+	{
+		setSelectedTab( this.TabCode ) ;
+	}
+
+	var retval = 
+	{
+		AddTab : function( tabCode, tabText, startHidden )
+		{
+			if ( typeof( oTabs[ tabCode ] ) != 'undefined' )
+				return ;
+
+			var eTabsRow = $( 'Tabs' ) ;
+
+			var oCell = eTabsRow.insertCell(  eTabsRow.cells.length - 1 ) ;
+			oCell.noWrap = true ;
+
+			var oDiv = document.createElement( 'DIV' ) ;
+			oDiv.className = 'DialogTab' ;
+			oDiv.innerHTML = tabText ;
+			oDiv.TabCode = tabCode ;
+			oDiv.onclick = TabDiv_OnClick ;
+			oDiv.id = Math.random() ;
+
+			if ( startHidden )
+				oDiv.style.display = 'none' ;
+
+			eTabsRow = $( 'TabsRow' ) ;
+
+			oCell.appendChild( oDiv ) ;
+
+			if ( eTabsRow.style.display == 'none' )
+			{
+				var eTitleArea = $( 'TitleArea' ) ;
+				eTitleArea.className = 'DialogTitle' ;
+
+				oDiv.className = 'DialogTabSelected' ;
+				eTabsRow.style.display = '' ;
+
+				if ( window.onresize )
+					window.onresize() ;
+			}
+
+			oTabs[ tabCode ] = oDiv.id ;
+
+			FCKTools.DisableSelection( oDiv ) ;
+		},
+
+		SetSelectedTab : setSelectedTab,
+
+		SetTabVisibility : function( tabCode, isVisible )
+		{
+			var oTab = $( oTabs[ tabCode ] ) ;
+			oTab.style.display = isVisible ? '' : 'none' ;
+
+			if ( ! isVisible && oTab.className == 'DialogTabSelected' )
+			{
+				for ( var sCode in oTabs )
+				{
+					if ( $( oTabs[sCode] ).style.display != 'none' )
+					{
+						setSelectedTab( sCode ) ;
+						break ;
+					}
+				}
+			}
+		}
+	}
+	return retval ;
+}() ;
+
 // The business logic of the dialog, dealing with operational things like dialog open/dialog close/enable/disable/etc.
 var Main = function()
@@ -428,5 +520,8 @@
 	// Unlock focus manager for non-IE browsers.
 	if ( window.addEventListener )
-		window.addEventListener( 'unload', function(){ Editor().FCKFocusManager.Unlock() ; }, false ) ;
+	{
+		var editorRef = Editor() ;
+		window.addEventListener( 'unload', function(){ editorRef.FCKFocusManager.Unlock() ; }, false ) ;
+	}
 
 
@@ -436,5 +531,5 @@
 		if ( this.readyState != 'complete' )
 			return ;
-		// DragAndDrop.RegisterHandlers( this.contentWindow ) ;
+		DragAndDrop.RegisterHandlers( this.contentWindow ) ;
 	}
 
@@ -453,9 +548,9 @@
 			// Make the title area draggable.
 			var titleElement = $( 'header' ) ;
-			// titleElement.onmousedown = DragAndDrop.MouseDownHandler ;
+			titleElement.onmousedown = DragAndDrop.MouseDownHandler ;
 
 			// Connect mousemove and mouseup events from dialog frame and outer window to dialog dragging logic.
-			// DragAndDrop.RegisterHandlers( window ) ;
-			// DragAndDrop.RegisterHandlers( Args().TopWindow ) ;
+			DragAndDrop.RegisterHandlers( window ) ;
+			DragAndDrop.RegisterHandlers( Args().TopWindow ) ;
 
 			// Disable the previous dialog if it exists.
@@ -469,10 +564,8 @@
 					{
 						var blockerFrame = currentParent.contentWindow.$( 'blocker' ) ;
-						/*
 						if ( blockerFrame.readyState == 'complete' )
 							DragAndDrop.RegisterHandlers( blockerFrame.contentWindow ) ;
 						else
 							blockerFrame.onreadystatechange = onReadyRegister ;
-						*/
 						currentParent = ParentDialog( currentParent ) ;
 					}
@@ -483,5 +576,5 @@
 					while ( currentParent )
 					{
-						// DragAndDrop.RegisterHandlers( currentParent.contentWindow ) ;
+						DragAndDrop.RegisterHandlers( currentParent.contentWindow ) ;
 						currentParent = ParentDialog( currentParent ) ;
 					}
@@ -493,10 +586,8 @@
 			{
 				var blockerFrame = FCKDialog.GetCover().firstChild ;
-				/*
 				if ( blockerFrame.readyState == 'complete' )
 					DragAndDrop.RegisterHandlers( blockerFrame.contentWindow ) ;
 				else
 					blockerFrame.onreadystatechange = onReadyRegister;
-				*/
 			}
 		},
@@ -540,5 +631,5 @@
 			Sizer.RefreshContainerSize();
 
-			// DragAndDrop.RegisterHandlers( innerWindow ) ;
+			DragAndDrop.RegisterHandlers( innerWindow ) ;
 			
 			innerWindow.focus() ;
@@ -629,5 +720,8 @@
 		[ Selection, 'EnsureSelection' ],
 		[ Selection, 'GetSelection' ],
-		[ Selection, 'GetSelectedElement' ]
+		[ Selection, 'GetSelectedElement' ],
+		[ Tabs, 'AddTab' ],
+		[ Tabs, 'SetSelectedTab' ],
+		[ Tabs, 'SetTabVisibility' ]
 	] ;
 	for ( var i = 0 ; i < APIs.length ; i++ )
Index: /FCKeditor/branches/features/floating_dialog/test_results
===================================================================
--- /FCKeditor/branches/features/floating_dialog/test_results	(revision 1256)
+++ /FCKeditor/branches/features/floating_dialog/test_results	(revision 1257)
@@ -9,4 +9,5 @@
 6. Added Init(), Throbber(), ResizeContainerSize()/No noticeable increase after 10 minutes. 
 7. Added all resize logic, LoadInnerDialog() and InnerDialogLoaded(), created the Sizer and Main modules/No noticeable increase after 10 minutes.
-8. Added drag and drop handlers/Slowly increasing
-9. Added logic for closing dialogs, cover blocks, disabling and enabling dialogs, and selection handler/???.
+8. Added drag and drop handlers/No noticeable increase (But I swear I saw it increasing eariler, with the same code!?!!)
+9. Added logic for closing dialogs, cover blocks, disabling and enabling dialogs, and selection handler/No noticeable increase.
+10. Added logic for handling tabs/No noticeable increase.
