diff --git a/indra/newview/llbottomtray.cpp b/indra/newview/llbottomtray.cpp
index 2c82fc51184c3bd77f30d59bacdaf2b7334887e1..0595bedd3130020be36c7e8b3f75250a6d6b5a1d 100644
--- a/indra/newview/llbottomtray.cpp
+++ b/indra/newview/llbottomtray.cpp
@@ -1169,6 +1169,7 @@ void LLBottomTray::initResizeStateContainers()
 	mStateProcessedObjectMap.insert(std::make_pair(RS_BUTTON_MOVEMENT, mMovementPanel));
 	mStateProcessedObjectMap.insert(std::make_pair(RS_BUTTON_CAMERA, mCamPanel));
 	mStateProcessedObjectMap.insert(std::make_pair(RS_BUTTON_SNAPSHOT, mSnapshotPanel));
+	mStateProcessedObjectMap.insert(std::make_pair(RS_BUTTON_SIDEBAR, getChild<LLPanel>("sidebar_btn_panel")));
 	mStateProcessedObjectMap.insert(std::make_pair(RS_BUTTON_BUILD, getChild<LLPanel>("build_btn_panel")));
 	mStateProcessedObjectMap.insert(std::make_pair(RS_BUTTON_SEARCH, getChild<LLPanel>("search_btn_panel")));
 	mStateProcessedObjectMap.insert(std::make_pair(RS_BUTTON_WORLD_MAP, getChild<LLPanel>("world_map_btn_panel")));
@@ -1179,6 +1180,7 @@ void LLBottomTray::initResizeStateContainers()
 	mButtonsProcessOrder.push_back(RS_BUTTON_MOVEMENT);
 	mButtonsProcessOrder.push_back(RS_BUTTON_CAMERA);
 	mButtonsProcessOrder.push_back(RS_BUTTON_SNAPSHOT);
+	mButtonsProcessOrder.push_back(RS_BUTTON_SIDEBAR);
 	mButtonsProcessOrder.push_back(RS_BUTTON_BUILD);
 	mButtonsProcessOrder.push_back(RS_BUTTON_SEARCH);
 	mButtonsProcessOrder.push_back(RS_BUTTON_WORLD_MAP);
@@ -1194,6 +1196,7 @@ void LLBottomTray::initResizeStateContainers()
 	{
 		const EResizeState button_type = *it;
 		// is there an appropriate object?
+		llassert(mStateProcessedObjectMap.count(button_type) > 0);
 		if (0 == mStateProcessedObjectMap.count(button_type)) continue;
 
 		// set default width for it.
@@ -1205,17 +1208,19 @@ void LLBottomTray::initResizeStateContainers()
 
 }
 
+// this method must be called before restoring of the chat entry field on startup
+// because it resets chatbar's width according to resize logic.
 void LLBottomTray::initButtonsVisibility()
 {
-	setTrayButtonVisibleIfPossible(RS_BUTTON_GESTURES, gSavedSettings.getBOOL("ShowGestureButton"));
-	setTrayButtonVisibleIfPossible(RS_BUTTON_MOVEMENT, gSavedSettings.getBOOL("ShowMoveButton"));
-	setTrayButtonVisibleIfPossible(RS_BUTTON_CAMERA, gSavedSettings.getBOOL("ShowCameraButton"));
-	setTrayButtonVisibleIfPossible(RS_BUTTON_SNAPSHOT, gSavedSettings.getBOOL("ShowSnapshotButton"));
-
-	setTrayButtonVisibleIfPossible(RS_BUTTON_BUILD, gSavedSettings.getBOOL("ShowBuildButton"));
-	setTrayButtonVisibleIfPossible(RS_BUTTON_SEARCH, gSavedSettings.getBOOL("ShowSearchButton"));
-	setTrayButtonVisibleIfPossible(RS_BUTTON_WORLD_MAP, gSavedSettings.getBOOL("ShowWorldMapButton"));
-	setTrayButtonVisibleIfPossible(RS_BUTTON_MINI_MAP, gSavedSettings.getBOOL("ShowMiniMapButton"));
+	setVisibleAndFitWidths(RS_BUTTON_GESTURES, gSavedSettings.getBOOL("ShowGestureButton"));
+	setVisibleAndFitWidths(RS_BUTTON_MOVEMENT, gSavedSettings.getBOOL("ShowMoveButton"));
+	setVisibleAndFitWidths(RS_BUTTON_CAMERA, gSavedSettings.getBOOL("ShowCameraButton"));
+	setVisibleAndFitWidths(RS_BUTTON_SNAPSHOT, gSavedSettings.getBOOL("ShowSnapshotButton"));
+	setVisibleAndFitWidths(RS_BUTTON_SIDEBAR, gSavedSettings.getBOOL("ShowSidebarButton"));
+	setVisibleAndFitWidths(RS_BUTTON_BUILD, gSavedSettings.getBOOL("ShowBuildButton"));
+	setVisibleAndFitWidths(RS_BUTTON_SEARCH, gSavedSettings.getBOOL("ShowSearchButton"));
+	setVisibleAndFitWidths(RS_BUTTON_WORLD_MAP, gSavedSettings.getBOOL("ShowWorldMapButton"));
+	setVisibleAndFitWidths(RS_BUTTON_MINI_MAP, gSavedSettings.getBOOL("ShowMiniMapButton"));
 }
 
 void LLBottomTray::setButtonsControlsAndListeners()
@@ -1224,20 +1229,19 @@ void LLBottomTray::setButtonsControlsAndListeners()
 	gSavedSettings.declareBOOL("ShowMoveButton", TRUE, "Shows/Hides Move button in the bottom tray. (Declared in code)");
 	gSavedSettings.declareBOOL("ShowSnapshotButton", TRUE, "Shows/Hides Snapshot button button in the bottom tray. (Declared in code)");
 	gSavedSettings.declareBOOL("ShowCameraButton", TRUE, "Show/Hide View button in the bottom tray. (Declared in code)");
+	gSavedSettings.declareBOOL("ShowSidebarButton", TRUE, "Shows/hides Sidebar button in the bottom tray. (Declared in code)");
 	gSavedSettings.declareBOOL("ShowBuildButton", TRUE, "Shows/Hides Build button in the bottom tray. (Declared in code)");
 	gSavedSettings.declareBOOL("ShowSearchButton", TRUE, "Shows/Hides Search button in the bottom tray. (Declared in code)");
 	gSavedSettings.declareBOOL("ShowWorldMapButton", TRUE, "Shows/Hides Map button in the bottom tray. (Declared in code)");
 	gSavedSettings.declareBOOL("ShowMiniMapButton", TRUE, "Shows/Hides Mini-Map button in the bottom tray. (Declared in code)");
 
-
 	gSavedSettings.declareS32("ChatBarCustomWidth", 0, "Stores customized width of chat bar. (Declared in code)");
 
-
 	gSavedSettings.getControl("ShowGestureButton")->getSignal()->connect(boost::bind(&LLBottomTray::toggleShowButton, RS_BUTTON_GESTURES, _2));
 	gSavedSettings.getControl("ShowMoveButton")->getSignal()->connect(boost::bind(&LLBottomTray::toggleShowButton, RS_BUTTON_MOVEMENT, _2));
 	gSavedSettings.getControl("ShowCameraButton")->getSignal()->connect(boost::bind(&LLBottomTray::toggleShowButton, RS_BUTTON_CAMERA, _2));
 	gSavedSettings.getControl("ShowSnapshotButton")->getSignal()->connect(boost::bind(&LLBottomTray::toggleShowButton, RS_BUTTON_SNAPSHOT, _2));
-
+	gSavedSettings.getControl("ShowSidebarButton")->getSignal()->connect(boost::bind(&LLBottomTray::toggleShowButton, RS_BUTTON_SIDEBAR, _2));
 	gSavedSettings.getControl("ShowBuildButton")->getSignal()->connect(boost::bind(&LLBottomTray::toggleShowButton, RS_BUTTON_BUILD, _2));
 	gSavedSettings.getControl("ShowSearchButton")->getSignal()->connect(boost::bind(&LLBottomTray::toggleShowButton, RS_BUTTON_SEARCH, _2));
 	gSavedSettings.getControl("ShowWorldMapButton")->getSignal()->connect(boost::bind(&LLBottomTray::toggleShowButton, RS_BUTTON_WORLD_MAP, _2));
@@ -1316,18 +1320,18 @@ bool LLBottomTray::setVisibleAndFitWidths(EResizeState object_type, bool visible
 			const S32 chatbar_shrunk_width =
 				mNearbyChatBar->getRect().getWidth() - get_panel_min_width(mToolbarStack, mNearbyChatBar);
 
-			// *TODO: update list of processed buttons to use new buttons;
-			const S32 sum_of_min_widths =
-				get_panel_min_width(mToolbarStack, mStateProcessedObjectMap[RS_BUTTON_CAMERA])   +
-				get_panel_min_width(mToolbarStack, mStateProcessedObjectMap[RS_BUTTON_MOVEMENT]) +
-				get_panel_min_width(mToolbarStack, mStateProcessedObjectMap[RS_BUTTON_GESTURES]) +
-				get_panel_min_width(mToolbarStack, mSpeakPanel);
-
-			const S32 sum_of_curr_widths =
-				get_curr_width(mStateProcessedObjectMap[RS_BUTTON_CAMERA])   +
-				get_curr_width(mStateProcessedObjectMap[RS_BUTTON_MOVEMENT]) +
-				get_curr_width(mStateProcessedObjectMap[RS_BUTTON_GESTURES]) +
-				get_curr_width(mSpeakPanel);
+			S32 sum_of_min_widths = get_panel_min_width(mToolbarStack, mSpeakPanel);
+			S32 sum_of_curr_widths = get_curr_width(mSpeakPanel);
+
+			resize_state_vec_t::const_iterator it = mButtonsProcessOrder.begin();
+			const resize_state_vec_t::const_iterator it_end = mButtonsProcessOrder.end();
+
+			for (; it != it_end; ++it)
+			{
+				LLPanel * cur_panel = mStateProcessedObjectMap[*it];
+				sum_of_min_widths += get_panel_min_width(mToolbarStack, cur_panel);
+				sum_of_curr_widths += get_curr_width(cur_panel);
+			}
 
 			const S32 possible_shrunk_width =
 				chatbar_shrunk_width + (sum_of_curr_widths - sum_of_min_widths);
diff --git a/indra/newview/llbottomtray.h b/indra/newview/llbottomtray.h
index 74b8ed0d87766fb87085cba2b2c1cff9f2f63a52..889dc42097c379f3f94ab75ed43c550d1a50511b 100644
--- a/indra/newview/llbottomtray.h
+++ b/indra/newview/llbottomtray.h
@@ -124,6 +124,7 @@ class LLBottomTray
 		, RS_BUTTON_SEARCH		= 0x0400
 		, RS_BUTTON_WORLD_MAP	= 0x0800
 		, RS_BUTTON_MINI_MAP	= 0x1000
+		, RS_BUTTON_SIDEBAR		= 0x2000
 
 		/*
 		Once new button that can be hidden on resize is added don't forget to update related places:
@@ -138,6 +139,7 @@ class LLBottomTray
 		 */
 		, RS_BUTTONS_CAN_BE_HIDDEN = RS_BUTTON_SNAPSHOT | RS_BUTTON_CAMERA | RS_BUTTON_MOVEMENT | RS_BUTTON_GESTURES
 									| RS_BUTTON_BUILD | RS_BUTTON_SEARCH | RS_BUTTON_WORLD_MAP | RS_BUTTON_MINI_MAP
+									| RS_BUTTON_SIDEBAR
 	}EResizeState;
 
 	/**
diff --git a/indra/newview/skins/default/xui/en/menu_bottomtray.xml b/indra/newview/skins/default/xui/en/menu_bottomtray.xml
index 5beafef4e4b91714bb81175a5748dfc2d5838215..ccd5388621cd4eb30104c80eb0e98b5f7dbcad3a 100644
--- a/indra/newview/skins/default/xui/en/menu_bottomtray.xml
+++ b/indra/newview/skins/default/xui/en/menu_bottomtray.xml
@@ -52,6 +52,17 @@
              function="CheckControl"
              parameter="ShowSnapshotButton" />
     </menu_item_check>        
+    <menu_item_check
+     label="Sidebar button"
+     layout="topleft"
+     name="ShowSidebarButton">
+        <menu_item_check.on_click
+         function="ToggleControl"
+         parameter="ShowSidebarButton" />
+        <menu_item_check.on_check
+         function="CheckControl"
+         parameter="ShowSidebarButton" />
+    </menu_item_check>
     <menu_item_check
      label="Build button"
      layout="topleft"
diff --git a/indra/newview/skins/default/xui/en/panel_bottomtray.xml b/indra/newview/skins/default/xui/en/panel_bottomtray.xml
index 08408128269171aaae6092ed203a107f8b2b78e0..dd813f58139373334316d269f04721dd6226a920 100644
--- a/indra/newview/skins/default/xui/en/panel_bottomtray.xml
+++ b/indra/newview/skins/default/xui/en/panel_bottomtray.xml
@@ -213,6 +213,41 @@
                  parameter="snapshot" />
             </button>
         </layout_panel>
+        <layout_panel
+         auto_resize="false"
+         follows="left|right"
+         height="28"
+         layout="topleft"
+         min_height="28"
+         min_width="52"
+         mouse_opaque="false"
+         name="sidebar_btn_panel"
+         user_resize="false"
+         width="83">
+<!--*TODO: Implement toggle of sidebar with buttons
+Disabled for now.
+-->
+            <button
+enabled="false"
+             follows="left|right"
+             height="23"
+             image_pressed="PushButton_Press"
+             image_pressed_selected="PushButton_Selected_Press"
+             image_selected="PushButton_Selected_Press"
+             is_toggle="true"
+             label="Sidebar"
+             layout="topleft"
+             left="0"
+             name="sidebar_btn"
+             tool_tip="Shows/hides Sidebar"
+             top="5"
+             use_ellipses="true"
+             width="80">
+                <init_callback
+                 function=""
+                 parameter="" />
+            </button>
+        </layout_panel>
         <layout_panel
          auto_resize="false"
          follows="left|right"