/* @Packager.Header
<FileDescription>
	This is a generic Document Fragment object. It is not intended to provide 
	the W3C implementation, but is a way to fix the missing of a real Document
	Fragment in IE (where document.createDocumentFragment() returns a normal
	document instead), giving a standard interface for it.
	(IE Implementation)
</FileDescription>
<Author name="Frederico Caldeira Knabben" email="www.fckeditor.net" />
*/

var FCKDocumentFragment = function( parentDocument )
{
	this._Document = parentDocument ;
	this.RootNode = parentDocument.createElement( 'div' ) ;
}

// Append the contents of this Document Fragment to another node.
FCKDocumentFragment.prototype = 
{
	TypeName : 'FCKDocumentFragment',		// @Packager.RemoveLine

	AppendTo : function( targetNode )
	{
		FCKDomTools.MoveChildren( this.RootNode, targetNode ) ;
	},

	AppendHtml : function( html )
	{
		var eTmpDiv = this._Document.createElement( 'div' ) ;
		eTmpDiv.innerHTML = html ;
		FCKDomTools.MoveChildren( eTmpDiv, this.RootNode ) ;
	},

	InsertAfterNode : function( existingNode )
	{
		var eRoot = this.RootNode ;
		var eLast ;
		
		while( ( eLast = eRoot.lastChild ) )
			FCKDomTools.InsertAfterNode( existingNode, eRoot.removeChild( eLast ) ) ;
	}
} ;