Index: /FCKeditor/trunk/editor/_source/classes/fckdomrange.js
===================================================================
--- /FCKeditor/trunk/editor/_source/classes/fckdomrange.js	(revision 307)
+++ /FCKeditor/trunk/editor/_source/classes/fckdomrange.js	(revision 308)
@@ -181,5 +181,5 @@
 
 		var bIsEndOfBlock = oTestRange.CheckIsCollapsed() ;
-		
+
 		if ( !bIsEndOfBlock )
 		{
@@ -188,5 +188,5 @@
 			oTestRange._Range.cloneContents().AppendTo( eToolDiv ) ;
 			FCKDomTools.TrimNode( eToolDiv, true ) ;
-			
+
 			// Find out if we are in an empty tree of inline elements, like <b><i><span></span></i></b>
 			bIsEndOfBlock = true ;
@@ -206,5 +206,5 @@
 			}
 		}
-		
+
 		oTestRange.Release() ;
 
@@ -273,4 +273,12 @@
 		else
 			this.Collapse( true ) ;
+
+		this._UpdateElementInfo() ;
+	},
+
+	MoveToPosition : function( targetElement, position )
+	{
+		this.SetStart( targetElement, position ) ;
+		this.Collapse( true ) ;
 	},
 
@@ -442,4 +450,112 @@
 	},
 
+	SplitBlock : function()
+	{
+		if ( !this._Range )
+			this.MoveToSelection() ;
+
+		// The selection boundaries must be in the same "block limit" element.
+		if ( this.StartBlockLimit == this.EndBlockLimit )
+		{
+			// Get the current blocks.
+			var eStartBlock		= this.StartBlock ;
+			var eEndBlock		= this.EndBlock ;
+
+			if ( FCKConfig.EnterMode != 'br' )
+			{
+				if ( !eStartBlock )
+				{
+					eStartBlock = this._FixBlock( true ) ;
+					eEndBlock	= this.EndBlock ;	// _FixBlock may have fixed the EndBlock too.
+				}
+
+				if ( !eEndBlock )
+					eEndBlock = this._FixBlock( false ) ;
+			}
+
+			var bIsStartOfBlock	= ( eStartBlock != null && this.CheckStartOfBlock() ) ;
+			var bIsEndOfBlock	= ( eEndBlock != null && this.CheckEndOfBlock() ) ;
+
+			// Delete the current selection.
+			if ( !this.CheckIsEmpty() )
+				this.DeleteContents() ;
+
+			if ( eStartBlock && eEndBlock &&  eStartBlock == eEndBlock )
+			{
+				if ( bIsStartOfBlock )
+				{
+					this.MoveToPosition( eStartBlock, 3 ) ;
+					eStartBlock = null ;
+				}
+				else if ( bIsEndOfBlock )
+				{
+					this.MoveToPosition( eEndBlock, 4 ) ;
+					eEndBlock = null ;
+				}
+				else
+				{
+					// Extract the contents of the block from the selection point to the end of its contents.
+					this.SetEnd( eStartBlock, 2 ) ;
+					var eDocFrag = this.ExtractContents() ;
+					FCKDomTools.TrimNode( eDocFrag.RootNode ) ;
+
+					// Duplicate the block element after it.
+					eEndBlock = eStartBlock.cloneNode( false ) ;
+
+					// Place the extracted contents in the duplicated block.
+					eDocFrag.AppendTo( eEndBlock ) ;
+
+					FCKDomTools.InsertAfterNode( eStartBlock, eEndBlock ) ;
+
+					this.MoveToPosition( eStartBlock, 4 ) ;
+				}
+			}
+
+			if ( FCKBrowserInfo.IsGecko )
+			{
+				// In Gecko, the last child node must be a bogus <br>.
+				FCKTools.AppendBogusBr( eStartBlock ) ;
+				FCKTools.AppendBogusBr( eEndBlock ) ;
+			}
+
+			return {
+				PreviousBlock	: eStartBlock,
+				NextBlock		: eEndBlock,
+				WasStartOfBlock : bIsStartOfBlock,
+				WasEndOfBlock	: bIsEndOfBlock
+			} ;
+		}
+
+		return null ;
+	},
+
+	// Transform a block without a block tag in a valid block (orphan text in the body or td, usually).
+	_FixBlock : function( isStart )
+	{
+		// Bookmark the range so we can restore it later.
+		var oBookmark = this.CreateBookmark() ;
+
+		// Collapse the range to the requested ending boundary.
+		this.Collapse( isStart ) ;
+
+		// Expands it to the block contents.
+		this.Expand( 'block_contents' ) ;
+
+		// Create the fixed block.
+		var oFixedBlock = this.Window.document.createElement( FCKConfig.EnterMode ) ;
+
+		// Move the contents of the temporary range to the fixed block.
+		this.ExtractContents().AppendTo( oFixedBlock ) ;
+		FCKDomTools.TrimNode( oFixedBlock ) ;
+
+		// Insert the fixed block into the DOM.
+		this.InsertNode( oFixedBlock ) ;
+
+		// Move the range back to the bookmarked place.
+		this.MoveToBookmark( oBookmark ) ;
+
+		return oFixedBlock ;
+	},
+
 	Release : function( preserveWindow )
 	{
Index: /FCKeditor/trunk/editor/_source/classes/fckenterkey.js
===================================================================
--- /FCKeditor/trunk/editor/_source/classes/fckenterkey.js	(revision 307)
+++ /FCKeditor/trunk/editor/_source/classes/fckenterkey.js	(revision 308)
@@ -285,136 +285,76 @@
 	var oRange = range || new FCKDomRange( this.Window ) ;
 
-	// If we don't have a range, move it to the selection.
-	if ( !range )
-		oRange.MoveToSelection() ;
-
-	// The selection boundaries must be in the same "block limit" element.
-	if ( oRange.StartBlockLimit == oRange.EndBlockLimit )
-	{
-		// If the StartBlock or EndBlock are not available (for text without a
-		// block tag), we must fix them, by moving the text to a block.
-		if ( !oRange.StartBlock )
-			this._FixBlock( oRange, true, blockTag ) ;
-
-		if ( !oRange.EndBlock )
-			this._FixBlock( oRange, false, blockTag ) ;
-
+	var oSplitInfo = oRange.SplitBlock() ;
+
+	if ( oSplitInfo )
+	{
 		// Get the current blocks.
-		var eStartBlock	= oRange.StartBlock ;
-		var eEndBlock	= oRange.EndBlock ;
-
-		// Delete the current selection.
-		if ( !oRange.CheckIsEmpty() )
-			oRange.DeleteContents() ;
-
-		// If the selection boundaries are in the same block element
-		if ( eStartBlock == eEndBlock )
-		{
+		var ePreviousBlock	= oSplitInfo.PreviousBlock ;
+		var eNextBlock		= oSplitInfo.NextBlock ;
+
+		var bIsStartOfBlock	= oSplitInfo.WasStartOfBlock ;
+		var bIsEndOfBlock	= oSplitInfo.WasEndOfBlock ;
+
+		// If we have both the previous and next blocks, it means that the
+		// boundaries were on separated blocks, or none of them where on the
+		// block limits (start/end).
+		if ( !oSplitInfo.WasStartOfBlock && !oSplitInfo.WasEndOfBlock )
+		{
+			// Move the selection to the end block.
+			if ( eNextBlock )
+				oRange.MoveToElementEditStart( eNextBlock ) ;
+		}
+		else
+		{
+			if ( bIsStartOfBlock && bIsEndOfBlock && eNextBlock.tagName.toUpperCase() == 'LI' )
+			{
+				oRange.MoveToElementStart( eNextBlock ) ;
+				this._OutdentWithSelection( eNextBlock, oRange ) ;
+				oRange.Release() ;
+				return true ;
+			}
+
 			var eNewBlock ;
 
-			var bIsStartOfBlock	= oRange.CheckStartOfBlock() ;
-			var bIsEndOfBlock	= oRange.CheckEndOfBlock() ;
-
-			if ( bIsStartOfBlock && !bIsEndOfBlock )
-			{
-				eNewBlock = eStartBlock.cloneNode(false) ;
-
-				if ( FCKBrowserInfo.IsGeckoLike )
-					eNewBlock.innerHTML = GECKO_BOGUS ;
-
-				// Place the new block before the current block element.
-				eStartBlock.parentNode.insertBefore( eNewBlock, eStartBlock ) ;
-
-				// This is tricky, but to make the new block visible correctly
-				// we must select it.
-				if ( FCKBrowserInfo.IsIE )
-				{
-					// Move the selection to the new block.
-					oRange.MoveToNodeContents( eNewBlock ) ;
-
-					oRange.Select() ;
-				}
-
-				// Move the selection to the new block.
-				oRange.MoveToElementEditStart( eStartBlock ) ;
-			}
-			else
-			{
-				// Check if the selection is at the end of the block.
-				if ( bIsEndOfBlock )
-				{
-					var sStartBlockTag = eStartBlock.tagName.toUpperCase() ;
-
-					// If the entire block is selected, and we are in a LI, let's decrease its indentation.
-					if ( bIsStartOfBlock && sStartBlockTag == 'LI' )
-					{
-						this._OutdentWithSelection( eStartBlock, oRange ) ;
-						oRange.Release() ;
-						return true ;
-					}
-					else
-					{
-						// If is a header tag, or we are in a Shift+Enter (#77),
-						// create a new block element.
-						if ( (/^H[1-6]$/).test( sStartBlockTag ) || this._HasShift )
-							eNewBlock = this.Window.document.createElement( blockTag ) ;
-						// Otherwise, duplicate the current block.
-						else
-						{
-							eNewBlock = eStartBlock.cloneNode(false) ;
-							this._RecreateEndingTree( eStartBlock, eNewBlock ) ;
-						}
-
-						if ( FCKBrowserInfo.IsGeckoLike )
-						{
-							eNewBlock.innerHTML = GECKO_BOGUS ;
-
-							// If the entire block is selected, let's add a bogus in the start block.
-							if ( bIsStartOfBlock )
-								eStartBlock.innerHTML = GECKO_BOGUS ;
-						}
-					}
-				}
+			if ( ePreviousBlock )
+			{
+				var sPreviousBlockTag = ePreviousBlock.tagName.toUpperCase() ;
+
+				// If is a header tag, or we are in a Shift+Enter (#77),
+				// create a new block element.
+				if ( this._HasShift || (/^H[1-6]$/).test( sPreviousBlockTag ) )
+					eNewBlock = this.Window.document.createElement( blockTag ) ;
 				else
 				{
-					// Extract the contents of the block from the selection point to the end of its contents.
-					oRange.SetEnd( eStartBlock, 2 ) ;
-					var eDocFrag = oRange.ExtractContents() ;
-
-					// Duplicate the block element after it.
-					eNewBlock = eStartBlock.cloneNode(false) ;
-
-					// It could be that we are in a LI with a child UL/OL. Insert a bogus to give us space to type.
-					FCKDomTools.TrimNode( eDocFrag.RootNode ) ;
-					if ( eDocFrag.RootNode.firstChild.nodeType == 1 && eDocFrag.RootNode.firstChild.tagName.toUpperCase().Equals( 'UL', 'OL' ) )
-						eNewBlock.innerHTML = GECKO_BOGUS ;
-
-					// Place the extracted contents in the duplicated block.
-					eDocFrag.AppendTo( eNewBlock ) ;
-
-					if ( FCKBrowserInfo.IsGecko )
-					{
-						// In Gecko, the last child node must be a bogus <br>.
-						this._AppendBogusBr( eStartBlock ) ;
-						this._AppendBogusBr( eNewBlock ) ;
-					}
+					// Otherwise, duplicate the previous block.
+					eNewBlock = ePreviousBlock.cloneNode( false ) ;
+					this._RecreateEndingTree( ePreviousBlock, eNewBlock ) ;
 				}
-
-				if ( eNewBlock )
-				{
-					FCKDomTools.InsertAfterNode( eStartBlock, eNewBlock ) ;
-
-					// Move the selection to the new block.
-					oRange.MoveToElementEditStart( eNewBlock ) ;
-
-					if ( FCKBrowserInfo.IsGecko )
-						eNewBlock.scrollIntoView( false ) ;
-				}
-			}
-		}
-		else
-		{
-			// Move the selection to the end block.
-			oRange.MoveToElementEditStart( eEndBlock ) ;
+			}
+			else if ( eNextBlock )
+			{
+				eNewBlock = eNextBlock.cloneNode( false ) ;
+			}
+			else
+				eNewBlock = this.Window.document.createElement( blockTag ) ;
+
+			if ( FCKBrowserInfo.IsGeckoLike )
+				eNewBlock.innerHTML = GECKO_BOGUS ;
+
+			oRange.InsertNode( eNewBlock ) ;
+
+			// This is tricky, but to make the new block visible correctly
+			// we must select it.
+			if ( FCKBrowserInfo.IsIE )
+			{
+				// Move the selection to the new block.
+				oRange.MoveToNodeContents( eNewBlock ) ;
+				oRange.Select() ;
+			}
+
+			oRange.MoveToElementEditStart( bIsStartOfBlock ? eNextBlock : eNewBlock ) ;
+
+			if ( FCKBrowserInfo.IsGecko )
+				eNewBlock.scrollIntoView( false ) ;
 		}
 
@@ -455,6 +395,4 @@
 		if ( !bHasShift && bIsEndOfBlock && (/^H[1-6]$/).test( sStartBlockTag ) )
 		{
-			FCKDebug.Output( 'BR - Header' ) ;
-
 			// Insert a BR after the current paragraph.
 			FCKDomTools.InsertAfterNode( oRange.StartBlock, this.Window.document.createElement( 'br' ) ) ;
@@ -469,6 +407,4 @@
 		else
 		{
-			FCKDebug.Output( 'BR - No Header' ) ;
-
 			var eBr = this.Window.document.createElement( 'br' ) ;
 
@@ -481,5 +417,5 @@
 			// If we are at the end of a block, we must be sure the bogus node is available in that block.
 			if ( bIsEndOfBlock && FCKBrowserInfo.IsGecko )
-				this._AppendBogusBr( eBr.parentNode ) ;
+				FCKTools.AppendBogusBr( eBr.parentNode ) ;
 
 			if ( FCKBrowserInfo.IsIE )
@@ -500,42 +436,4 @@
 
 	return true ;
-}
-
-// Transform a block without a block tag in a valid block (orphan text in the body or td, usually).
-FCKEnterKey.prototype._FixBlock = function( range, isStart, blockTag )
-{
-	// Bookmark the range so we can restore it later.
-	var oBookmark = range.CreateBookmark() ;
-
-	// Collapse the range to the requested ending boundary.
-	range.Collapse( isStart ) ;
-
-	// Expands it to the block contents.
-	range.Expand( 'block_contents' ) ;
-
-	// Create the fixed block.
-	var oFixedBlock = this.Window.document.createElement( blockTag ) ;
-
-	// Move the contents of the temporary range to the fixed block.
-	range.ExtractContents().AppendTo( oFixedBlock ) ;
-	FCKDomTools.TrimNode( oFixedBlock ) ;
-
-	// Insert the fixed block into the DOM.
-	range.InsertNode( oFixedBlock ) ;
-
-	// Move the range back to the bookmarked place.
-	range.MoveToBookmark( oBookmark ) ;
-}
-
-// Appends a bogus <br> at the end of the element, if not yet available.
-FCKEnterKey.prototype._AppendBogusBr = function( element )
-{
-	var eLastChild = element.getElementsByTagName('br') ;
-
-	if ( eLastChild )
-		eLastChild = eLastChild[ eLastChild.legth - 1 ] ;
-
-	if ( !eLastChild || eLastChild.getAttribute( 'type', 2 ) != '_moz' )
-		element.appendChild( FCKTools.CreateBogusBR( this.Window.document ) ) ;
 }
 
Index: /FCKeditor/trunk/editor/_source/commandclasses/fck_othercommands.js
===================================================================
--- /FCKeditor/trunk/editor/_source/commandclasses/fck_othercommands.js	(revision 307)
+++ /FCKeditor/trunk/editor/_source/commandclasses/fck_othercommands.js	(revision 308)
@@ -280,5 +280,5 @@
 
 	var oFakeImage = FCKDocumentProcessor_CreateFakeImage( 'FCK__PageBreak', e ) ;
-	oFakeImage	= FCK.InsertElement( oFakeImage ) ;
+	FCK.InsertElement( oFakeImage ) ;
 }
 
@@ -380,2 +380,21 @@
 	}
 } ;
+
+// FCKRuleCommand
+var FCKRuleCommand = function()
+{
+	this.Name = 'Paste' ;
+}
+
+FCKRuleCommand.prototype =
+{
+	Execute : function()
+	{
+		FCK.InsertElement( 'hr' ) ;
+	},
+
+	GetState : function()
+	{
+		return FCK.GetNamedCommandState( 'InsertHorizotalRule' ) ;
+	}
+} ;
Index: /FCKeditor/trunk/editor/_source/fckjscoreextensions.js
===================================================================
--- /FCKeditor/trunk/editor/_source/fckjscoreextensions.js	(revision 307)
+++ /FCKeditor/trunk/editor/_source/fckjscoreextensions.js	(revision 308)
@@ -76,21 +76,4 @@
 }
 
-Array.prototype.AddItem = function( item )
-{
-	var i = this.length ;
-	this[ i ] = item ;
-	return i ;
-}
-
-Array.prototype.IndexOf = function( value )
-{
-	for ( var i = 0 ; i < this.length ; i++ )
-	{
-		if ( this[i] == value )
-			return i ;
-	}
-	return -1 ;
-}
-
 String.prototype.StartsWith = function( value )
 {
@@ -151,2 +134,19 @@
 	return this.replace( /\n/g, replacement ) ;
 }
+
+Array.prototype.AddItem = function( item )
+{
+	var i = this.length ;
+	this[ i ] = item ;
+	return i ;
+}
+
+Array.prototype.IndexOf = function( value )
+{
+	for ( var i = 0 ; i < this.length ; i++ )
+	{
+		if ( this[i] == value )
+			return i ;
+	}
+	return -1 ;
+}
Index: /FCKeditor/trunk/editor/_source/internals/fck.js
===================================================================
--- /FCKeditor/trunk/editor/_source/internals/fck.js	(revision 307)
+++ /FCKeditor/trunk/editor/_source/internals/fck.js	(revision 308)
@@ -558,29 +558,72 @@
 	},
 
-	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' ) )
+	InsertElement : function( element )
+	{
+		// The parameter may be a string (element name), so transform it in an element.
+		if ( typeof element == 'string' )
+			element = this.EditorDocument.createElement( element ) ;
+		
+		var elementName = element.nodeName.toLowerCase() ;
+
+		// Create a range for the selection. V3 will have a new selection
+		// object that may internaly supply this feature.
+		var range = new FCKDomRange( this.EditorWindow ) ;
+
+		if ( FCKListsLib.BlockElements[ elementName ] != null )
+		{
+			range.SplitBlock() ;
+			range.InsertNode( element ) ;
+			
+			var next = FCKDomTools.GetNextSourceElement( element, false, null, [ 'hr','br','param','img','area','input' ] ) ;
+
+			// Be sure that we have something after the new element, so we can move the cursor there.
+			if ( !next && FCKConfig.EnterMode != 'br')
 			{
-				aEls[i].removeAttribute( 'FCKTempLabel' ) ;
-				return aEls[i] ;
+				next = this.EditorDocument.body.appendChild( this.EditorDocument.createElement( FCKConfig.EnterMode ) ) ;
+				
+				if ( FCKBrowserInfo.IsGecko )
+					next.innerHTML = GECKO_BOGUS ;
 			}
-		}
-		return null ;
+			
+			if ( FCKListsLib.EmptyElements[ elementName ] == null )
+				range.MoveToElementEditStart( element ) ;
+			else if ( next )
+				range.MoveToElementEditStart( next ) ;
+			else
+				range.MoveToPosition( element, 4 ) ;
+
+			if ( FCKBrowserInfo.IsGecko )
+			{
+				if ( next ) 
+					next.scrollIntoView( false ) ;
+				element.scrollIntoView( false ) ;
+			}
+		}
+		else
+		{
+			// Delete the current selection and insert the node.
+			range.MoveToSelection() ;
+			range.DeleteContents() ;
+			range.InsertNode( element ) ;
+
+			// Move the selection right after the new element.
+			// DISCUSSION: Should we select the element instead?
+			range.SetStart( element, 4 ) ;
+			range.SetEnd( element, 4 ) ;
+		}
+
+		range.Select() ;
+		range.Release() ;
+
+		// REMOVE IT: The focus should not really be set here. It is up to the
+		// calling code to reset the focus if needed.
+		this.Focus() ;
+
+		return element ;
+	},
+
+	_InsertBlockElement : function( blockElement )
+	{
 	}
-
 } ;
 
@@ -592,4 +635,7 @@
 // DEPRECATED in favor of "SetData".
 FCK.SetHTML = FCK.SetData ;
+
+// InsertElementAndGetIt and CreateElement are Deprecated : returns the same value as InsertElement.
+FCK.InsertElementAndGetIt = FCK.CreateElement = FCK.InsertElement ;
 
 // Replace all events attributes (like onclick).
Index: /FCKeditor/trunk/editor/_source/internals/fck_gecko.js
===================================================================
--- /FCKeditor/trunk/editor/_source/internals/fck_gecko.js	(revision 307)
+++ /FCKeditor/trunk/editor/_source/internals/fck_gecko.js	(revision 308)
@@ -177,22 +177,4 @@
 }
 
-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()
 {
Index: /FCKeditor/trunk/editor/_source/internals/fck_ie.js
===================================================================
--- /FCKeditor/trunk/editor/_source/internals/fck_ie.js	(revision 307)
+++ /FCKeditor/trunk/editor/_source/internals/fck_ie.js	(revision 308)
@@ -318,9 +318,4 @@
 }
 
-FCK.InsertElement = function( element )
-{
-	FCK.InsertHtml( element.outerHTML ) ;
-}
-
 FCK.GetClipboardHTML = function()
 {
Index: /FCKeditor/trunk/editor/_source/internals/fckcommands.js
===================================================================
--- /FCKeditor/trunk/editor/_source/internals/fckcommands.js	(revision 307)
+++ /FCKeditor/trunk/editor/_source/internals/fckcommands.js	(revision 308)
@@ -70,4 +70,5 @@
 		case 'NewPage'		: oCommand = new FCKNewPageCommand() ; break ;
 		case 'PageBreak'	: oCommand = new FCKPageBreakCommand() ; break ;
+		case 'Rule'			: oCommand = new FCKRuleCommand() ; break ;
 
 		case 'TextColor'	: oCommand = new FCKTextColorCommand('ForeColor') ; break ;
Index: /FCKeditor/trunk/editor/_source/internals/fcklistslib.js
===================================================================
--- /FCKeditor/trunk/editor/_source/internals/fcklistslib.js	(revision 307)
+++ /FCKeditor/trunk/editor/_source/internals/fcklistslib.js	(revision 308)
@@ -32,5 +32,5 @@
 
 	// Block elements that may be filled with &nbsp; if empty.
-	NonEmptyBlockElements : { p:1,div:1,h1:1,h2:1,h3:1,h4:1,h5:1,h6:1,address:1,pre:1,ol:1,ul:1,li:1,td:1,th:1 },
+	NonEmptyBlockElements : { p:1,div:1,form:1,h1:1,h2:1,h3:1,h4:1,h5:1,h6:1,address:1,pre:1,ol:1,ul:1,li:1,td:1,th:1 },
 
 	// Inline elements which MUST have child nodes.
Index: /FCKeditor/trunk/editor/_source/internals/fcktoolbaritems.js
===================================================================
--- /FCKeditor/trunk/editor/_source/internals/fcktoolbaritems.js	(revision 307)
+++ /FCKeditor/trunk/editor/_source/internals/fcktoolbaritems.js	(revision 308)
@@ -83,5 +83,5 @@
 		case 'PageBreak'		: oItem = new FCKToolbarButton( 'PageBreak'		, FCKLang.PageBreakLbl, FCKLang.PageBreak, null, false, true, 43 ) ; break ;
 
-		case 'Rule'				: oItem = new FCKToolbarButton( 'InsertHorizontalRule', FCKLang.InsertLineLbl, FCKLang.InsertLine, null, false, true, 40 ) ; break ;
+		case 'Rule'				: oItem = new FCKToolbarButton( 'Rule'			, FCKLang.InsertLineLbl, FCKLang.InsertLine, null, false, true, 40 ) ; break ;
 
 		case 'JustifyLeft'		: oItem = new FCKToolbarButton( 'JustifyLeft'	, FCKLang.LeftJustify, null, null, false, true, 30 ) ; break ;
Index: /FCKeditor/trunk/editor/_source/internals/fcktools.js
===================================================================
--- /FCKeditor/trunk/editor/_source/internals/fcktools.js	(revision 307)
+++ /FCKeditor/trunk/editor/_source/internals/fcktools.js	(revision 308)
@@ -224,2 +224,22 @@
 	return new fCloneCreator ;
 }
+
+// Appends a bogus <br> at the end of the element, if not yet available.
+FCKTools.AppendBogusBr = function( element )
+{
+	if ( !element )
+		return ;
+
+	var eLastChild = this.GetLastItem( element.getElementsByTagName('br') ) ;
+
+	if ( !eLastChild || eLastChild.getAttribute( 'type', 2 ) != '_moz' )
+		element.appendChild( this.CreateBogusBR( this.GetElementDocument( element ) ) ) ;
+}
+
+FCKTools.GetLastItem = function( list )
+{
+	if ( list.length > 0 )
+		return list[ list.length - 1 ] ;
+
+	return null ;
+}
Index: /FCKeditor/trunk/editor/_source/internals/fckxhtml_ie.js
===================================================================
--- /FCKeditor/trunk/editor/_source/internals/fckxhtml_ie.js	(revision 307)
+++ /FCKeditor/trunk/editor/_source/internals/fckxhtml_ie.js	(revision 308)
@@ -171,5 +171,5 @@
 		FCKXHtml._AppendAttribute( node, 'name', nameAtt.value ) ;
 
-	node = FCKXHtml._AppendChildNodes( node, htmlNode ) ;
+	node = FCKXHtml._AppendChildNodes( node, htmlNode, true ) ;
 
 	return node ;
Index: /FCKeditor/trunk/editor/dialog/fck_anchor.html
===================================================================
--- /FCKeditor/trunk/editor/dialog/fck_anchor.html	(revision 307)
+++ /FCKeditor/trunk/editor/dialog/fck_anchor.html	(revision 308)
@@ -115,5 +115,5 @@
 	{
 		// Nothing was selected, so now just create a normal A
-		oAnchor = oEditor.FCK.CreateElement( 'a' ) ;
+		oAnchor = oEditor.FCK.InsertElement( 'a' ) ;
 	}
 	else
Index: /FCKeditor/trunk/editor/dialog/fck_button.html
===================================================================
--- /FCKeditor/trunk/editor/dialog/fck_button.html	(revision 307)
+++ /FCKeditor/trunk/editor/dialog/fck_button.html	(revision 308)
@@ -62,5 +62,5 @@
 		oActiveEl = oEditor.FCK.EditorDocument.createElement( 'INPUT' ) ;
 		oActiveEl.type = GetE('txtType').value ;
-		oActiveEl = oEditor.FCK.InsertElementAndGetIt( oActiveEl ) ;
+		oActiveEl = oEditor.FCK.InsertElement( oActiveEl ) ;
 	}
 
Index: /FCKeditor/trunk/editor/dialog/fck_checkbox.html
===================================================================
--- /FCKeditor/trunk/editor/dialog/fck_checkbox.html	(revision 307)
+++ /FCKeditor/trunk/editor/dialog/fck_checkbox.html	(revision 308)
@@ -60,5 +60,5 @@
 		oActiveEl = oEditor.FCK.EditorDocument.createElement( 'INPUT' ) ;
 		oActiveEl.type = 'checkbox' ;
-		oActiveEl = oEditor.FCK.InsertElementAndGetIt( oActiveEl ) ;
+		oActiveEl = oEditor.FCK.InsertElement( oActiveEl ) ;
 	}
 
Index: /FCKeditor/trunk/editor/dialog/fck_flash/fck_flash.js
===================================================================
--- /FCKeditor/trunk/editor/dialog/fck_flash/fck_flash.js	(revision 307)
+++ /FCKeditor/trunk/editor/dialog/fck_flash/fck_flash.js	(revision 308)
@@ -134,5 +134,5 @@
 		oFakeImage	= oEditor.FCKDocumentProcessor_CreateFakeImage( 'FCK__Flash', oEmbed ) ;
 		oFakeImage.setAttribute( '_fckflash', 'true', 0 ) ;
-		oFakeImage	= FCK.InsertElementAndGetIt( oFakeImage ) ;
+		oFakeImage	= FCK.InsertElement( oFakeImage ) ;
 	}
 	else
Index: /FCKeditor/trunk/editor/dialog/fck_form.html
===================================================================
--- /FCKeditor/trunk/editor/dialog/fck_form.html	(revision 307)
+++ /FCKeditor/trunk/editor/dialog/fck_form.html	(revision 308)
@@ -1,3 +1,3 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
+﻿<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
 <!--
  * FCKeditor - The text editor for Internet - http://www.fckeditor.net
@@ -58,11 +58,12 @@
 	if ( !oActiveEl )
 	{
-		oActiveEl = oEditor.FCK.EditorDocument.createElement( 'FORM' ) ;
-		oActiveEl = oEditor.FCK.InsertElementAndGetIt( oActiveEl ) ;
-		oActiveEl.innerHTML = '&nbsp;' ;
+		oActiveEl = oEditor.FCK.InsertElement( 'form' ) ;
+
+		if ( oEditor.FCKBrowserInfo.IsGeckoLike )
+			oActiveEl.innerHTML = GECKO_BOGUS ;
 	}
 
 	oActiveEl.name = GetE('txtName').value ;
-	SetAttribute( oActiveEl, 'action'	, GetE('txtAction').value ) ;
+	SetAttribute( oActiveEl, 'action', GetE('txtAction').value ) ;
 	oActiveEl.method = GetE('txtMethod').value ;
 
Index: /FCKeditor/trunk/editor/dialog/fck_hiddenfield.html
===================================================================
--- /FCKeditor/trunk/editor/dialog/fck_hiddenfield.html	(revision 307)
+++ /FCKeditor/trunk/editor/dialog/fck_hiddenfield.html	(revision 308)
@@ -80,5 +80,5 @@
 		oFakeImage	= oEditor.FCKDocumentProcessor_CreateFakeImage( 'FCK__InputHidden', oActiveEl ) ;
 		oFakeImage.setAttribute( '_fckinputhidden', 'true', 0 ) ;
-		oFakeImage	= FCK.InsertElementAndGetIt( oFakeImage ) ;
+		oFakeImage	= FCK.InsertElement( oFakeImage ) ;
 	}
 	else
Index: /FCKeditor/trunk/editor/dialog/fck_image/fck_image.js
===================================================================
--- /FCKeditor/trunk/editor/dialog/fck_image/fck_image.js	(revision 307)
+++ /FCKeditor/trunk/editor/dialog/fck_image/fck_image.js	(revision 308)
@@ -221,10 +221,10 @@
 		if ( bImageButton )
 		{
-			oImage = FCK.EditorDocument.createElement( 'INPUT' ) ;
+			oImage = FCK.EditorDocument.createElement( 'input' ) ;
 			oImage.type = 'image' ;
-			oImage = FCK.InsertElementAndGetIt( oImage ) ;
+			oImage = FCK.InsertElement( oImage ) ;
 		}
 		else
-			oImage = FCK.CreateElement( 'IMG' ) ;
+			oImage = FCK.InsertElement( 'img' ) ;
 	}
 	else
Index: /FCKeditor/trunk/editor/dialog/fck_link/fck_link.js
===================================================================
--- /FCKeditor/trunk/editor/dialog/fck_link/fck_link.js	(revision 307)
+++ /FCKeditor/trunk/editor/dialog/fck_link/fck_link.js	(revision 308)
@@ -538,5 +538,5 @@
 
 		// Create a new (empty) anchor.
-		oLink = oEditor.FCK.CreateElement( 'a' ) ;
+		oLink = oEditor.FCK.InsertElement( 'a' ) ;
 	}
 
Index: /FCKeditor/trunk/editor/dialog/fck_radiobutton.html
===================================================================
--- /FCKeditor/trunk/editor/dialog/fck_radiobutton.html	(revision 307)
+++ /FCKeditor/trunk/editor/dialog/fck_radiobutton.html	(revision 308)
@@ -60,5 +60,5 @@
 		oActiveEl = oEditor.FCK.EditorDocument.createElement( 'INPUT' ) ;
 		oActiveEl.type = 'radio' ;
-		oActiveEl = oEditor.FCK.InsertElementAndGetIt( oActiveEl ) ;
+		oActiveEl = oEditor.FCK.InsertElement( oActiveEl ) ;
 	}
 
Index: /FCKeditor/trunk/editor/dialog/fck_select.html
===================================================================
--- /FCKeditor/trunk/editor/dialog/fck_select.html	(revision 307)
+++ /FCKeditor/trunk/editor/dialog/fck_select.html	(revision 308)
@@ -79,8 +79,5 @@
 
 	if ( !oActiveEl )
-	{
-		oActiveEl = oEditor.FCK.EditorDocument.createElement( 'SELECT' ) ;
-		oActiveEl = oEditor.FCK.InsertElementAndGetIt( oActiveEl ) ;
-	}
+		oActiveEl = oEditor.FCK.InsertElement( 'select' ) ;
 
 	SetAttribute( oActiveEl, 'name'	, GetE('txtName').value ) ;
Index: /FCKeditor/trunk/editor/dialog/fck_smiley.html
===================================================================
--- /FCKeditor/trunk/editor/dialog/fck_smiley.html	(revision 307)
+++ /FCKeditor/trunk/editor/dialog/fck_smiley.html	(revision 308)
@@ -46,5 +46,5 @@
 function InsertSmiley( url )
 {
-	var oImg = oEditor.FCK.CreateElement( 'IMG' ) ;
+	var oImg = oEditor.FCK.InsertElement( 'img' ) ;
 	oImg.src = url ;
 	oImg.setAttribute( '_fcksavedurl', url ) ;
Index: /FCKeditor/trunk/editor/dialog/fck_textarea.html
===================================================================
--- /FCKeditor/trunk/editor/dialog/fck_textarea.html	(revision 307)
+++ /FCKeditor/trunk/editor/dialog/fck_textarea.html	(revision 308)
@@ -57,8 +57,5 @@
 {
 	if ( !oActiveEl )
-	{
-		oActiveEl = oEditor.FCK.EditorDocument.createElement( 'TEXTAREA' ) ;
-		oActiveEl = oEditor.FCK.InsertElementAndGetIt( oActiveEl ) ;
-	}
+		oActiveEl = oEditor.FCK.InsertElement( 'textarea' ) ;
 
 	oActiveEl.name = GetE('txtName').value ;
Index: /FCKeditor/trunk/editor/dialog/fck_textfield.html
===================================================================
--- /FCKeditor/trunk/editor/dialog/fck_textfield.html	(revision 307)
+++ /FCKeditor/trunk/editor/dialog/fck_textfield.html	(revision 308)
@@ -77,5 +77,5 @@
 		oActiveEl = oEditor.FCK.EditorDocument.createElement( 'INPUT' ) ;
 		oActiveEl.type = GetE('txtType').value ;
-		oActiveEl = oEditor.FCK.InsertElementAndGetIt( oActiveEl ) ;
+		oActiveEl = oEditor.FCK.InsertElement( oActiveEl ) ;
 	}
 
Index: /FCKeditor/trunk/editor/plugins/placeholder/fckplugin.js
===================================================================
--- /FCKeditor/trunk/editor/plugins/placeholder/fckplugin.js	(revision 307)
+++ /FCKeditor/trunk/editor/plugins/placeholder/fckplugin.js	(revision 308)
@@ -38,5 +38,5 @@
 FCKPlaceholders.Add = function( name )
 {
-	var oSpan = FCK.CreateElement( 'SPAN' ) ;
+	var oSpan = FCK.InsertElement( 'span' ) ;
 	this.SetupSpan( oSpan, name ) ;
 }
