diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp
index 27dd7f5b324338e744c6afcd9834c730b7227c9f..09e27a264aa151399208526cf86d02ee21d7ba2d 100644
--- a/indra/llui/llfloater.cpp
+++ b/indra/llui/llfloater.cpp
@@ -1621,7 +1621,7 @@ void LLFloater::bringToFront( S32 x, S32 y )
 
 
 // virtual
-void LLFloater::setVisibleAndFrontmost(BOOL take_focus)
+void LLFloater::setVisibleAndFrontmost(BOOL take_focus, const LLSD& key)
 {
 	LLMultiFloater* hostp = getHost();
 	if (hostp)
diff --git a/indra/llui/llfloater.h b/indra/llui/llfloater.h
index cb5bf28db3c0e003f08ad524512836117ed79dd1..4dba1e645f5bdcf3d6319180c24efa89879c8170 100644
--- a/indra/llui/llfloater.h
+++ b/indra/llui/llfloater.h
@@ -305,7 +305,7 @@ class LLFloater : public LLPanel, public LLInstanceTracker<LLFloater>
 	/*virtual*/ void handleVisibilityChange ( BOOL new_visibility ); // do not override
 	
 	void			setFrontmost(BOOL take_focus = TRUE);
-    virtual void	setVisibleAndFrontmost(BOOL take_focus=TRUE);    
+    virtual void	setVisibleAndFrontmost(BOOL take_focus=TRUE, const LLSD& key = LLSD());    
 	
 	// Defaults to false.
 	virtual BOOL	canSaveAs() const { return FALSE; }
diff --git a/indra/llui/llfloaterreg.cpp b/indra/llui/llfloaterreg.cpp
index c20d8636126224d4b611969aa71697a5552c2a59..1cdddf0d5b93e830eabc4776cabcfb26bf3dd6e0 100644
--- a/indra/llui/llfloaterreg.cpp
+++ b/indra/llui/llfloaterreg.cpp
@@ -488,12 +488,12 @@ void LLFloaterReg::toggleInstanceOrBringToFront(const LLSD& sdname, const LLSD&
 		{
 			host->setMinimized(FALSE);
 			instance->openFloater(key);
-			instance->setVisibleAndFrontmost();
+			instance->setVisibleAndFrontmost(true, key);
 		}
 		else if (!instance->getVisible())
 		{
 			instance->openFloater(key);
-			instance->setVisibleAndFrontmost();
+			instance->setVisibleAndFrontmost(true, key);
 			instance->setFocus(TRUE);
 		}
 		else
@@ -506,16 +506,16 @@ void LLFloaterReg::toggleInstanceOrBringToFront(const LLSD& sdname, const LLSD&
 		if (instance->isMinimized())
 		{
 			instance->setMinimized(FALSE);
-			instance->setVisibleAndFrontmost();
+			instance->setVisibleAndFrontmost(true, key);
 		}
 		else if (!instance->isShown())
 		{
 			instance->openFloater(key);
-			instance->setVisibleAndFrontmost();
+			instance->setVisibleAndFrontmost(true, key);
 		}
 		else if (!instance->isFrontmost())
 		{
-			instance->setVisibleAndFrontmost();
+			instance->setVisibleAndFrontmost(true, key);
 		}
 		else
 		{
diff --git a/indra/newview/llfloaterimnearbychat.cpp b/indra/newview/llfloaterimnearbychat.cpp
index dfaf4bbdd60173592ef50486aa8ec831182f9d00..cfee5001a6d30e9348681fb9edc1deee7402fc80 100644
--- a/indra/newview/llfloaterimnearbychat.cpp
+++ b/indra/newview/llfloaterimnearbychat.cpp
@@ -257,6 +257,17 @@ void LLFloaterIMNearbyChat::setVisible(BOOL visible)
 	}
 }
 
+
+void LLFloaterIMNearbyChat::setVisibleAndFrontmost(BOOL take_focus, const LLSD& key)
+{
+	LLFloaterIMSessionTab::setVisibleAndFrontmost(take_focus, key);
+
+	if(!isTornOff() && matchesKey(key))
+	{
+		LLFloaterIMContainer::getInstance()->selectConversationPair(mSessionID, true, false);
+	}
+}
+
 // virtual
 void LLFloaterIMNearbyChat::onTearOffClicked()
 {
diff --git a/indra/newview/llfloaterimnearbychat.h b/indra/newview/llfloaterimnearbychat.h
index 4ad37eb0c7395f06ce5484faa03aa31df370f117..05b48cccb03657a2b3e7f646f04cdc9225eec7c9 100644
--- a/indra/newview/llfloaterimnearbychat.h
+++ b/indra/newview/llfloaterimnearbychat.h
@@ -54,6 +54,7 @@ class LLFloaterIMNearbyChat
 	/*virtual*/ void onOpen(const LLSD& key);
 	/*virtual*/ void onClose(bool app_quitting);
 	/*virtual*/ void setVisible(BOOL visible);
+	/*virtual*/ void setVisibleAndFrontmost(BOOL take_focus=TRUE, const LLSD& key = LLSD());
 	/*virtual*/ void closeHostedFloater();
 
 	void loadHistory();