var spDialog='MyLink/fck_link.html';

FCKCommands.RegisterCommand( 'MyLink', new FCKDialogCommand( 'MyLink', FCKLang.InsertLink,  FCKConfig.PluginsPath + spDialog, 340, 300 ) ) ;
FCKToolbarItems.RegisterItem( 'MyLink', new FCKToolbarButton( 'MyLink' , FCKLang.InsertLinkLbl, FCKLang.InsertLink, null, false, true, 34 ) ) ;

FCK.ContextMenu.RegisterListener( {

			AddItems : function( menu, tag, tagName )
			{
				var bInsideLink = ( tagName == 'A' || FCKSelection.HasAncestorNode( 'A' ) ) ;

				if ( bInsideLink || FCK.GetNamedCommandState( 'Unlink' ) != FCK_TRISTATE_DISABLED )
				{
					// Go up to the anchor to test its properties
					var oLink = FCKSelection.MoveToAncestorNode( 'A' ) ;
					var bIsAnchor = ( oLink && oLink.name.length > 0 && oLink.href.length == 0 ) ;
					// If it isn't a link then don't add the Link context menu
					if ( bIsAnchor )
						return ;
					menu.AddSeparator() ;
					if ( bInsideLink )
						menu.AddItem( 'MyLink', FCKLang.EditLink		, 34 ) ;
					menu.AddItem( 'Unlink'	, FCKLang.RemoveLink	, 35 ) ;
				}
			} 
});
