Index: /FCKeditor/trunk/editor/_source/internals/fckundo.js
===================================================================
--- /FCKeditor/trunk/editor/_source/internals/fckundo.js	(revision 409)
+++ /FCKeditor/trunk/editor/_source/internals/fckundo.js	(revision 410)
@@ -88,6 +88,6 @@
 	// Assume the editor content is changed when SaveUndoStep() is called after the first time.
 	// This also enables the undo button in toolbar.
-	if ( FCKUndo.SavedData.length )
-		FCKUndo.Changed = true ;
+	if ( this.SavedData.length )
+		this.Changed = true ;
 
 	// Get the HTML content.
@@ -95,13 +95,13 @@
 
 	// Shrink the array to the current level.
-	FCKUndo.SavedData = FCKUndo.SavedData.slice( 0, FCKUndo.CurrentIndex + 1 ) ;
+	this.SavedData = this.SavedData.slice( 0, this.CurrentIndex + 1 ) ;
 
 	// Cancel operation if the new step is identical to the previous one.
-	if ( FCKUndo.CurrentIndex > 0 && sHtml == FCKUndo.SavedData[ FCKUndo.CurrentIndex ][0] )
+	if ( this.CurrentIndex > 0 && sHtml == this.SavedData[ this.CurrentIndex ][0] )
 		return ;
 	// Save the selection and caret position in the first undo level for the first change.
-	else if ( FCKUndo.CurrentIndex == 0 && sHtml == FCKUndo.SavedData[0][0] )
+	else if ( this.CurrentIndex == 0 && sHtml == this.SavedData[0][0] )
 	{
-		FCKUndo.SavedData[0][1] = FCKUndo._GetBookmark() ;
+		this.SavedData[0][1] = this._GetBookmark() ;
 		return ;
 	}
@@ -109,11 +109,11 @@
 	// If we reach the Maximun number of undo levels, we must remove the first
 	// entry of the list shifting all elements.
-	if ( FCKUndo.CurrentIndex + 1 >= FCKConfig.MaxUndoLevels )
-		FCKUndo.SavedData.shift() ;
+	if ( this.CurrentIndex + 1 >= FCKConfig.MaxUndoLevels )
+		this.SavedData.shift() ;
 	else
-		FCKUndo.CurrentIndex++ ;
+		this.CurrentIndex++ ;
 
 	// Save the new level in front of the actual position.
-	FCKUndo.SavedData[ FCKUndo.CurrentIndex ] = [ sHtml, FCKUndo._GetBookmark() ] ;
+	this.SavedData[ this.CurrentIndex ] = [ sHtml, this._GetBookmark() ] ;
 
 	FCK.Events.FireEvent( "OnSelectionChange" ) ;
@@ -122,25 +122,25 @@
 FCKUndo.CheckUndoState = function()
 {
-	return ( FCKUndo.Changed || FCKUndo.CurrentIndex > 0 ) ;
+	return ( this.Changed || this.CurrentIndex > 0 ) ;
 }
 
 FCKUndo.CheckRedoState = function()
 {
-	return ( FCKUndo.CurrentIndex < ( FCKUndo.SavedData.length - 1 ) ) ;
+	return ( this.CurrentIndex < ( this.SavedData.length - 1 ) ) ;
 }
 
 FCKUndo.Undo = function()
 {
-	if ( FCKUndo.CheckUndoState() )
+	if ( this.CheckUndoState() )
 	{
 		// If it is the first step.
-		if ( FCKUndo.CurrentIndex == ( FCKUndo.SavedData.length - 1 ) )
+		if ( this.CurrentIndex == ( this.SavedData.length - 1 ) )
 		{
 			// Save the actual state for a possible "Redo" call.
-			FCKUndo.SaveUndoStep() ;
+			this.SaveUndoStep() ;
 		}
 
 		// Go a step back.
-		FCKUndo._ApplyUndoLevel( --FCKUndo.CurrentIndex ) ;
+		this._ApplyUndoLevel( --this.CurrentIndex ) ;
 
 		FCK.Events.FireEvent( "OnSelectionChange" ) ;
@@ -150,8 +150,8 @@
 FCKUndo.Redo = function()
 {
-	if ( FCKUndo.CheckRedoState() )
+	if ( this.CheckRedoState() )
 	{
 		// Go a step forward.
-		FCKUndo._ApplyUndoLevel( ++FCKUndo.CurrentIndex ) ;
+		this._ApplyUndoLevel( ++this.CurrentIndex ) ;
 
 		FCK.Events.FireEvent( "OnSelectionChange" ) ;
@@ -161,5 +161,5 @@
 FCKUndo._ApplyUndoLevel = function( level )
 {
-	var oData = FCKUndo.SavedData[ level ] ;
+	var oData = this.SavedData[ level ] ;
 
 	if ( !oData )
@@ -173,8 +173,8 @@
 
 	// Restore the selection
-	FCKUndo._SelectBookmark( oData[1] ) ;
+	this._SelectBookmark( oData[1] ) ;
 
-	FCKUndo.TypesCount = 0 ;
-	FCKUndo.Changed = false ;
-	FCKUndo.Typing = false ;
+	this.TypesCount = 0 ;
+	this.Changed = false ;
+	this.Typing = false ;
 }
Index: /FCKeditor/trunk/editor/dialog/fck_replace.html
===================================================================
--- /FCKeditor/trunk/editor/dialog/fck_replace.html	(revision 409)
+++ /FCKeditor/trunk/editor/dialog/fck_replace.html	(revision 410)
@@ -33,8 +33,16 @@
 function OnLoad()
 {
-	// First of all, translate the dialog box texts
+	// First of all, translate the dialog box texts.
 	oEditor.FCKLanguageManager.TranslatePage( document ) ;
 	
 	window.parent.SetAutoSize( true ) ;
+
+	// Place the cursor at the start of document.
+	// This will be the starting point of our search.
+	var range = new oEditor.FCKDomRange( oEditor.FCK.EditorWindow ) ;
+	range.SetStart( oEditor.FCK.EditorDocument.body, 1 ) ;
+	range.SetEnd( oEditor.FCK.EditorDocument.body, 1 ) ;
+	range.Collapse( true ) ;
+	range.Select() ;
 }
 
@@ -141,5 +149,5 @@
 		case 0x202f:
 		case 0x205f:
-		case 3000:
+		case 0x3000:
 			return true;
 		default:
@@ -177,5 +185,5 @@
 		while ( true )
 		{
-			if ( c == this.Pattern[ this._State ] )
+			if ( c == this.Pattern.charAt( this._State ) )
 			{
 				this._State++ ;
@@ -309,5 +317,4 @@
 		selection.Collapse( false ) ;
 		selection.Select() ;
-		oEditor.FCK.EditorDocument.body.normalize() ;
 	}
 }
@@ -317,9 +324,4 @@
 	oEditor.FCKUndo.SaveUndoStep() ;
 
-	var range = new oEditor.FCKDomRange( oEditor.FCK.EditorWindow ) ;
-	range.SetStart( oEditor.FCK.EditorDocument.body, 1 ) ;
-	range.SetEnd( oEditor.FCK.EditorDocument.body, 1 ) ;
-	range.Collapse( true ) ;
-	range.Select() ;
 	var replaceCount = 0 ;
 
@@ -335,6 +337,4 @@
 	if ( replaceCount == 0 )
 		alert( oEditor.FCKLang.DlgFindNotFoundMsg ) ;
-	else
-		oEditor.FCK.EditorDocument.body.normalize() ;
 	window.parent.Cancel() ;
 }
Index: /FCKeditor/trunk/fckconfig.js
===================================================================
--- /FCKeditor/trunk/fckconfig.js	(revision 409)
+++ /FCKeditor/trunk/fckconfig.js	(revision 410)
@@ -39,5 +39,5 @@
 FCKConfig.FullPage = false ;
 
-FCKConfig.Debug = false ;
+FCKConfig.Debug = true ;
 FCKConfig.AllowQueryStringDebug = true ;
 
