diff --git a/indra/newview/llfloaterimcontainer.cpp b/indra/newview/llfloaterimcontainer.cpp
index 5a37b5b57b742218bd1ef4aee6a34413a93bd148..d67f2be658c508cf1bac4d9485d02309c0acb1a0 100644
--- a/indra/newview/llfloaterimcontainer.cpp
+++ b/indra/newview/llfloaterimcontainer.cpp
@@ -1912,7 +1912,19 @@ BOOL LLFloaterIMContainer::handleKeyHere(KEY key, MASK mask )
 	return TRUE;
 }
 
-bool LLFloaterIMContainer::selectNextorPreviousConversation(bool select_next)
+bool LLFloaterIMContainer::selectAdjacentConversation(bool focus_selected)
+{
+	bool selectedAdjacentConversation = selectNextorPreviousConversation(true, focus_selected);
+
+	if(!selectedAdjacentConversation)
+	{
+		selectedAdjacentConversation = selectNextorPreviousConversation(false, focus_selected);
+	}
+
+	return selectedAdjacentConversation;
+}
+
+bool LLFloaterIMContainer::selectNextorPreviousConversation(bool select_next, bool focus_selected)
 {
 	if (mConversationsWidgets.size() > 1)
 	{
@@ -1933,12 +1945,7 @@ bool LLFloaterIMContainer::selectNextorPreviousConversation(bool select_next)
 				LLConversationItem* vmi = dynamic_cast<LLConversationItem*>(new_selection->getViewModelItem());
 				if (vmi)
 				{
-					selectConversationPair(vmi->getUUID(), true);
-					LLFloater* floaterp = get_ptr_in_map(mSessions, getSelectedSession());
-					if(floaterp && !floaterp->isTornOff())
-					{
-						setFocus(TRUE);
-					}
+					selectConversationPair(vmi->getUUID(), true, focus_selected);
 					return true;
 				}
 			}
diff --git a/indra/newview/llfloaterimcontainer.h b/indra/newview/llfloaterimcontainer.h
index c84d4978ecd7572390618476850de67241b39b33..1e760a8710d6e6eece8aac5ab326fbb113b0d495 100644
--- a/indra/newview/llfloaterimcontainer.h
+++ b/indra/newview/llfloaterimcontainer.h
@@ -72,7 +72,8 @@ class LLFloaterIMContainer
 	void selectNextConversationByID(const LLUUID& session_id);
     BOOL selectConversationPair(const LLUUID& session_id, bool select_widget, bool focus_floater = true);
     void clearAllFlashStates();
-    bool selectNextorPreviousConversation(bool select_next);
+	bool selectAdjacentConversation(bool focus_selected);
+    bool selectNextorPreviousConversation(bool select_next, bool focus_selected = true);
     void expandConversation();
 
 	/*virtual*/ void tabClose();
diff --git a/indra/newview/llfloaterimsessiontab.cpp b/indra/newview/llfloaterimsessiontab.cpp
index 164625fc955a0fc7e7f4602e241e5f60db1a5144..faeb8607128833710b63021e45a0cad2350ab9db 100644
--- a/indra/newview/llfloaterimsessiontab.cpp
+++ b/indra/newview/llfloaterimsessiontab.cpp
@@ -794,14 +794,16 @@ void LLFloaterIMSessionTab::onTearOffClicked()
     mSaveRect = isTornOff();
     initRectControl();
 	LLFloater::onClickTearOff(this);
+	LLFloaterIMContainer* container = LLFloaterReg::findTypedInstance<LLFloaterIMContainer>("im_container");
+
 	if (isTornOff())
 	{
+		container->selectAdjacentConversation(false);
 		forceReshape();
 	}
 	//Upon re-docking the torn off floater, select the corresponding conversation line item
 	else
 	{
-		LLFloaterIMContainer* container = LLFloaterReg::findTypedInstance<LLFloaterIMContainer>("im_container");
 		container->selectConversation(mSessionID);
 	}
 	refreshConversation();