Index: /FCKeditor/branches/features/floating_dialog/editor/_source/internals/fck.js
===================================================================
--- /FCKeditor/branches/features/floating_dialog/editor/_source/internals/fck.js	(revision 1057)
+++ /FCKeditor/branches/features/floating_dialog/editor/_source/internals/fck.js	(revision 1058)
@@ -765,15 +765,18 @@
 			FCKDomTools.SetOpacity( this.EditorBlocker, 0.5 ) ;
 			editorParentElement.style.overflow = 'visible' ;
+			var frameWidth = editorFrame.offsetWidth ;
+			var frameHeight = editorFrame.offsetHeight ;
 			FCKDomTools.SetElementStyles( editorFrame,
 				{
 					'zIndex' : 100,
-					'width' : editorFrame.offsetWidth + 'px',
-					'height' : editorFrame.offsetHeight + 'px',
+					'width' : frameWidth + 'px',
+					'height' : frameHeight + 'px',
 					'position' : 'absolute'
 				} ) ;
 			FCKDomTools.SetElementStyles( editorParentElement, 
 				{
-					'width' : editorFrame.offsetWidth + 'px',
-					'height' : editorFrame.offsetHeight + 'px'
+					'width' : frameWidth + 'px',
+					'height' : frameHeight + 'px',
+					'position' : 'relative'
 				} ) ;
 			editorParentElement.appendChild( this.BackgroundBlocker ) ;
@@ -784,25 +787,39 @@
 		{
 			var parentDivPosition = FCKTools.GetDocumentPosition( this.Window.parent, editorParentElement ) ;
-			var positionedAncestor = FCKDomTools.GetPositionedAncestor( this.Window.parent, editorParentElement.parentNode ) ;
-			var positionedAncestorPosition = positionedAncestor ? 
-				FCKTools.GetDocumentPosition( this.Window.parent, positionedAncestor ) : 
-				{'x' : 0, 'y' : 0} ;
 			FCKDomTools.SetElementStyles( this.EditorBlocker,
 				{
 					'width' : editorFrame.offsetWidth + 'px',
 					'height' : editorFrame.offsetHeight + 'px',
-					'left' : ( parentDivPosition.x - positionedAncestorPosition.x ) + 'px',
-					'top' : ( parentDivPosition.y - positionedAncestorPosition.y ) + 'px',
+					'left' : '0px',
+					'top' : '0px',
 					'display' : ''
 				} ) ;
+			FCKDebug.Output( 'width: ' + doc.documentElement.scrollWidth + ':' + doc.documentElement.clientWidth + ':'
+					+ doc.body.scrollWidth ) ;
+			FCKDebug.Output( 'height: ' + doc.documentElement.scrollHeight + ':' + doc.documentElement.clientHeight + ':'
+					+ doc.body.scrollHeight ) ;
 			FCKDomTools.SetElementStyles( this.BackgroundBlocker,
 				{
-					'width' : Math.max( doc.documentElement.scrollWidth, doc.documentElement.clientWidth ) + 'px',
-					'height' : Math.max( doc.documentElement.scrollHeight, doc.documentElement.clientHeight ) + 'px',
-					'left' : ( -1 * positionedAncestorPosition.x ) + 'px',
-					'top' : ( -1 * positionedAncestorPosition.y ) + 'px',
+					'width' : Math.max( doc.documentElement.scrollWidth, 
+						doc.documentElement.clientWidth,
+						doc.body.scrollWidth ) -1 + 'px',
+					'height' : Math.max( doc.documentElement.scrollHeight,
+						doc.documentElement.clientHeight,
+						doc.body.scrollHeight ) -1 + 'px',
+					'left' : ( -1 * parentDivPosition.x ) + 'px',
+					'top' : ( -1 * parentDivPosition.y ) + 'px',
 					'display' : ''
 				} ) ;
 			this.EditorBlocker.focus() ;
+
+			var currentElement = editorFrame ;
+			while ( ( currentElement = currentElement.parentNode ) )
+			{
+				if ( currentElement.nodeType == 1 )
+				{
+					currentElement._fckPreviousZIndex = currentElement.style.zIndex ? currentElement.style.zIndex : '' ;
+					currentElement.style.zIndex = FCKConfig.FloatingPanelsZIndex - 1 ;
+				}
+			}
 		}
 		else
@@ -819,4 +836,15 @@
 					'top' : '-10000px'
 				} ) ;
+
+			var currentElement = editorFrame ;
+			while ( ( currentElement = currentElement.parentNode ) )
+			{
+				if ( currentElement.nodeType == 1 && currentElement._fckPreviousZIndex != undefined )
+				{
+					currentElement.style.zIndex = currentElement._fckPreviousZIndex ;
+					FCKDomTools.ClearElementJSProperty( currentElement, '_fckPreviousZIndex' ) ;
+				}
+			}
+
 		}
 	}
Index: /FCKeditor/branches/features/floating_dialog/editor/_source/internals/fckdialog.js
===================================================================
--- /FCKeditor/branches/features/floating_dialog/editor/_source/internals/fckdialog.js	(revision 1057)
+++ /FCKeditor/branches/features/floating_dialog/editor/_source/internals/fckdialog.js	(revision 1058)
@@ -42,5 +42,5 @@
 	if ( FCKBrowserInfo.IsIE )
 	{
-		var oSel = FCK.EditorDocument.selection ;
+		var oSel = FCK.ToolbarSet.CurrentInstance.EditorDocument.selection ;
 		var bInvalidRange = false ;
 
@@ -51,7 +51,7 @@
 		if ( !oRange )
 			bInvalidRange = true ;
-		if ( oRange.parentElement && oRange.parentElement().ownerDocument != FCK.EditorDocument )
-			bInvalidRange = true ;
-		if ( oRange.item && oRange.item(0).ownerDocument != FCK.EditorDocument )
+		if ( oRange.parentElement && oRange.parentElement().ownerDocument != FCK.ToolbarSet.CurrentInstance.EditorDocument )
+			bInvalidRange = true ;
+		if ( oRange.item && oRange.item(0).ownerDocument != FCK.ToolbarSet.CurrentInstance.EditorDocument )
 			bInvalidRange = true ;
 
@@ -71,5 +71,5 @@
 FCKDialog.Show = function( dialogInfo, dialogName, pageUrl, dialogWidth, dialogHeight, parentWindow, resizable )
 {
-	var ownerWindow = FCK.Window.parent ;
+	var ownerWindow = FCK.ToolbarSet.CurrentInstance.Window.parent ;
 	var ownerDocument = ownerWindow.document ;
 	var innerWidth = FCKBrowserInfo.IsIE ? ownerDocument.documentElement.offsetWidth : ownerWindow.innerWidth;
@@ -130,5 +130,5 @@
 	// if this is the first dialog in the dialog stack.
 	if ( this.DialogStack.length == 0 )
-		FCK.SetDialogMode( true ) ;
+		FCK.ToolbarSet.CurrentInstance.SetDialogMode( true ) ;
 	this.DialogStack.push( container ) ;
 }
@@ -234,4 +234,4 @@
 	this.DialogStack.pop() ;
 	if ( this.DialogStack.length == 0)
-		FCK.SetDialogMode( false ) ;
-}
+		FCK.ToolbarSet.CurrentInstance.SetDialogMode( false ) ;
+}
Index: /FCKeditor/branches/features/floating_dialog/editor/_source/internals/fcktools.js
===================================================================
--- /FCKeditor/branches/features/floating_dialog/editor/_source/internals/fcktools.js	(revision 1057)
+++ /FCKeditor/branches/features/floating_dialog/editor/_source/internals/fcktools.js	(revision 1058)
@@ -424,5 +424,5 @@
 	var y = 0 ;
 	var curNode = node ;
-	while ( curNode && curNode != w.document.documentElement )
+	while ( curNode && curNode != w.document.body )
 	{
 		x += curNode.offsetLeft - curNode.scrollLeft ;
