Index: /FCKeditor/trunk/editor/_source/internals/fck_ie.js
===================================================================
--- /FCKeditor/trunk/editor/_source/internals/fck_ie.js	(revision 370)
+++ /FCKeditor/trunk/editor/_source/internals/fck_ie.js	(revision 371)
@@ -224,5 +224,5 @@
 		return false ;
 	}
-	
+
 	var sHTML = FCK._CheckIsPastingEnabled( true ) ;
 
@@ -269,5 +269,5 @@
 		return ;
 	}
-	
+
 	// Get the data available in the clipboard in text format.
 	var sText = clipboardData.getData("Text") ;
@@ -289,9 +289,9 @@
 	// It adds a little bit of overhead to the check, but so far that's the
 	// only way, mainly because of IE7.
-	
+
 	FCK._PasteIsEnabled = false ;
-	
+
 	document.body.attachEvent( 'onpaste', FCK_CheckPasting_Listener ) ;
-	
+
 	// The execCommand in GetClipboardHTML will fire the "onpaste", only if the
 	// security settings are enabled.
@@ -299,5 +299,5 @@
 
 	document.body.detachEvent( 'onpaste', FCK_CheckPasting_Listener ) ;
-	
+
 	if ( FCK._PasteIsEnabled )
 	{
@@ -372,5 +372,5 @@
 			oControl.parentNode.removeChild( oControl ) ;
 			oLink.appendChild( oControl ) ;
-			
+
 			return [ oLink ] ;
 		}
@@ -389,5 +389,7 @@
 			var oLink = oLinks[i] ;
 
-			if ( oLink.href == sTempUrl )
+			// Check it this a newly created link.
+			// getAttribute must be used. oLink.url may cause problems with IE7 (#555).
+			if ( oLink.getAttribute( 'href', 2 ) == sTempUrl )
 			{
 				var sInnerHtml = oLink.innerHTML ;	// Save the innerHTML (IE changes it if it is like an URL).
@@ -395,12 +397,11 @@
 				oLink.innerHTML = sInnerHtml ;		// Restore the innerHTML.
 
-				// If the last child is a <br> move it outside the link or it will be too easy to select this link again #338
-				if (oLink.lastChild.nodeName == 'BR' )
+				// If the last child is a <br> move it outside the link or it
+				// will be too easy to select this link again #388.
+				var oLastChild = oLink.lastChild ;
+				if ( oLastChild && oLastChild.nodeName == 'BR' )
 				{
-					// We move the br as a sibling after the link:
-					var oBR = oLink.lastChild ;
-					oLink.removeChild( oBR ) ;
-					// There's no insertAfter, so we insert before the next sibling
-					oLink.parentNode.insertBefore( oBR, oLink.nextSibling  );
+					// Move the BR after the link.
+					FCKDomTools.InsertAfterNode( oLink, oLink.removeChild( oLastChild ) ) ;
 				}
 
