Index: /CKEditor/branches/prototype/_source/lang/en.js
===================================================================
--- /CKEditor/branches/prototype/_source/lang/en.js	(revision 2839)
+++ /CKEditor/branches/prototype/_source/lang/en.js	(revision 2840)
@@ -162,4 +162,12 @@
 	},
 
+	// Anchor dialog
+	anchor :
+	{
+		title		: 'Anchor Properties',
+		name		: 'Anchor Name',
+		errorName	: 'Please type the anchor name',
+	},
+
 	// Find And Replace Dialog
 	findAndReplace :
Index: /CKEditor/branches/prototype/_source/plugins/link/dialogs/anchor.js
===================================================================
--- /CKEditor/branches/prototype/_source/plugins/link/dialogs/anchor.js	(revision 2840)
+++ /CKEditor/branches/prototype/_source/plugins/link/dialogs/anchor.js	(revision 2840)
@@ -0,0 +1,121 @@
+/*
+ * CKEditor - The text editor for Internet - http://ckeditor.com
+ * Copyright (C) 2003-2008 Frederico Caldeira Knabben
+ *
+ * == BEGIN LICENSE ==
+ *
+ * Licensed under the terms of any of the following licenses at your
+ * choice:
+ *
+ *  - GNU General Public License Version 2 or later (the "GPL")
+ *    http://www.gnu.org/licenses/gpl.html
+ *
+ *  - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
+ *    http://www.gnu.org/licenses/lgpl.html
+ *
+ *  - Mozilla Public License Version 1.1 or later (the "MPL")
+ *    http://www.mozilla.org/MPL/MPL-1.1.html
+ *
+ * == END LICENSE ==
+ */
+
+CKEDITOR.dialog.add( 'anchor', function( editor ){
+{
+	// Function called in onShow to load selected element.
+	var loadElements = function( editor, selection, ranges, element )
+	{
+		this.saveSelection();
+		this.editMode = true;
+		this.editObj = element;
+		
+		var attributeValue = this.editObj.getAttribute( 'name' );
+		if ( attributeValue == null )
+			this.setValueOf( 'info','txtName', "" );
+		else
+			this.setValueOf( 'info','txtName', attributeValue );
+	};
+
+	return {
+		title : editor.lang.anchor.title,
+		minWidth : 350,
+		minHeight : 150,
+		onOk : function()
+		{
+			// Create a new anchor.
+			if ( !this.editMode )
+				this.editObj = editor.document.createElement( 'a' );
+
+			// Set name.
+			var name = this.getContentElement( 'info', 'txtName' ).getValue();
+			this.editObj.setAttribute( 'name', name );
+
+			// Insert a new anchor.
+			if ( !this.editMode)
+			{
+				// It doesn't work with IE.
+				this.restoreSelection();
+				this.clearSavedSelection();
+				editor.insertElement( this.editObj );
+			}
+			return true;
+		},
+		onShow : function()
+		{
+			this.editObj = false;
+			this.editMode = false;
+
+			// IE BUG: Selection must be in the editor for getSelection() to work.
+			this.restoreSelection();
+
+			var editor = this.getParentEditor(),
+				selection = editor.getSelection(),
+				ranges = selection.getRanges();
+
+			if ( ranges.length == 1 )
+			{
+				ranges[0].enlarge( CKEDITOR.ENLARGE_ELEMENT );
+				rangeRoot = ranges[0].getCommonAncestor( true );
+				var element = rangeRoot.getAscendant( 'a', true );
+				if ( element && element.getAttribute( 'name' ) )
+				{
+					loadElements.apply( this, [ editor, selection, ranges, element ] );
+					selection.selectElement( element );
+					this.saveSelection();
+				}
+			}
+			this.pushDefault();
+			this.getContentElement( 'info', 'txtName' ).focus();
+		},		
+		onHide : function()
+		{
+			// Pop the default values from default value set that are pushed in onShow().
+			this.popDefault();
+		},
+		contents : [
+			{
+				id : 'info',
+				label : editor.lang.anchor.title,
+				accessKey : 'I',
+				elements :
+				[
+					{
+						type : 'text',
+						id : 'txtName',
+						label : editor.lang.anchor.name,
+						validate : function()
+						{
+							if ( this.getValue() == '' )
+							{
+								alert( editor.lang.anchor.errorName );
+								return false;
+							}
+							return true;
+						}
+					},
+				]
+			}
+		]
+	};
+};
+
+});
Index: /CKEditor/branches/prototype/_source/plugins/link/plugin.js
===================================================================
--- /CKEditor/branches/prototype/_source/plugins/link/plugin.js	(revision 2839)
+++ /CKEditor/branches/prototype/_source/plugins/link/plugin.js	(revision 2840)
@@ -26,4 +26,5 @@
 		// Add the link and unlink buttons.
 		editor.addCommand( 'link', new CKEDITOR.dialogCommand( 'link' ) );
+		editor.addCommand( 'anchor', new CKEDITOR.dialogCommand( 'anchor' ) );
 		editor.addCommand( 'unlink', new CKEDITOR.unlinkCommand() );
 		editor.ui.addButton( 'Link',
@@ -37,6 +38,11 @@
 				command : 'unlink'
 			} );
+		editor.ui.addButton( 'Anchor',
+			{
+				label : editor.lang.common.anchor,
+				command : 'anchor'
+			} );
 		CKEDITOR.dialog.add( 'link', this.path + 'dialogs/link.js' );
-
+		CKEDITOR.dialog.add( 'anchor', this.path + 'dialogs/anchor.js' );
 		// Register selection change handler for the unlink button.
 		editor.on( 'selectionChange', function( evt )
Index: /CKEditor/branches/prototype/_source/plugins/toolbar/plugin.js
===================================================================
--- /CKEditor/branches/prototype/_source/plugins/toolbar/plugin.js	(revision 2839)
+++ /CKEditor/branches/prototype/_source/plugins/toolbar/plugin.js	(revision 2840)
@@ -224,5 +224,5 @@
 	[ 'Source', '-', 'Bold', 'Italic', 'Underline', 'Strike', '-', 'Subscript', 'Superscript', '-', 'Find','Replace','-',
 	'SelectAll', 'RemoveFormat', '-',
-	'Link', 'Unlink', 'Image', 'Flash', 'Table', 'Smiley', 'HorizontalRule', 'SpecialChar', '-',
+	'Link', 'Unlink', 'Anchor', 'Image', 'Flash', 'Table', 'Smiley', 'HorizontalRule', 'SpecialChar', '-',
 	'Form', 'Checkbox', 'Radio', 'TextField', 'Textarea', 'Select', 'Button', 'ImageButton', 'HiddenField' ]
 ];
Index: /CKEditor/branches/prototype/_source/skins/default/toolbar.css
===================================================================
--- /CKEditor/branches/prototype/_source/skins/default/toolbar.css	(revision 2839)
+++ /CKEditor/branches/prototype/_source/skins/default/toolbar.css	(revision 2840)
@@ -238,4 +238,9 @@
 }
 
+.cke_skin_default a.cke_button_anchor .cke_icon
+{
+	background-position: 0 -560px;
+}
+
 .cke_skin_default a.cke_button_image .cke_icon
 {
