Index: /FCKeditor/branches/developers/alfonsoml/_test/automated/jslint/basic.bat
===================================================================
--- /FCKeditor/branches/developers/alfonsoml/_test/automated/jslint/basic.bat	(revision 67)
+++ /FCKeditor/branches/developers/alfonsoml/_test/automated/jslint/basic.bat	(revision 67)
@@ -0,0 +1,2 @@
+@cls
+@bin\jsl -process ..\..\..\editor\_source\*.js -conf basic.conf +recurse -nofilelisting -nologo -pauseatend
Index: /FCKeditor/branches/developers/alfonsoml/_test/automated/jslint/basic.conf
===================================================================
--- /FCKeditor/branches/developers/alfonsoml/_test/automated/jslint/basic.conf	(revision 67)
+++ /FCKeditor/branches/developers/alfonsoml/_test/automated/jslint/basic.conf	(revision 67)
@@ -0,0 +1,129 @@
+#
+# Configuration File for JavaScript Lint 0.3.0
+# Developed by Matthias Miller (http://www.JavaScriptLint.com)
+#
+# This configuration file can be used to lint a collection of scripts, or to enable
+# or disable warnings for scripts that are linted via the command line.
+#
+
+### Warnings
+# Enable or disable warnings based on requirements.
+# Use "+WarningName" to display or "-WarningName" to suppress.
+#
++no_return_value              # function {0} does not always return a value
++duplicate_formal             # duplicate formal argument {0}
++equal_as_assign              # test for equality (==) mistyped as assignment (=)?{0}
++var_hides_arg                # variable {0} hides argument
+-redeclared_var               # redeclaration of {0} {1}
++anon_no_return_value         # anonymous function does not always return a value
+-missing_semicolon            # missing semicolon
++meaningless_block            # meaningless block; curly braces have no impact
++comma_separated_stmts        # multiple statements separated by commas (use semicolons?)
++unreachable_code             # unreachable code
++missing_break                # missing break statement
+-missing_break_for_last_case  # missing break statement for last case in switch
+-comparison_type_conv         # comparisons against null, 0, true, false, or an empty string allowing implicit type conversion (use === or !==)
+-inc_dec_within_stmt          # increment (++) and decrement (--) operators used as part of greater statement
++useless_void                 # use of the void type may be unnecessary (void is always undefined)
++multiple_plus_minus          # unknown order of operations for successive plus (e.g. x+++y) or minus (e.g. x---y) signs
++use_of_label                 # use of label
+-block_without_braces         # block statement without curly braces
++leading_decimal_point        # leading decimal point may indicate a number or an object member
++trailing_decimal_point       # trailing decimal point may indicate a number or an object member
++octal_number                 # leading zeros make an octal number
++nested_comment               # nested comment
+-misplaced_regex              # regular expressions should be preceded by a left parenthesis, assignment, colon, or comma
+-ambiguous_newline            # unexpected end of line; it is ambiguous whether these lines are part of the same statement
++empty_statement              # empty statement or extra semicolon
+-missing_option_explicit      # the "option explicit" control comment is missing
++partial_option_explicit      # the "option explicit" control comment, if used, must be in the first script tag
++dup_option_explicit          # duplicate "option explicit" control comment
++useless_assign               # useless assignment
++ambiguous_nested_stmt        # block statements containing block statements should use curly braces to resolve ambiguity
++ambiguous_else_stmt          # the else statement could be matched with one of multiple if statements (use curly braces to indicate intent)
+-missing_default_case         # missing default case in switch statement
++duplicate_case_in_switch     # duplicate case in switch statements
++default_not_at_end           # the default case is not at the end of the switch statement
++legacy_cc_not_understood     # couldn't understand control comment using /*@keyword@*/ syntax
++jsl_cc_not_understood        # couldn't understand control comment using /*jsl:keyword*/ syntax
++useless_comparison           # useless comparison; comparing identical expressions
++with_statement               # with statement hides undeclared variables; use temporary variable instead
++trailing_comma_in_array      # extra comma is not recommended in array initializers
++assign_to_function_call      # assignment to a function call
+-parseint_missing_radix       # parseInt missing radix parameter
+
+
+### Output format
+# Customize the format of the error message.
+#    __FILE__ indicates current file path
+#    __FILENAME__ indicates current file name
+#    __LINE__ indicates current line
+#    __ERROR__ indicates error message
+#
+# Visual Studio syntax (default):
++output-format __FILE__(__LINE__): __ERROR__
+# Alternative syntax:
+#+output-format __FILE__:__LINE__: __ERROR__
+
+
+### Context
+# Show the in-line position of the error.
+# Use "+context" to display or "-context" to suppress.
+#
++context
+
+
+### Semicolons
+# By default, assignments of an anonymous function to a variable or
+# property (such as a function prototype) must be followed by a semicolon.
+#
+-lambda_assign_requires_semicolon
+
+
+### Control Comments
+# Both JavaScript Lint and the JScript interpreter confuse each other with the syntax for
+# the /*@keyword@*/ control comments and JScript conditional comments. (The latter is
+# enabled in JScript with @cc_on@). The /*jsl:keyword*/ syntax is preferred for this reason,
+# although legacy control comments are enabled by default for backward compatibility.
+#
++legacy_control_comments
+
+
+### JScript Function Extensions
+# JScript allows member functions to be defined like this:
+#     function MyObj() { /*constructor*/ }
+#     function MyObj.prototype.go() { /*member function*/ }
+#
+# It also allows events to be attached like this:
+#     function window::onload() { /*init page*/ }
+#
+# This is a Microsoft-only JavaScript extension. Enable this setting to allow them.
+#
+-jscript_function_extensions
+
+
+### Defining identifiers
+# By default, "option explicit" is enabled on a per-file basis.
+# To enable this for all files, use "+always_use_option_explicit"
+-always_use_option_explicit
+
+# Define certain identifiers of which the lint is not aware.
+# (Use this in conjunction with the "undeclared identifier" warning.)
+#
+# Common uses for webpages might be:
+#+define window
+#+define document
+
+
+### Interactive
+# Prompt for a keystroke before exiting.
+#+pauseatend
+
+
+### Files
+# Specify which files to lint
+# Use "+recurse" to enable recursion (disabled by default).
+# To add a set of files, use "+process FileName", "+process Folder\Path\*.js",
+# or "+process Folder\Path\*.htm".
+#
+#+process jsl-test.js
Index: /FCKeditor/branches/developers/alfonsoml/_test/automated/jslint/bin/jsl.default.conf
===================================================================
--- /FCKeditor/branches/developers/alfonsoml/_test/automated/jslint/bin/jsl.default.conf	(revision 67)
+++ /FCKeditor/branches/developers/alfonsoml/_test/automated/jslint/bin/jsl.default.conf	(revision 67)
@@ -0,0 +1,129 @@
+#
+# Configuration File for JavaScript Lint 0.3.0
+# Developed by Matthias Miller (http://www.JavaScriptLint.com)
+#
+# This configuration file can be used to lint a collection of scripts, or to enable
+# or disable warnings for scripts that are linted via the command line.
+#
+
+### Warnings
+# Enable or disable warnings based on requirements.
+# Use "+WarningName" to display or "-WarningName" to suppress.
+#
++no_return_value              # function {0} does not always return a value
++duplicate_formal             # duplicate formal argument {0}
++equal_as_assign              # test for equality (==) mistyped as assignment (=)?{0}
++var_hides_arg                # variable {0} hides argument
++redeclared_var               # redeclaration of {0} {1}
++anon_no_return_value         # anonymous function does not always return a value
++missing_semicolon            # missing semicolon
++meaningless_block            # meaningless block; curly braces have no impact
++comma_separated_stmts        # multiple statements separated by commas (use semicolons?)
++unreachable_code             # unreachable code
++missing_break                # missing break statement
++missing_break_for_last_case  # missing break statement for last case in switch
++comparison_type_conv         # comparisons against null, 0, true, false, or an empty string allowing implicit type conversion (use === or !==)
++inc_dec_within_stmt          # increment (++) and decrement (--) operators used as part of greater statement
++useless_void                 # use of the void type may be unnecessary (void is always undefined)
++multiple_plus_minus          # unknown order of operations for successive plus (e.g. x+++y) or minus (e.g. x---y) signs
++use_of_label                 # use of label
+-block_without_braces         # block statement without curly braces
++leading_decimal_point        # leading decimal point may indicate a number or an object member
++trailing_decimal_point       # trailing decimal point may indicate a number or an object member
++octal_number                 # leading zeros make an octal number
++nested_comment               # nested comment
++misplaced_regex              # regular expressions should be preceded by a left parenthesis, assignment, colon, or comma
++ambiguous_newline            # unexpected end of line; it is ambiguous whether these lines are part of the same statement
++empty_statement              # empty statement or extra semicolon
+-missing_option_explicit      # the "option explicit" control comment is missing
++partial_option_explicit      # the "option explicit" control comment, if used, must be in the first script tag
++dup_option_explicit          # duplicate "option explicit" control comment
++useless_assign               # useless assignment
++ambiguous_nested_stmt        # block statements containing block statements should use curly braces to resolve ambiguity
++ambiguous_else_stmt          # the else statement could be matched with one of multiple if statements (use curly braces to indicate intent)
++missing_default_case         # missing default case in switch statement
++duplicate_case_in_switch     # duplicate case in switch statements
++default_not_at_end           # the default case is not at the end of the switch statement
++legacy_cc_not_understood     # couldn't understand control comment using /*@keyword@*/ syntax
++jsl_cc_not_understood        # couldn't understand control comment using /*jsl:keyword*/ syntax
++useless_comparison           # useless comparison; comparing identical expressions
++with_statement               # with statement hides undeclared variables; use temporary variable instead
++trailing_comma_in_array      # extra comma is not recommended in array initializers
++assign_to_function_call      # assignment to a function call
++parseint_missing_radix       # parseInt missing radix parameter
+
+
+### Output format
+# Customize the format of the error message.
+#    __FILE__ indicates current file path
+#    __FILENAME__ indicates current file name
+#    __LINE__ indicates current line
+#    __ERROR__ indicates error message
+#
+# Visual Studio syntax (default):
++output-format __FILE__(__LINE__): __ERROR__
+# Alternative syntax:
+#+output-format __FILE__:__LINE__: __ERROR__
+
+
+### Context
+# Show the in-line position of the error.
+# Use "+context" to display or "-context" to suppress.
+#
++context
+
+
+### Semicolons
+# By default, assignments of an anonymous function to a variable or
+# property (such as a function prototype) must be followed by a semicolon.
+#
++lambda_assign_requires_semicolon
+
+
+### Control Comments
+# Both JavaScript Lint and the JScript interpreter confuse each other with the syntax for
+# the /*@keyword@*/ control comments and JScript conditional comments. (The latter is
+# enabled in JScript with @cc_on@). The /*jsl:keyword*/ syntax is preferred for this reason,
+# although legacy control comments are enabled by default for backward compatibility.
+#
++legacy_control_comments
+
+
+### JScript Function Extensions
+# JScript allows member functions to be defined like this:
+#     function MyObj() { /*constructor*/ }
+#     function MyObj.prototype.go() { /*member function*/ }
+#
+# It also allows events to be attached like this:
+#     function window::onload() { /*init page*/ }
+#
+# This is a Microsoft-only JavaScript extension. Enable this setting to allow them.
+#
+-jscript_function_extensions
+
+
+### Defining identifiers
+# By default, "option explicit" is enabled on a per-file basis.
+# To enable this for all files, use "+always_use_option_explicit"
+-always_use_option_explicit
+
+# Define certain identifiers of which the lint is not aware.
+# (Use this in conjunction with the "undeclared identifier" warning.)
+#
+# Common uses for webpages might be:
+#+define window
+#+define document
+
+
+### Interactive
+# Prompt for a keystroke before exiting.
+#+pauseatend
+
+
+### Files
+# Specify which files to lint
+# Use "+recurse" to enable recursion (disabled by default).
+# To add a set of files, use "+process FileName", "+process Folder\Path\*.js",
+# or "+process Folder\Path\*.htm".
+#
++process jsl-test.js
Index: /FCKeditor/branches/developers/alfonsoml/editor/_packager.xml
===================================================================
--- /FCKeditor/branches/developers/alfonsoml/editor/_packager.xml	(revision 66)
+++ /FCKeditor/branches/developers/alfonsoml/editor/_packager.xml	(revision 67)
@@ -34,4 +34,5 @@
 		<File path="editor/_source/internals/fckurlparams.js" />
 		<File path="editor/_source/internals/fck.js" />
+		<File path="editor/_source/internals/fck_ie.js" />
 		<File path="editor/_source/internals/fckconfig.js" />
 		<File path="editor/_source/internals/fckdebug.js" />
@@ -60,8 +61,4 @@
 
 		<File path="editor/_source/internals/fckdocumentprocessor.js" />
-		<File path="editor/_source/internals/fck_1.js" />
-		<File path="editor/_source/internals/fck_1_ie.js" />
-		<File path="editor/_source/internals/fck_2.js" />
-		<File path="editor/_source/internals/fck_2_ie.js" />
 		<File path="editor/_source/internals/fckselection.js" />
 		<File path="editor/_source/internals/fckselection_ie.js" />
@@ -119,4 +116,5 @@
 		<File path="editor/_source/internals/fckurlparams.js" />
 		<File path="editor/_source/internals/fck.js" />
+		<File path="editor/_source/internals/fck_gecko.js" />
 		<File path="editor/_source/internals/fckconfig.js" />
 		<File path="editor/_source/internals/fckdebug.js" />
@@ -145,8 +143,4 @@
 
 		<File path="editor/_source/internals/fckdocumentprocessor.js" />
-		<File path="editor/_source/internals/fck_1.js" />
-		<File path="editor/_source/internals/fck_1_gecko.js" />
-		<File path="editor/_source/internals/fck_2.js" />
-		<File path="editor/_source/internals/fck_2_gecko.js" />
 		<File path="editor/_source/internals/fckselection.js" />
 		<File path="editor/_source/internals/fckselection_gecko.js" />
Index: /FCKeditor/branches/developers/alfonsoml/editor/_source/classes/fckiecleanup.js
===================================================================
--- /FCKeditor/branches/developers/alfonsoml/editor/_source/classes/fckiecleanup.js	(revision 66)
+++ /FCKeditor/branches/developers/alfonsoml/editor/_source/classes/fckiecleanup.js	(revision 67)
@@ -37,5 +37,4 @@
 	while ( aItems.length > 0 )
 	{
-		var oItem ;
 		
 		// It is important to remove from the end to the beginning (pop()),
@@ -44,5 +43,6 @@
 		// cleanup function, so we must cleanup then first, otherwise IE could
 		// throw some crazy memory errors (IE bug).
-		if ( oItem = aItems.pop() )
+		var oItem = aItems.pop() ;
+		if ( oItem )
 			oItem[1].call( oItem[0] ) ;
 	}
Index: /FCKeditor/branches/developers/alfonsoml/editor/_source/classes/fckstyledef_gecko.js
===================================================================
--- /FCKeditor/branches/developers/alfonsoml/editor/_source/classes/fckstyledef_gecko.js	(revision 66)
+++ /FCKeditor/branches/developers/alfonsoml/editor/_source/classes/fckstyledef_gecko.js	(revision 67)
@@ -45,5 +45,5 @@
 			case 'src' :
 				targetElement.setAttribute( '_fcksavedurl', this.Attributes[a], 0 ) ;
-			
+				/*jsl:fallthru*/ // @Packager.RemoveLine
 			default :
 				targetElement.setAttribute( a, this.Attributes[a], 0 ) ;
Index: /FCKeditor/branches/developers/alfonsoml/editor/_source/classes/fckstyledef_ie.js
===================================================================
--- /FCKeditor/branches/developers/alfonsoml/editor/_source/classes/fckstyledef_ie.js	(revision 66)
+++ /FCKeditor/branches/developers/alfonsoml/editor/_source/classes/fckstyledef_ie.js	(revision 67)
@@ -51,5 +51,5 @@
 			case 'src' :
 				targetElement.setAttribute( '_fcksavedurl', this.Attributes[a], 0 ) ;
-
+				/*jsl:fallthru*/ // @Packager.RemoveLine
 			default :
 				targetElement.setAttribute( a, this.Attributes[a], 0 ) ;
Index: /FCKeditor/branches/developers/alfonsoml/editor/_source/classes/fckstylesloader.js
===================================================================
--- /FCKeditor/branches/developers/alfonsoml/editor/_source/classes/fckstylesloader.js	(revision 66)
+++ /FCKeditor/branches/developers/alfonsoml/editor/_source/classes/fckstylesloader.js	(revision 67)
@@ -20,5 +20,5 @@
 	var oXml = new FCKXml() ;
 	oXml.LoadUrl( stylesXmlUrl ) ;
-
+	
 	// Get the "Style" nodes defined in the XML file.
 	var aStyleNodes = oXml.SelectNodes( 'Styles/Style' ) ;
Index: /FCKeditor/branches/developers/alfonsoml/editor/_source/commandclasses/fck_othercommands.js
===================================================================
--- /FCKeditor/branches/developers/alfonsoml/editor/_source/commandclasses/fck_othercommands.js	(revision 66)
+++ /FCKeditor/branches/developers/alfonsoml/editor/_source/commandclasses/fck_othercommands.js	(revision 67)
@@ -63,4 +63,5 @@
 	{
 		// TODO: Remove font name attribute.
+		/*jsl:pass*/ // @Packager.RemoveLine
 	}
 	else
Index: /FCKeditor/branches/developers/alfonsoml/editor/_source/fckjscoreextensions.js
===================================================================
--- /FCKeditor/branches/developers/alfonsoml/editor/_source/fckjscoreextensions.js	(revision 66)
+++ /FCKeditor/branches/developers/alfonsoml/editor/_source/fckjscoreextensions.js	(revision 67)
@@ -23,7 +23,8 @@
 
 	for ( var i = 0 ; i < aArgs.length ; i++ )
+	{
 		if ( this == aArgs[i] )
 			return true ;
-	
+	}
 	return false ;
 }
@@ -40,7 +41,8 @@
 	
 	for ( var i = 0 ; i < aArgs.length ; i++ )
+	{
 		if ( thisUpper == aArgs[i].toUpperCase() )
 			return true ;
-	
+	}
 	return false ;
 }
Index: /FCKeditor/branches/developers/alfonsoml/editor/_source/internals/fck.js
===================================================================
--- /FCKeditor/branches/developers/alfonsoml/editor/_source/internals/fck.js	(revision 66)
+++ /FCKeditor/branches/developers/alfonsoml/editor/_source/internals/fck.js	(revision 67)
@@ -22,6 +22,560 @@
 	{
 		return this.LinkedField.form ;
-	}
+	} ,
+
+//	Events	: new FCKEvents( FCK ),   how to pass a reference to self here? "this" passes the window
+
+	Toolbar	: null,
+	HasFocus : false,
+
+	// IsDirty implementation 
+	StartupValue : '',
+
+	IsDirty : function()
+	{
+		return ( this.StartupValue != this.EditorDocument.body.innerHTML ) ;
+	},
+
+	ResetIsDirty : function()
+	{
+		if ( this.EditorDocument.body )
+			this.StartupValue = this.EditorDocument.body.innerHTML ;
+	},
+	// end of IsDirty 
+
+	StartEditor : function()
+	{
+		this.TempBaseTag = FCKConfig.BaseHref.length > 0 ? '<base href="' + FCKConfig.BaseHref + '" _fcktemp="true"></base>' : '' ;
+
+		// Setup the keystroke handler.
+		var oKeystrokeHandler = FCK.KeystrokeHandler = new FCKKeystrokeHandler() ;
+		oKeystrokeHandler.OnKeystroke = _FCK_KeystrokeHandler_OnKeystroke ;
+
+		oKeystrokeHandler.SetKeystrokes( FCKConfig.Keystrokes ) ;
+
+		// In IE7, if the editor tries to access the clipboard by code, a dialog is
+		// shown to the user asking if the application is allowed to access or not.
+		// Due to the IE implementation of it, the KeystrokeHandler will not work 
+		//well in this case, so we must leave the pasting keys to have their default behavior.
+		if ( FCKBrowserInfo.IsIE7 )
+		{
+			if ( ( CTRL + 86 /*V*/ ) in oKeystrokeHandler.Keystrokes )
+				oKeystrokeHandler.SetKeystrokes( [ CTRL + 86, true ] ) ;
+
+			if ( ( SHIFT + 45 /*INS*/ ) in oKeystrokeHandler.Keystrokes )
+				oKeystrokeHandler.SetKeystrokes( [ SHIFT + 45, true ] ) ;
+		}
+
+		this.EditingArea = new FCKEditingArea( document.getElementById( 'xEditingArea' ) ) ;
+		this.EditingArea.FFSpellChecker = false ;
+
+		// Set the editor's startup contents
+		this.SetHTML( this.GetLinkedFieldValue() ) ;
+	},
+
+	Focus : function()
+	{
+		FCK.EditingArea.Focus() ;
+	},
+
+	SetStatus : function( newStatus )
+	{
+		this.Status = newStatus ;
+
+		if ( newStatus == FCK_STATUS_ACTIVE )
+		{
+			FCKFocusManager.AddWindow( window, true ) ;
+			
+			if ( FCKBrowserInfo.IsIE )
+				FCKFocusManager.AddWindow( window.frameElement, true ) ;
+
+			// Force the focus in the editor.
+			if ( FCKConfig.StartupFocus )
+				FCK.Focus() ;
+		}
+
+		this.Events.FireEvent( 'OnStatusChange', newStatus ) ;
+	},
+
+	GetXHTML : function( format )
+	{
+		// We assume that if the user is in source editing, the editor value must
+		// represent the exact contents of the source, as the user wanted it to be.
+		if ( FCK.EditMode == FCK_EDITMODE_SOURCE )
+				return FCK.EditingArea.Textarea.value ;
+
+		var sXHTML ;
+		var oDoc = FCK.EditorDocument ;
+
+		if ( FCKConfig.FullPage )
+			sXHTML = FCKXHtml.GetXHTML( oDoc.getElementsByTagName( 'html' )[0], true, format ) ;
+		else
+		{
+			if ( FCKConfig.IgnoreEmptyParagraphValue && oDoc.body.innerHTML == '<P>&nbsp;</P>' )
+				sXHTML = '' ;
+			else
+				sXHTML = FCKXHtml.GetXHTML( oDoc.body, false, format ) ;
+		}
+		
+		// Restore protected attributes.
+		sXHTML = FCK.ProtectEventsRestore( sXHTML ) ;
+
+		if ( FCKBrowserInfo.IsIE )
+			sXHTML = sXHTML.replace( FCKRegexLib.ToReplace, '$1' ) ;
+
+		if ( FCK.DocTypeDeclaration && FCK.DocTypeDeclaration.length > 0 )
+			sXHTML = FCK.DocTypeDeclaration + '\n' + sXHTML ;
+
+		if ( FCK.XmlDeclaration && FCK.XmlDeclaration.length > 0 )
+			sXHTML = FCK.XmlDeclaration + '\n' + sXHTML ;
+
+		return FCKConfig.ProtectedSource.Revert( sXHTML ) ;
+	},
+
+	UpdateLinkedField : function()
+	{
+		FCK.LinkedField.value = FCK.GetXHTML( FCKConfig.FormatOutput ) ;
+		FCK.Events.FireEvent( 'OnAfterLinkedFieldUpdate' ) ;
+	},
+
+	RegisteredDoubleClickHandlers : new Object(),
+
+	OnDoubleClick : function( element )
+	{
+		var oHandler = FCK.RegisteredDoubleClickHandlers[ element.tagName ] ;
+		if ( oHandler )
+			oHandler( element ) ;
+	},
+
+	// Register objects that can handle double click operations.
+	RegisterDoubleClickHandler : function( handlerFunction, tag )
+	{
+		FCK.RegisteredDoubleClickHandlers[ tag.toUpperCase() ] = handlerFunction ;
+	},
+
+	OnAfterSetHTML : function()
+	{
+		FCKDocumentProcessor.Process( FCK.EditorDocument ) ;	
+		FCKUndo.SaveUndoStep() ;
+
+		FCK.Events.FireEvent( 'OnSelectionChange' ) ;
+		FCK.Events.FireEvent( 'OnAfterSetHTML' ) ;
+	},
+
+	// Saves URLs on links and images on special attributes, so they don't change when 
+	// moving around.
+	ProtectUrls : function( html )
+	{
+		// <A> href
+		html = html.replace( FCKRegexLib.ProtectUrlsA	, '$1$4$2$3$5$2 _fcksavedurl=$2$3$5$2' ) ;
+
+		// <IMG> src
+		html = html.replace( FCKRegexLib.ProtectUrlsImg	, '$1$4$2$3$5$2 _fcksavedurl=$2$3$5$2' ) ;
+		
+		return html ;
+	},
+
+	// Saves event attributes (like onclick) so they don't get executed while
+	// editing.
+	ProtectEvents : function( html )
+	{
+		return html.replace( FCKRegexLib.TagsWithEvent, _FCK_ProtectEvents_ReplaceTags ) ;
+	},
+
+	ProtectEventsRestore : function( html )
+	{
+		return html.replace( FCKRegexLib.ProtectedEvents, _FCK_ProtectEvents_RestoreEvents ) ;
+	},
+
+	ProtectTags : function( html )
+	{
+		// <meta> tags get executed, so if you have a redirect meta, the content
+		// will move to the target page.
+		var sTags = 'META' ;
+		
+		if ( FCKConfig.ProtectedTags.length > 0 )
+			sTags += '|' + FCKConfig.ProtectedTags ;
+
+		// IE doesn't support <abbr> and it breaks it. Let's protect it.
+		if ( FCKBrowserInfo.IsIE )
+			sTags += '|ABBR' ;
+		
+		var oRegex = new RegExp( '<(' + sTags + ')([ \>])', 'gi' ) ;
+		html = html.replace( oRegex, '<FCK:$1$2' ) ;
+			
+		oRegex = new RegExp( '<\/(' + sTags + ')>', 'gi' ) ;
+		html = html.replace( oRegex, '<\/FCK:$1>' ) ;
+		
+		return html ;
+	},
+
+	SetHTML : function( html )
+	{
+		this.EditingArea.Mode = FCK.EditMode ;
+
+		if ( FCK.EditMode == FCK_EDITMODE_WYSIWYG )
+		{	
+			html = FCKConfig.ProtectedSource.Protect( html ) ;
+			html = FCK.ProtectEvents( html ) ;
+			html = FCK.ProtectUrls( html ) ;
+			html = FCK.ProtectTags( html ) ;
+
+			// Firefox can't handle correctly the editing of the STRONG and EM tags. 
+			// We must replace them with B and I.
+			if ( FCKBrowserInfo.IsGecko )
+			{
+				html = html.replace( FCKRegexLib.StrongOpener, '<b$1' ) ;
+				html = html.replace( FCKRegexLib.StrongCloser, '<\/b>' ) ;
+				html = html.replace( FCKRegexLib.EmOpener, '<i$1' ) ;
+				html = html.replace( FCKRegexLib.EmCloser, '<\/i>' ) ;
+			}
+	//		else if ( FCKBrowserInfo.IsIE )
+	//		{
+	//			// IE doesn't support <abbr> and it breaks it. Let's protect it.
+	//			html = html.replace( FCKRegexLib.AbbrOpener, '<FCK:abbr$1' ) ;
+	//			html = html.replace( FCKRegexLib.AbbrCloser, '<\/FCK:abbr>' ) ;
+	//		}
+
+			var sHtml = '' ;
+
+			if ( FCKConfig.FullPage )
+			{
+				// The HTML must be fixed if the <head> is not available.
+				if ( !FCKRegexLib.HeadOpener.test( html ) )
+				{
+					// Check if the <html> is available.
+					if ( !FCKRegexLib.HtmlOpener.test( html ) )
+						html = '<html dir="' + FCKConfig.ContentLangDirection + '">' + html + '</html>' ;
+					
+					// Add the <head>.
+					html = html.replace( FCKRegexLib.HtmlOpener, '$&<head></head>' ) ;
+				}
+				
+				// Save the DOCTYPE.
+				FCK.DocTypeDeclaration = html.match( FCKRegexLib.DocTypeTag ) ;
+				
+				if ( FCKBrowserInfo.IsIE )
+					sHtml = FCK._GetBehaviorsStyle() ;
+				else if ( FCKConfig.ShowBorders ) 
+					sHtml = '<link href="' + FCKConfig.FullBasePath + 'css/fck_showtableborders_gecko.css" rel="stylesheet" type="text/css" _fcktemp="true" />' ;
+
+				sHtml += '<link href="' + FCKConfig.FullBasePath + 'css/fck_internal.css' + '" rel="stylesheet" type="text/css" _fcktemp="true" />' ;
+
+				// Attention: do not change it before testing it well (sample07)!		: @Packager.RemoveLine
+				// This is tricky... if the head ends with <meta ... content type>,		: @Packager.RemoveLine
+				// Firefox will break. But, it works if we include the temporary		: @Packager.RemoveLine
+				// links as the last elements in the HEAD.								: @Packager.RemoveLine
+				sHtml = html.replace( FCKRegexLib.HeadCloser, sHtml + '$&' ) ;
+
+				// Insert the base tag (FCKConfig.BaseHref), if not exists in the source.
+				// The base must be the first tag in the HEAD, to get relative			: @Packager.RemoveLine
+				// links on styles, for example.										: @Packager.RemoveLine
+				if ( FCK.TempBaseTag.length > 0 && !FCKRegexLib.HasBaseTag.test( html ) )
+					sHtml = sHtml.replace( FCKRegexLib.HeadOpener, '$&' + FCK.TempBaseTag ) ;
+			}
+			else
+			{
+				sHtml =
+					FCKConfig.DocType +
+					'<html dir="' + FCKConfig.ContentLangDirection + '"' ;
+				
+				// On IE, if you are use a DOCTYPE differenft of HTML 4 (like
+				// XHTML), you must force the vertical scroll to show, otherwise
+				// the horizontal one may appear when the page needs vertical scrolling.
+				if ( FCKBrowserInfo.IsIE && !FCKRegexLib.Html4DocType.test( FCKConfig.DocType ) )
+					sHtml += ' style="overflow-y: scroll"' ;
+				
+				sHtml +=
+					'><head><title></title>' +
+					_FCK_GetEditorAreaStyleTags() +
+					'<link href="' + FCKConfig.FullBasePath + 'css/fck_internal.css' + '" rel="stylesheet" type="text/css" _fcktemp="true" />' ;
+
+				if ( FCKBrowserInfo.IsIE )
+					sHtml += FCK._GetBehaviorsStyle() ;
+				else if ( FCKConfig.ShowBorders ) 
+					sHtml += '<link href="' + FCKConfig.FullBasePath + 'css/fck_showtableborders_gecko.css" rel="stylesheet" type="text/css" _fcktemp="true" />' ;
+
+				sHtml += FCK.TempBaseTag ;
+
+				// Add ID and Class to the body
+				var sBodyTag = '<body'
+				if ( FCKConfig.BodyId && FCKConfig.BodyId.length > 0 )
+					sBodyTag += ' id="' + FCKConfig.BodyId + '"' ;
+				if ( FCKConfig.BodyClass && FCKConfig.BodyClass.length > 0 )
+					sBodyTag += ' class="' + FCKConfig.BodyClass + '"' ;
+				sHtml += '</head>' + sBodyTag + '>' ;
+
+				if ( FCKBrowserInfo.IsGecko && ( html.length == 0 || FCKRegexLib.EmptyParagraph.test( html ) ) )
+					sHtml += GECKO_BOGUS ;
+				else
+					sHtml += html ;
+				
+				sHtml += '</body></html>' ;
+			}
+
+			this.EditingArea.OnLoad = _FCK_EditingArea_OnLoad ;
+			this.EditingArea.Start( sHtml ) ;
+		}
+		else
+		{
+			// Remove the references to the following elements, as the editing area
+			// IFRAME will be removed.
+			FCK.EditorWindow	= null ;
+			FCK.EditorDocument	= null ; 
+		
+			this.EditingArea.OnLoad = null ;
+			this.EditingArea.Start( html ) ;
+			
+			// Enables the context menu in the textarea.
+			this.EditingArea.Textarea._FCKShowContextMenu = true ;
+
+			// Removes the enter key handler.
+			FCK.EnterKeyHandler = null ;
+
+			// Listen for keystroke events.
+			FCK.KeystrokeHandler.AttachToElement( this.EditingArea.Textarea ) ;
+			
+			this.EditingArea.Textarea.focus() ;
+		}
+
+		if ( FCKBrowserInfo.IsGecko )
+			window.onresize() ;
+	},
+
+	// For the FocusManager
+	HasFocus : false, 
+
+
+	// This collection is used by the browser specific implementations to tell
+	// wich named commands must be handled separately.
+	RedirectNamedCommands : new Object(),
+
+	ExecuteNamedCommand : function( commandName, commandParameter, noRedirect )
+	{
+		FCKUndo.SaveUndoStep() ;
+
+		if ( !noRedirect && FCK.RedirectNamedCommands[ commandName ] != null )
+			FCK.ExecuteRedirectedNamedCommand( commandName, commandParameter ) ;
+		else
+		{
+			FCK.Focus() ;
+			FCK.EditorDocument.execCommand( commandName, false, commandParameter ) ; 
+			FCK.Events.FireEvent( 'OnSelectionChange' ) ;
+		}
+		
+		FCKUndo.SaveUndoStep() ;
+	},
+
+	GetNamedCommandState : function( commandName )
+	{
+		try
+		{
+	//		FCKDebug.Output( 'queryCommandEnabled for "' + commandName + '": ' + FCK.EditorDocument.queryCommandEnabled( commandName ), '#99ff99' ) ;	// @Packager.RemoveLine
+
+			if ( !FCK.EditorDocument.queryCommandEnabled( commandName ) )
+				return FCK_TRISTATE_DISABLED ;
+			else
+				return FCK.EditorDocument.queryCommandState( commandName ) ? FCK_TRISTATE_ON : FCK_TRISTATE_OFF ;
+		}
+		catch ( e )
+		{
+	//		FCKDebug.Output( 'Error getting the state for ' + commandName + ': ' + e.description, '#ff0000' ) ;	// @Packager.RemoveLine
+			return FCK_TRISTATE_OFF ;
+		}
+	},
+
+	GetNamedCommandValue : function( commandName )
+	{
+		var sValue = '' ;
+		var eState = FCK.GetNamedCommandState( commandName ) ;
+		
+		if ( eState == FCK_TRISTATE_DISABLED ) 
+			return null ;
+		
+		try
+		{
+			sValue = this.EditorDocument.queryCommandValue( commandName ) ;
+		}
+		catch(e) {}
+		
+		return sValue ? sValue : '' ;
+	},
+
+	PasteFromWord : function()
+	{
+		FCKDialog.OpenDialog( 'FCKDialog_Paste', FCKLang.PasteFromWord, 'dialog/fck_paste.html', 400, 330, 'Word' ) ;
+	},
+
+	Preview : function()
+	{
+		var iWidth	= FCKConfig.ScreenWidth * 0.8 ;
+		var iHeight	= FCKConfig.ScreenHeight * 0.7 ;
+		var iLeft	= ( FCKConfig.ScreenWidth - iWidth ) / 2 ;
+		var oWindow = window.open( '', null, 'toolbar=yes,location=no,status=yes,menubar=yes,scrollbars=yes,resizable=yes,width=' + iWidth + ',height=' + iHeight + ',left=' + iLeft ) ;
+		
+		var sHTML ;
+		
+		if ( FCKConfig.FullPage )
+		{
+			if ( FCK.TempBaseTag.length > 0 )
+				sHTML = FCK.TempBaseTag + FCK.GetXHTML() ;
+			else
+				sHTML = FCK.GetXHTML() ;
+		}
+		else
+		{
+			sHTML = 
+				FCKConfig.DocType +
+				'<html dir="' + FCKConfig.ContentLangDirection + '">' +
+				'<head>' +
+				FCK.TempBaseTag +
+				'<title>' + FCKLang.Preview + '</title>' +
+				_FCK_GetEditorAreaStyleTags() +
+				'</head><body>' + 
+				FCK.GetXHTML() + 
+				'</body></html>' ;
+		}
+		
+		oWindow.document.write( sHTML );
+		oWindow.document.close();
+	},
+
+	SwitchEditMode : function( noUndo )
+	{
+		var bIsWysiwyg = ( FCK.EditMode == FCK_EDITMODE_WYSIWYG ) ;
+		var sHtml ;
+		
+		// Update the HTML in the view output to show.
+		if ( bIsWysiwyg )
+		{
+			if ( !noUndo && FCKBrowserInfo.IsIE )
+				FCKUndo.SaveUndoStep() ;
+
+			sHtml = FCK.GetXHTML( FCKConfig.FormatSource ) ;
+		}
+		else
+			sHtml = this.EditingArea.Textarea.value ;
+
+		FCK.EditMode = bIsWysiwyg ? FCK_EDITMODE_SOURCE : FCK_EDITMODE_WYSIWYG ;
+
+		FCK.SetHTML( sHtml ) ;
+
+		// Set the Focus.
+		FCK.Focus() ;
+
+		// Update the toolbar (Running it directly causes IE to fail).
+		FCKTools.RunFunction( FCK.ToolbarSet.RefreshModeState, FCK.ToolbarSet ) ;
+	},
+
+	CreateElement : function( tag )
+	{
+		var e = FCK.EditorDocument.createElement( tag ) ;
+		return FCK.InsertElementAndGetIt( e ) ;
+	},
+
+	InsertElementAndGetIt : function( e )
+	{
+		e.setAttribute( 'FCKTempLabel', 'true' ) ;
+		
+		this.InsertElement( e ) ;
+		
+		var aEls = FCK.EditorDocument.getElementsByTagName( e.tagName ) ;
+		
+		for ( var i = 0 ; i < aEls.length ; i++ )
+		{
+			if ( aEls[i].getAttribute( 'FCKTempLabel' ) )
+			{
+				aEls[i].removeAttribute( 'FCKTempLabel' ) ;
+				return aEls[i] ;
+			}
+		}
+		return null ;
+	}
+
 } ;
+
+FCK.Events	= new FCKEvents( FCK ) ;
+// GetHTML is Deprecated : returns the same value as GetXHTML.
+FCK.GetHTML	= FCK.GetXHTML ;
+
+// Replace all events attributes (like onclick).
+function _FCK_ProtectEvents_ReplaceTags( tagMatch )
+{
+	return tagMatch.replace( FCKRegexLib.EventAttributes, _FCK_ProtectEvents_ReplaceEvents ) ;
+}
+
+// Replace an event attribute with its respective __fckprotectedatt attribute.
+// The original event markup will be encoded and saved as the value of the new
+// attribute.
+function _FCK_ProtectEvents_ReplaceEvents( eventMatch, attName )
+{
+	return ' ' + attName + '_fckprotectedatt="' + eventMatch.ReplaceAll( [/&/g,/'/g,/"/g,/=/g,/</g,/>/g,/\r/g,/\n/g], ['&apos;','&#39;','&quot;','&#61;','&lt;','&gt;','&#10;','&#13;'] ) + '"' ;
+}
+
+function _FCK_ProtectEvents_RestoreEvents( match, encodedOriginal )
+{
+	return encodedOriginal.ReplaceAll( [/&#39;/g,/&quot;/g,/&#61;/g,/&lt;/g,/&gt;/g,/&#10;/g,/&#13;/g,/&apos;/g], ["'",'"','=','<','>','\r','\n','&'] ) ;
+}
+
+function _FCK_EditingArea_OnLoad()
+{
+	// Get the editor's window and document (DOM)
+	FCK.EditorWindow	= FCK.EditingArea.Window ;
+	FCK.EditorDocument	= FCK.EditingArea.Document ;
+
+	FCK.InitializeBehaviors() ;
+
+	// Create the enter key handler
+	if ( !FCKConfig.DisableEnterKeyHandler )
+		FCK.EnterKeyHandler = new FCKEnterKey( FCK.EditorWindow, FCKConfig.EnterMode, FCKConfig.ShiftEnterMode ) ;
+
+	// Listen for keystroke events.
+	FCK.KeystrokeHandler.AttachToElement( FCK.EditorDocument ) ;
+
+	FCK.OnAfterSetHTML() ;
+
+	// Check if it is not a startup call, otherwise complete the startup.
+	if ( FCK.Status != FCK_STATUS_NOTLOADED )
+		return ;
+
+	// Save the startup value for the "IsDirty()" check.
+	FCK.ResetIsDirty() ;
+	
+	FCK.SetStatus( FCK_STATUS_ACTIVE ) ;
+}
+
+function _FCK_GetEditorAreaStyleTags()
+{
+	var sTags = '' ;
+	var aCSSs = FCKConfig.EditorAreaCSS ;
+	
+	for ( var i = 0 ; i < aCSSs.length ; i++ )
+		sTags += '<link href="' + aCSSs[i] + '" rel="stylesheet" type="text/css" />' ;
+	
+	return sTags ;
+}
+
+function _FCK_KeystrokeHandler_OnKeystroke( keystroke, keystrokeValue )
+{
+	if ( FCK.Status != FCK_STATUS_COMPLETE )
+		return false ;
+
+	if ( FCK.EditMode == FCK_EDITMODE_WYSIWYG )
+	{
+		if ( keystrokeValue == 'Paste' )
+			return !FCK.Events.FireEvent( 'OnPaste' ) ;
+	}
+	else
+	{
+		// In source mode, some actions must have their default behavior.
+		if ( keystrokeValue.Equals( 'Paste', 'Undo', 'Redo', 'SelectAll' ) )
+			return false ;
+	}
+
+	// The return value indicates if the default behavior of the keystroke must
+	// be cancelled. Let's do that only if the Execute() call explicitelly returns "false".
+	var oCommand = FCK.Commands.GetCommand( keystrokeValue ) ;
+	return ( oCommand.Execute.apply( oCommand, FCKTools.ArgumentsToArray( arguments, 2 ) ) !== false ) ;
+}
 
 // Set the FCK.LinkedField reference to the field that will be used to post the
@@ -79,2 +633,97 @@
 	}
 } ;
+
+
+
+// # Focus Manager: Manages the focus in the editor.
+var FCKFocusManager = FCK.FocusManager = 
+{
+	IsLocked : false,
+
+	AddWindow : function( win, sendToEditingArea )
+	{
+		var oTarget ;
+		
+		if ( FCKBrowserInfo.IsIE )
+			oTarget = win.nodeType == 1 ? win : win.frameElement ? win.frameElement : win.document ;
+		else
+			oTarget = win.document ;
+		
+		FCKTools.AddEventListener( oTarget, 'blur', FCKFocusManager_Win_OnBlur ) ;
+		FCKTools.AddEventListener( oTarget, 'focus', sendToEditingArea ? FCKFocusManager_Win_OnFocus_Area : FCKFocusManager_Win_OnFocus ) ;
+	},
+
+	RemoveWindow : function( win )
+	{
+		if ( FCKBrowserInfo.IsIE )
+			oTarget = win.nodeType == 1 ? win : win.frameElement ? win.frameElement : win.document ;
+		else
+			oTarget = win.document ;
+
+		FCKTools.RemoveEventListener( oTarget, 'blur', FCKFocusManager_Win_OnBlur ) ;
+		FCKTools.RemoveEventListener( oTarget, 'focus', FCKFocusManager_Win_OnFocus_Area ) ;
+		FCKTools.RemoveEventListener( oTarget, 'focus', FCKFocusManager_Win_OnFocus ) ;
+	},
+
+	Lock : function()
+	{
+		this.IsLocked = true ;
+	},
+
+	Unlock : function()
+	{
+		if ( this._HasPendingBlur )
+			FCKFocusManager._Timer = window.setTimeout( FCKFocusManager_FireOnBlur, 100 ) ;
+			
+		this.IsLocked = false ;
+	},
+
+	_ResetTimer : function()
+	{
+		this._HasPendingBlur = false ;
+
+		if ( this._Timer )
+		{
+			window.clearTimeout( this._Timer ) ;
+			delete this._Timer ; 
+		}
+	}
+
+}
+
+function FCKFocusManager_Win_OnBlur()
+{
+	if ( typeof(FCK) != 'undefined' && FCK.HasFocus )
+	{
+		FCKFocusManager._ResetTimer() ;
+		FCKFocusManager._Timer = window.setTimeout( FCKFocusManager_FireOnBlur, 100 ) ;
+	}
+}
+
+function FCKFocusManager_FireOnBlur()
+{
+	if ( FCKFocusManager.IsLocked )
+		FCKFocusManager._HasPendingBlur = true ;
+	else
+	{
+		FCK.HasFocus = false ;
+		FCK.Events.FireEvent( "OnBlur" ) ;
+	}
+}
+
+function FCKFocusManager_Win_OnFocus_Area()
+{
+	FCK.Focus() ;
+	FCKFocusManager_Win_OnFocus() ;
+}
+
+function FCKFocusManager_Win_OnFocus()
+{
+	FCKFocusManager._ResetTimer() ;
+
+	if ( !FCK.HasFocus && !FCKFocusManager.IsLocked )
+	{
+		FCK.HasFocus = true ;
+		FCK.Events.FireEvent( "OnFocus" ) ;
+	}
+}
Index: /FCKeditor/branches/developers/alfonsoml/editor/_source/internals/fck_gecko.js
===================================================================
--- /FCKeditor/branches/developers/alfonsoml/editor/_source/internals/fck_gecko.js	(revision 67)
+++ /FCKeditor/branches/developers/alfonsoml/editor/_source/internals/fck_gecko.js	(revision 67)
@@ -0,0 +1,227 @@
+/* @Packager.Header
+<FileDescription>
+	Creation and initialization of the "FCK" object. This is the main
+	object that represents an editor instance.
+	(Gecko specific implementations)
+</FileDescription>
+<Author name="Frederico Caldeira Knabben" email="www.fckeditor.net" />
+*/
+
+FCK.Description = "FCKeditor for Gecko Browsers" ;
+
+FCK.InitializeBehaviors = function()
+{
+	// When calling "SetHTML", the editing area IFRAME gets a fixed height. So we must recaulculate it.
+	if ( FCKBrowserInfo.IsGecko )		// Not for Safari/Opera.
+		Window_OnResize() ;
+
+	FCKFocusManager.AddWindow( this.EditorWindow ) ;
+
+	this.ExecOnSelectionChange = function()
+	{
+		FCK.Events.FireEvent( "OnSelectionChange" ) ;
+	}
+
+	this.ExecOnSelectionChangeTimer = function()
+	{
+		if ( FCK.LastOnChangeTimer )
+			window.clearTimeout( FCK.LastOnChangeTimer ) ;
+
+		FCK.LastOnChangeTimer = window.setTimeout( FCK.ExecOnSelectionChange, 100 ) ;
+	}
+
+	this.EditorDocument.addEventListener( 'mouseup', this.ExecOnSelectionChange, false ) ;
+
+	// On Gecko, firing the "OnSelectionChange" event on every key press started to be too much
+	// slow. So, a timer has been implemented to solve performance issues when tipying to quickly.
+	this.EditorDocument.addEventListener( 'keyup', this.ExecOnSelectionChangeTimer, false ) ;
+
+	this._DblClickListener = function( e )
+	{
+		FCK.OnDoubleClick( e.target ) ;
+		e.stopPropagation() ;
+	}
+	this.EditorDocument.addEventListener( 'dblclick', this._DblClickListener, true ) ;
+
+	// Reset the context menu.
+	FCK.ContextMenu._InnerContextMenu.SetMouseClickWindow( FCK.EditorWindow ) ;
+	FCK.ContextMenu._InnerContextMenu.AttachToElement( FCK.EditorDocument ) ;
+}
+
+FCK.MakeEditable = function()
+{
+	this.EditingArea.MakeEditable() ;
+}
+
+// Disable the context menu in the editor (outside the editing area).
+function Document_OnContextMenu( e )
+{
+	if ( !e.target._FCKShowContextMenu )
+		e.preventDefault() ;
+}
+document.oncontextmenu = Document_OnContextMenu ;
+
+// GetNamedCommandState overload for Gecko.
+FCK._BaseGetNamedCommandState = FCK.GetNamedCommandState ;
+FCK.GetNamedCommandState = function( commandName )
+{
+	switch ( commandName )
+	{
+		case 'Unlink' :
+			return FCKSelection.HasAncestorNode('A') ? FCK_TRISTATE_OFF : FCK_TRISTATE_DISABLED ;
+		default :
+			return FCK._BaseGetNamedCommandState( commandName ) ;
+	}
+}
+
+// Named commands to be handled by this browsers specific implementation.
+FCK.RedirectNamedCommands = 
+{
+	Print	: true,
+	Paste	: true,
+	Cut		: true,
+	Copy	: true
+}
+
+// ExecuteNamedCommand overload for Gecko.
+FCK.ExecuteRedirectedNamedCommand = function( commandName, commandParameter )
+{
+	switch ( commandName )
+	{
+		case 'Print' :
+			FCK.EditorWindow.print() ;
+			break ;
+		case 'Paste' :
+			try			{ if ( FCK.Paste() ) FCK.ExecuteNamedCommand( 'Paste', null, true ) ; }
+			catch (e)	{ alert(FCKLang.PasteErrorPaste) ; }
+			break ;
+		case 'Cut' :
+			try			{ FCK.ExecuteNamedCommand( 'Cut', null, true ) ; }
+			catch (e)	{ alert(FCKLang.PasteErrorCut) ; }
+			break ;
+		case 'Copy' :
+			try			{ FCK.ExecuteNamedCommand( 'Copy', null, true ) ; }
+			catch (e)	{ alert(FCKLang.PasteErrorCopy) ; }
+			break ;			
+		default :
+			FCK.ExecuteNamedCommand( commandName, commandParameter ) ;
+	}
+}
+
+FCK.AttachToOnSelectionChange = function( functionPointer )
+{
+	this.Events.AttachEvent( 'OnSelectionChange', functionPointer ) ;
+}
+
+FCK.Paste = function()
+{
+	if ( FCKConfig.ForcePasteAsPlainText )
+	{
+		FCK.PasteAsPlainText() ;	
+		return false ;
+	}
+	
+	/* For now, the AutoDetectPasteFromWord feature is IE only. */
+	
+	return true ;
+}
+
+//**
+// FCK.InsertHtml: Inserts HTML at the current cursor location. Deletes the
+// selected content if any.
+FCK.InsertHtml = function( html )
+{
+	html = FCKConfig.ProtectedSource.Protect( html ) ;
+	html = FCK.ProtectUrls( html ) ;
+
+	// Delete the actual selection.
+	var oSel = FCKSelection.Delete() ;
+	
+	// Get the first available range.
+	var oRange = oSel.getRangeAt(0) ;
+	
+	// Create a fragment with the input HTML.
+	var oFragment = oRange.createContextualFragment( html ) ;
+	
+	// Get the last available node.
+	var oLastNode = oFragment.lastChild ;
+
+	// Insert the fragment in the range.
+	oRange.insertNode(oFragment) ;
+	
+	// Set the cursor after the inserted fragment.
+	FCKSelection.SelectNode( oLastNode ) ;
+	FCKSelection.Collapse( false ) ;
+	
+	this.Focus() ;
+}
+
+FCK.InsertElement = function( element )
+{
+	// Deletes the actual selection.
+	var oSel = FCKSelection.Delete() ;
+	
+	// Gets the first available range.
+	var oRange = oSel.getRangeAt(0) ;
+	
+	// Inserts the element in the range.
+	oRange.insertNode( element ) ;
+	
+	// Set the cursor after the inserted fragment.
+	FCKSelection.SelectNode( element ) ;
+	FCKSelection.Collapse( false ) ;
+
+	this.Focus() ;
+}
+
+FCK.PasteAsPlainText = function()
+{
+	// TODO: Implement the "Paste as Plain Text" code.
+	
+	FCKDialog.OpenDialog( 'FCKDialog_Paste', FCKLang.PasteAsText, 'dialog/fck_paste.html', 400, 330, 'PlainText' ) ;
+	
+/*
+	var sText = FCKTools.HTMLEncode( clipboardData.getData("Text") ) ;
+	sText = sText.replace( /\n/g, '<BR>' ) ;
+	this.InsertHtml( sText ) ;	
+*/
+}
+/*
+FCK.PasteFromWord = function()
+{
+	// TODO: Implement the "Paste as Plain Text" code.
+	
+	FCKDialog.OpenDialog( 'FCKDialog_Paste', FCKLang.PasteFromWord, 'dialog/fck_paste.html', 400, 330, 'Word' ) ;
+
+//	FCK.CleanAndPaste( FCK.GetClipboardHTML() ) ;
+}
+*/
+FCK.GetClipboardHTML = function()
+{
+	return '' ;
+}
+
+FCK.CreateLink = function( url )
+{	
+	FCK.ExecuteNamedCommand( 'Unlink' ) ;
+	
+	if ( url.length > 0 )
+	{
+		// Generate a temporary name for the link.
+		var sTempUrl = 'javascript:void(0);/*' + ( new Date().getTime() ) + '*/' ;
+		
+		// Use the internal "CreateLink" command to create the link.
+		FCK.ExecuteNamedCommand( 'CreateLink', sTempUrl ) ;
+
+		// Retrieve the just created link using XPath.
+		var oLink = this.EditorDocument.evaluate("//a[@href='" + sTempUrl + "']", this.EditorDocument.body, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue ;
+		
+		if ( oLink )
+		{
+			oLink.href = url ;
+			return oLink ;
+		}
+	}
+
+	return null ;
+}
Index: /FCKeditor/branches/developers/alfonsoml/editor/_source/internals/fck_ie.js
===================================================================
--- /FCKeditor/branches/developers/alfonsoml/editor/_source/internals/fck_ie.js	(revision 67)
+++ /FCKeditor/branches/developers/alfonsoml/editor/_source/internals/fck_ie.js	(revision 67)
@@ -0,0 +1,324 @@
+/* @Packager.Header
+<FileDescription>
+	Creation and initialization of the "FCK" object. This is the main
+	object that represents an editor instance.
+	(IE specific implementations)
+</FileDescription>
+<Author name="Frederico Caldeira Knabben" email="www.fckeditor.net" />
+*/
+
+FCK.Description = "FCKeditor for Internet Explorer 5.5+" ;
+
+FCK._GetBehaviorsStyle = function()
+{
+	if ( !FCK._BehaviorsStyle )
+	{
+		var sBasePath = FCKConfig.FullBasePath ;
+		var sTableBehavior = '' ;
+		var sStyle ;
+		
+		// The behaviors should be pointed using the FullBasePath to avoid security
+		// errors when using a differente BaseHref.
+		sStyle =
+			'<style type="text/css" _fcktemp="true">' +
+			'INPUT { behavior: url(' + sBasePath + 'css/behaviors/hiddenfield.htc) ; }' ;
+
+		if ( FCKConfig.ShowBorders )
+			sTableBehavior = 'url(' + sBasePath + 'css/behaviors/showtableborders.htc)' ;
+
+		// Disable resize handlers.
+		sStyle += 'INPUT,TEXTAREA,SELECT,.FCK__Anchor,.FCK__PageBreak' ;
+
+		if ( FCKConfig.DisableObjectResizing )
+		{
+			sStyle += ',IMG' ;
+			sTableBehavior += ' url(' + sBasePath + 'css/behaviors/disablehandles.htc)' ;
+		}
+		
+		sStyle += ' { behavior: url(' + sBasePath + 'css/behaviors/disablehandles.htc) ; }' ;
+
+		if ( sTableBehavior.length > 0 )
+			sStyle += 'TABLE { behavior: ' + sTableBehavior + ' ; }' ;
+
+		sStyle += '</style>' ;
+		FCK._BehaviorsStyle = sStyle ;
+	}
+	
+	return FCK._BehaviorsStyle ;
+}
+
+function Doc_OnMouseUp()
+{
+	if ( FCK.EditorWindow.event.srcElement.tagName == 'HTML' )
+	{
+		FCK.Focus() ;
+		FCK.EditorWindow.event.cancelBubble	= true ;
+		FCK.EditorWindow.event.returnValue	= false ;
+	}
+}
+
+function Doc_OnPaste()
+{
+	return ( FCK.Status == FCK_STATUS_COMPLETE && FCK.Events.FireEvent( "OnPaste" ) ) ;
+}
+
+function Doc_OnKeyDown()
+{
+	var e = FCK.EditorWindow.event ;
+	
+	if ( !( e.keyCode >=16 && e.keyCode <= 18 ) )
+		Doc_OnKeyDownUndo() ;
+	return true ;
+}
+
+function Doc_OnKeyDownUndo()
+{
+	if ( !FCKUndo.Typing )
+	{
+		FCKUndo.SaveUndoStep() ;
+		FCKUndo.Typing = true ;
+		FCK.Events.FireEvent( "OnSelectionChange" ) ;
+	}
+	
+	FCKUndo.TypesCount++ ;
+
+	if ( FCKUndo.TypesCount > FCKUndo.MaxTypes )
+	{
+		FCKUndo.TypesCount = 0 ;
+		FCKUndo.SaveUndoStep() ;
+	}
+}
+
+function Doc_OnDblClick()
+{
+	FCK.OnDoubleClick( FCK.EditorWindow.event.srcElement ) ;
+	FCK.EditorWindow.event.cancelBubble = true ;
+}
+
+function Doc_OnSelectionChange()
+{
+	FCK.Events.FireEvent( "OnSelectionChange" ) ;
+}
+
+FCK.InitializeBehaviors = function( dontReturn )
+{
+	// Set the focus to the editable area when clicking in the document area.
+	// TODO: The cursor must be positioned at the end.
+	this.EditorDocument.attachEvent( 'onmouseup', Doc_OnMouseUp ) ;
+
+	// Intercept pasting operations
+	this.EditorDocument.body.attachEvent( 'onpaste', Doc_OnPaste ) ;
+
+	// Reset the context menu.
+	FCK.ContextMenu._InnerContextMenu.AttachToElement( FCK.EditorDocument.body ) ;
+
+	// Build the "TAB" key replacement (if necessary).
+	if ( FCKConfig.TabSpaces > 0 )
+	{
+		window.FCKTabHTML = '' ;
+		for ( i = 0 ; i < FCKConfig.TabSpaces ; i++ )
+			window.FCKTabHTML += "&nbsp;" ;
+	}
+	this.EditorDocument.attachEvent("onkeydown", Doc_OnKeyDown ) ;
+
+	this.EditorDocument.attachEvent("ondblclick", Doc_OnDblClick ) ;
+
+	// Catch cursor selection changes.
+	this.EditorDocument.attachEvent("onselectionchange", Doc_OnSelectionChange ) ;
+}
+
+FCK.InsertHtml = function( html )
+{
+	html = FCKConfig.ProtectedSource.Protect( html ) ;
+	html = FCK.ProtectUrls( html ) ;
+
+//	FCK.Focus() ;
+	FCK.EditorWindow.focus() ;
+
+	FCKUndo.SaveUndoStep() ;
+
+	// Gets the actual selection.
+	var oSel = FCK.EditorDocument.selection ;
+
+	// Deletes the actual selection contents.
+	if ( oSel.type.toLowerCase() == 'control' )
+		oSel.clear() ;
+
+	// Insert the HTML.
+	oSel.createRange().pasteHTML( html ) ;
+	
+	FCKDocumentProcessor.Process( FCK.EditorDocument ) ;
+}
+
+FCK.SetInnerHtml = function( html )		// IE Only
+{
+	var oDoc = FCK.EditorDocument ;
+	// Using the following trick, any comment in the begining of the HTML will
+	// be preserved.
+	oDoc.body.innerHTML = '<div id="__fakeFCKRemove__">&nbsp;</div>' + html ;
+	oDoc.getElementById('__fakeFCKRemove__').removeNode( true ) ;
+}
+
+var FCK_PreloadImages_Count = 0 ;
+var FCK_PreloadImages_Images = new Array() ;
+
+function FCK_PreloadImages()
+{
+	// Get the images to preload.
+	var aImages = FCKConfig.PreloadImages || [] ;
+	
+	if ( typeof( aImages ) == 'string' )
+		aImages = aImages.split( ';' ) ;
+
+	// Add the skin icons strip.
+	aImages.push( FCKConfig.SkinPath + 'fck_strip.gif' ) ;
+	
+	FCK_PreloadImages_Count = aImages.length ;
+
+	var aImageElements = new Array() ;
+	
+	for ( var i = 0 ; i < aImages.length ; i++ )
+	{
+		var eImg = document.createElement( 'img' ) ;
+		eImg.onload = eImg.onerror = FCK_PreloadImages_OnImage ;
+		eImg.src = aImages[i] ;
+		
+		FCK_PreloadImages_Images[i] = eImg ;
+	}
+}
+
+function FCK_PreloadImages_OnImage()
+{
+	if ( (--FCK_PreloadImages_Count) == 0 )
+		FCKTools.RunFunction( LoadToolbarSetup ) ;
+}
+
+// Disable the context menu in the editor (outside the editing area).
+function Document_OnContextMenu()
+{
+	return ( event.srcElement._FCKShowContextMenu == true ) ;
+}
+document.oncontextmenu = Document_OnContextMenu ;
+
+function FCK_Cleanup()
+{
+	this.EditorWindow = null ;
+	this.EditorDocument = null ;
+}
+
+FCK.Paste = function()
+{
+	if ( FCKConfig.ForcePasteAsPlainText )
+	{
+		FCK.PasteAsPlainText() ;	
+		return false ;
+	}
+
+	var sHTML = FCK.GetClipboardHTML() ;
+
+	if ( FCKConfig.AutoDetectPasteFromWord && sHTML.length > 0 )
+	{
+		var re = /<\w[^>]*(( class="?MsoNormal"?)|(="mso-))/gi ;
+		if ( re.test( sHTML ) )
+		{
+			if ( confirm( FCKLang.PasteWordConfirm ) )
+			{
+				FCK.PasteFromWord() ;
+				return false ;
+			}
+		}
+	}
+
+	// Instead of inserting the retrieved HTML, let's leave the OS work for us
+	// and paste the content (return true);
+	// FCK.InsertHtml( sHTML ) ;
+
+	return true ;
+}
+
+FCK.PasteAsPlainText = function()
+{
+	// Get the data available in the clipboard and encodes it in HTML.
+	var sText = clipboardData.getData("Text") ;
+
+	if ( sText && sText.length > 0 )
+	{
+		// Replace the carriage returns with <BR>
+		sText = FCKTools.HTMLEncode( sText ).replace( /\n/g, '<BR>' ) ;
+		
+		// Insert the resulting data in the editor.
+		this.InsertHtml( sText ) ;
+	}
+}
+
+FCK.InsertElement = function( element )
+{
+	FCK.InsertHtml( element.outerHTML ) ;
+}
+
+FCK.GetClipboardHTML = function()
+{
+	var oDiv = document.getElementById( '___FCKHiddenDiv' ) ;
+	
+	if ( !oDiv )
+	{
+		var oDiv = document.createElement( 'DIV' ) ;
+		oDiv.id = '___FCKHiddenDiv' ;
+		
+		var oDivStyle = oDiv.style ;
+		oDivStyle.position		= 'absolute' ;
+		oDivStyle.visibility	= oDivStyle.overflow	= 'hidden' ;
+		oDivStyle.width			= oDivStyle.height		= 1 ;
+	
+		document.body.appendChild( oDiv ) ;
+	}
+	
+	oDiv.innerHTML = '' ;
+	
+	var oTextRange = document.body.createTextRange() ;
+	oTextRange.moveToElementText( oDiv ) ;
+	oTextRange.execCommand( 'Paste' ) ;
+	
+	var sData = oDiv.innerHTML ;
+	oDiv.innerHTML = '' ;
+	
+	return sData ;
+}
+
+FCK.AttachToOnSelectionChange = function( functionPointer )
+{
+	this.Events.AttachEvent( 'OnSelectionChange', functionPointer ) ;
+}
+
+FCK.CreateLink = function( url )
+{
+	// Remove any existing link in the selection.
+	FCK.ExecuteNamedCommand( 'Unlink' ) ;
+
+	if ( url.length > 0 )
+	{
+		// Generate a temporary name for the link.
+		var sTempUrl = 'javascript:void(0);/*' + ( new Date().getTime() ) + '*/' ;
+		
+		// Use the internal "CreateLink" command to create the link.
+		FCK.ExecuteNamedCommand( 'CreateLink', sTempUrl ) ;
+
+		// Look for the just create link.
+		var oLinks = this.EditorDocument.links ;
+
+		for ( i = 0 ; i < oLinks.length ; i++ )
+		{
+			var oLink = oLinks[i] ;
+			
+			if ( oLink.href == sTempUrl )
+			{
+				var sInnerHtml = oLink.innerHTML ;	// Save the innerHTML (IE changes it if it is like an URL).
+				oLink.href = url ;
+				oLink.innerHTML = sInnerHtml ;		// Restore the innerHTML.
+				return oLink ;
+			}
+		}
+	}
+
+	return null ;
+}
Index: /FCKeditor/branches/developers/alfonsoml/editor/_source/internals/fckcodeformatter.js
===================================================================
--- /FCKeditor/branches/developers/alfonsoml/editor/_source/internals/fckcodeformatter.js	(revision 66)
+++ /FCKeditor/branches/developers/alfonsoml/editor/_source/internals/fckcodeformatter.js	(revision 67)
@@ -47,5 +47,5 @@
 	
 	// Line breaks.
-	sFormatted		= sFormatted.replace( this.Regex.BlocksOpener, '\n$&' ) ; ;
+	sFormatted		= sFormatted.replace( this.Regex.BlocksOpener, '\n$&' ) ;
 	sFormatted		= sFormatted.replace( this.Regex.BlocksCloser, '$&\n' ) ;
 	sFormatted		= sFormatted.replace( this.Regex.NewLineTags, '$&\n' ) ;
Index: /FCKeditor/branches/developers/alfonsoml/editor/_source/internals/fckselection_ie.js
===================================================================
--- /FCKeditor/branches/developers/alfonsoml/editor/_source/internals/fckselection_ie.js	(revision 66)
+++ /FCKeditor/branches/developers/alfonsoml/editor/_source/internals/fckselection_ie.js	(revision 67)
@@ -32,5 +32,5 @@
 			return FCKSelection.GetSelectedElement().parentElement ;
 		case 'None' :
-			return ;
+			return null ;
 		default :
 			return FCK.EditorDocument.selection.createRange().parentElement() ;
Index: /FCKeditor/branches/developers/alfonsoml/editor/_source/internals/fcktools.js
===================================================================
--- /FCKeditor/branches/developers/alfonsoml/editor/_source/internals/fcktools.js	(revision 66)
+++ /FCKeditor/branches/developers/alfonsoml/editor/_source/internals/fcktools.js	(revision 67)
@@ -196,3 +196,2 @@
 	return new fCloneCreator ;
 }
-
Index: /FCKeditor/branches/developers/alfonsoml/editor/_source/internals/fcktools_ie.js
===================================================================
--- /FCKeditor/branches/developers/alfonsoml/editor/_source/internals/fcktools_ie.js	(revision 66)
+++ /FCKeditor/branches/developers/alfonsoml/editor/_source/internals/fcktools_ie.js	(revision 67)
@@ -68,4 +68,5 @@
 		FCKLang.NoActiveX = null ;
 	}
+	return null ;
 }
 
@@ -75,5 +76,6 @@
 
 	var e, i = 0 ;
-	while ( e = element.all[ i++ ] )
+	// The extra () is to avoid a warning with strict error checking. This is ok.
+	while ( (e = element.all[ i++ ]) )
 	{
 		switch ( e.tagName )
Index: /FCKeditor/branches/developers/alfonsoml/editor/fckeditor.html
===================================================================
--- /FCKeditor/branches/developers/alfonsoml/editor/fckeditor.html	(revision 66)
+++ /FCKeditor/branches/developers/alfonsoml/editor/fckeditor.html	(revision 67)
@@ -47,5 +47,7 @@
 LoadScript( '_source/internals/fckbrowserinfo.js' ) ;
 LoadScript( '_source/internals/fckurlparams.js' ) ;
+LoadScript( '_source/classes/fckevents.js' ) ;
 LoadScript( '_source/internals/fck.js' ) ;
+LoadScript( '_source/internals/fck_' + sSuffix + '.js' ) ;
 LoadScript( '_source/internals/fckconfig.js' ) ;
 
@@ -57,5 +59,4 @@
 LoadScript( '_source/internals/fckregexlib.js' ) ;
 LoadScript( '_source/internals/fcklanguagemanager.js' ) ;
-LoadScript( '_source/classes/fckevents.js' ) ;
 LoadScript( '_source/internals/fckxhtmlentities.js' ) ;
 LoadScript( '_source/internals/fckxhtml.js' ) ;
@@ -74,8 +75,4 @@
 
 LoadScript( '_source/internals/fckdocumentprocessor.js' ) ;
-LoadScript( '_source/internals/fck_1.js' ) ;
-LoadScript( '_source/internals/fck_1_' + sSuffix + '.js' ) ;
-LoadScript( '_source/internals/fck_2.js' ) ;
-LoadScript( '_source/internals/fck_2_' + sSuffix + '.js' ) ;
 LoadScript( '_source/internals/fckselection.js' ) ;
 LoadScript( '_source/internals/fckselection_' + sSuffix + '.js' ) ;
