Index: _source/plugins/toolbar/plugin.js
===================================================================
--- _source/plugins/toolbar/plugin.js	(revision 5336)
+++ _source/plugins/toolbar/plugin.js	(revision )
@@ -433,6 +433,7 @@
 	['Bold','Italic','Underline','Strike','-','Subscript','Superscript'],
 	['NumberedList','BulletedList','-','Outdent','Indent','Blockquote','CreateDiv'],
 	['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock'],
+	['BidiLtr', 'BidiRtl'],
 	['Link','Unlink','Anchor'],
 	['Image','Flash','Table','HorizontalRule','Smiley','SpecialChar','PageBreak'],
 	'/',
Index: _source/lang/en.js
===================================================================
--- _source/lang/en.js	(revision 5640)
+++ _source/lang/en.js	(revision )
@@ -744,5 +744,11 @@
 	},
 
 	toolbarCollapse	: 'Collapse Toolbar',
-	toolbarExpand	: 'Expand Toolbar'
+	toolbarExpand	: 'Expand Toolbar',
+
+	bidiswitch :
+	{
+		ltr :"Switch to LTR text direction",
+		rtl : "Switch to RTL text direction"
+	}
 };
Index: _source/core/config.js
===================================================================
--- _source/core/config.js	(revision 5548)
+++ _source/core/config.js	(revision )
@@ -243,7 +243,7 @@
 	 * @type String
 	 * @example
 	 */
-	plugins : 'about,a11yhelp,basicstyles,blockquote,button,clipboard,colorbutton,colordialog,contextmenu,div,elementspath,enterkey,entities,filebrowser,find,flash,font,format,forms,horizontalrule,htmldataprocessor,image,indent,justify,keystrokes,link,list,liststyle,maximize,newpage,pagebreak,pastefromword,pastetext,popup,preview,print,removeformat,resize,save,scayt,smiley,showblocks,showborders,sourcearea,stylescombo,table,tabletools,specialchar,tab,templates,toolbar,undo,wysiwygarea,wsc',
+	plugins : 'about,a11yhelp,basicstyles,blockquote,button,clipboard,colorbutton,colordialog,contextmenu,div,elementspath,enterkey,entities,filebrowser,find,flash,font,format,forms,horizontalrule,htmldataprocessor,image,indent,justify,keystrokes,link,list,liststyle,maximize,newpage,pagebreak,pastefromword,pastetext,popup,preview,print,removeformat,resize,save,scayt,smiley,showblocks,showborders,sourcearea,stylescombo,table,tabletools,specialchar,tab,templates,toolbar,undo,wysiwygarea,wsc,bidiswitch',
 
 	/**
 	 * List of additional plugins to be loaded. This is a tool setting which
Index: _source/plugins/bidiswitch/plugin.js
===================================================================
--- _source/plugins/bidiswitch/plugin.js	(revision )
+++ _source/plugins/bidiswitch/plugin.js	(revision )
@@ -0,0 +1,95 @@
+/*
+Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved.
+For licensing, see LICENSE.html or http://ckeditor.com/license
+*/
+(function(){
+
+	function onSelectionChange( evt )
+	{
+		var command = evt.editor.getCommand( 'rtlSwitch' );
+		command.state = getState( evt.editor, evt.data.path, 'rtl' );
+		command.fire( 'state' );
+
+		command = evt.editor.getCommand( 'ltrSwitch' );
+		command.state = getState( evt.editor, evt.data.path, 'ltr' );
+		command.fire( 'state' );
+	}
+	
+	function getState( editor, path, dir )
+	{
+		var firstBlock = path.block || path.blockLimit;
+
+		if ( !firstBlock || firstBlock.getName() == 'body' )
+			return CKEDITOR.TRISTATE_OFF;
+
+		return ( firstBlock.getAttribute( 'dir' ) == dir ) ?
+			CKEDITOR.TRISTATE_ON : CKEDITOR.TRISTATE_OFF;
+	}
+
+	function bidiCommand( dir )
+	{
+		return function( editor )
+		{
+			var selection = editor.getSelection(),
+				enterMode = editor.config.enterMode,
+				ranges = editor.getSelection().getRanges();
+
+			// Creates bookmarks for selection, as we may split some blocks.
+			var bookmarks = selection.createBookmarks();
+
+			if ( ranges )
+			{
+				var iterator,
+					block;
+
+				for ( var i = ranges.length - 1 ; i >= 0 ; i-- )
+				{
+					iterator = ranges[ i ].createIterator();
+					iterator.enlargeBr = enterMode != CKEDITOR.ENTER_BR;
+
+					while ( ( block = iterator.getNextParagraph( enterMode == CKEDITOR.ENTER_P ? 'p' : 'div' ) ) )
+					{
+						if ( block.hasAttribute( 'dir' ) && block.getAttribute( 'dir' ).toLowerCase()  == dir )
+							block.removeAttribute( 'dir' );
+						else
+							block.setAttribute( 'dir', dir );
+					}
+				}
+
+				editor.focus();
+				editor.forceNextSelectionCheck();
+				// Restore selection position.
+				selection.selectBookmarks( bookmarks );
+			}
+		};
+	}
+
+	CKEDITOR.plugins.add( 'bidiswitch',
+	{
+		requires : [ 'styles', 'button' ],
+
+		init : function( editor )
+		{
+			// All buttons use the same code to register. So, to avoid
+			// duplications, let's use this tool function.
+			var addButtonCommand = function( buttonName, buttonLabel, commandName, commandExec )
+			{
+				editor.addCommand( commandName, new CKEDITOR.command( editor, { exec : commandExec }) );
+
+				editor.ui.addButton( buttonName,
+					{
+						label : buttonLabel,
+						command : commandName
+					});
+			};
+
+			var lang = editor.lang.bidiswitch;
+
+			addButtonCommand( 'BidiRtl', lang.rtl, 'rtlSwitch', bidiCommand( 'rtl' ) );
+			addButtonCommand( 'BidiLtr', lang.ltr, 'ltrSwitch', bidiCommand( 'ltr' ) );
+
+			editor.on( 'selectionChange', onSelectionChange );
+		}
+	});
+	
+})();
