Index: /FCKeditor/branches/features/floating_dialog/editor/fckdialog.html
===================================================================
--- /FCKeditor/branches/features/floating_dialog/editor/fckdialog.html	(revision 1249)
+++ /FCKeditor/branches/features/floating_dialog/editor/fckdialog.html	(revision 1250)
@@ -28,26 +28,24 @@
 		<meta name="robots" content="noindex, nofollow" />
 		<script type="text/javascript">
-// Get the dialog arguments and the dialog frame from parent window
-$ = {} ;
-$.args = frameElement._DialogArguments ;
-$.editor = $.args.Editor ;
-var imports = [ 'FCK', 'FCKTools', 'FCKDomTools', 'FCKDialog', 'FCKBrowserInfo', 'FCKConfig' ];
-for ( var i = 0 ; i < imports.length ; i++ )
-	$[imports[i]] = $.editor[imports[i]] ;
-
-// Prevent memory leaks in IE.
-if ( $.FCKBrowserInfo.IsIE )
-{
-	function Window_OnBeforeUnload()
-	{
-		$ = null ;
-	}
-	window.attachEvent( "onbeforeunload", Window_OnBeforeUnload ) ;
-}
-
-// Make sure the caret does not stay in the editor iframe.
-window.focus() ;
-
-// Automatically detect the correct document.domain (#123).
+// It seems referencing to frameElement._DialogArguments directly would lead to memory leaks in IE.
+// So let's use functions to access its members instead.
+function Args()
+{
+	return frameElement._DialogArguments ;
+}
+
+function Editor()
+{
+	return Args().Editor ;
+}
+
+var FCK			= Editor().FCK ;
+var FCKTools		= Editor().FCKTools ;
+var FCKDomTools		= Editor().FCKDomTools ;
+var FCKDialog		= Editor().FCKDialog ;
+var FCKBrowserInfo	= Editor().FCKBrowserInfo ;
+var FCKConfig		= Editor().FCKConfig ;
+
+// Domain relaxation logic.
 (function()
 {
@@ -59,5 +57,5 @@
 		try
 		{
-			var parentDomain = $.args.TopWindow ? $.args.TopWindow.document.domain : $.editor.document.domain ;
+			var parentDomain = frameElement._DialogArguments.TopWindow ? frameElement._DialogArguments.TopWindow.document.domain : frameElement._DialogArguments.Editor.document.domain ;
 
 			if ( document.domain != parentDomain )
@@ -77,13 +75,25 @@
 })() ;
 
+// Steal the focus so that the caret would no longer stay in the editor iframe.
+window.focus() ;
+
 // Sets the Skin CSS
-document.write( '<link href="' + $.FCKConfig.SkinPath + 'fck_dialog.css" type="text/css" rel="stylesheet">' ) ;
+document.write( '<link href="' + FCKConfig.SkinPath + 'fck_dialog.css" type="text/css" rel="stylesheet">' ) ;
 
 // Sets the language direction.
-document.dir = $.editor.FCKLang.Dir ;
+window.document.dir = Editor().FCKLang.Dir ;
+
+if ( FCKBrowserInfo.IsIE )
+{
+	// IE does not set the window name in showModalDialog(), let's set it here.
+	window.name = Args().DialogName ;
+
+	// For IE6-, the fck_dialog_ie6.js is loaded, used to fix limitations in the browser.
+	if ( !FCKBrowserInfo.IsIE7 )
+		document.write( '<' + 'script type="text/javascript" src="' + FCKConfig.SkinPath + 'fck_dialog_ie6.js"><' + '\/script>' ) ;
+}
 
 		</script>
 		<!-- script type="text/javascript">
-
 // Get the dialog arguments and the dialog frame from parent window
 var dialogFrame	= window.frameElement ;
Index: /FCKeditor/branches/features/floating_dialog/editor/skins/default/fck_dialog_ie6.js
===================================================================
--- /FCKeditor/branches/features/floating_dialog/editor/skins/default/fck_dialog_ie6.js	(revision 1249)
+++ /FCKeditor/branches/features/floating_dialog/editor/skins/default/fck_dialog_ie6.js	(revision 1250)
Index: /FCKeditor/branches/features/floating_dialog/test_results
===================================================================
--- /FCKeditor/branches/features/floating_dialog/test_results	(revision 1250)
+++ /FCKeditor/branches/features/floating_dialog/test_results	(revision 1250)
@@ -0,0 +1,8 @@
+Methodology: Open the FCKDialog leak test for at least 3 minutes, see if the memory usage plataus or increases.
+
+Tests:
+1. Disabled all JavaScript from fckdialog.html/No noticeable increase.
+2. Added domain relaxation script without local references/No noticeable increase or very very slight increase after 10 minutes.
+3. Turn Args() and Editor() into functions, add FCK* references/No noticeable increase or very very slight increase after 10 minutes.
+4. Added window.focus(), fck_dialog.css, and language direction/No noticeable increase after 10 minutes.
+5. Added fck_dialog_ie6.js/Steadily increasing memory usage
