Index: /FCKeditor/branches/features/div_container/editor/dialog/fck_div.html
===================================================================
--- /FCKeditor/branches/features/div_container/editor/dialog/fck_div.html	(revision 2104)
+++ /FCKeditor/branches/features/div_container/editor/dialog/fck_div.html	(revision 2105)
@@ -69,4 +69,15 @@
 }
 
+function GetNearestAncestorDirection( node )
+{
+	var dir = 'ltr' ;	// HTML default.
+	while ( ( node = node.parentNode ) )
+	{
+		if ( node.dir )
+			dir = node.dir ;
+	}
+	return dir ;
+}
+
 window.onload = function()
 {
@@ -97,4 +108,5 @@
 		GetE( 'selStyle' ).value = i ;
 
+	// Set the value for other inputs
 	if ( ActiveEl )
 	{
@@ -104,5 +116,5 @@
 		GetE( 'txtInlineStyle').value = ActiveEl.getAttribute( 'style' ) ;
 		GetE( 'txtTitle' ).value = ActiveEl.title ;
-		GetE( 'selLangDir').value = ActiveEl.dir ;
+		GetE( 'selLangDir').value = ActiveEl.dir || GetNearestAncestorDirection( ActiveEl ) ;
 	}
 }
@@ -128,4 +140,5 @@
 	}
 
+	// Apply modifications to the DIV container according to dialog inputs.
 	setValue( 'class', 'txtClass' ) ;
 	setValue( 'id', 'txtId' ) ;
@@ -136,5 +149,9 @@
 		setValue( 'style', 'txtInlineStyle' ) ;
 	setValue( 'title', 'txtTitle' ) ;
-	setValue( 'dir', 'selLangDir' ) ;
+	var dir = GetE( 'selLangDir' ).value ;
+	if ( GetNearestAncestorDirection( ActiveEl ) != dir )
+		ActiveEl.dir = dir ;
+	else
+		ActiveEl.removeAttribute( 'dir' ) ;
 
 	var styleName = GetE( 'selStyle' ).value ;
