Index: /FCKeditor/branches/features/floating_dialog/editor/fckdebug.html
===================================================================
--- /FCKeditor/branches/features/floating_dialog/editor/fckdebug.html	(revision 1194)
+++ /FCKeditor/branches/features/floating_dialog/editor/fckdebug.html	(revision 1195)
@@ -31,4 +31,32 @@
 var oWindow ;
 var oDiv ;
+
+// Automatically detect the correct document.domain (#123).
+(function()
+{
+	var d = document.domain ;
+
+	while ( true )
+	{
+		// Test if we can access a parent property.
+		try
+		{
+			var parentDomain = window.opener.document.domain ;
+
+			if ( document.domain != parentDomain )
+				document.domain = parentDomain ;
+			break ;
+		}
+		catch( e ) {}
+
+		// Remove a domain part: www.mytest.example.com => mytest.example.com => example.com ...
+		d = d.replace( /.*?(?:\.|$)/, '' ) ;
+
+		if ( d.length == 0 )
+			break ;         // It was not able to detect the domain.
+
+		document.domain = d ;
+	}
+})();
 
 if ( !window.FCKMessages )
