From 58f813a136a5a889e01b39e96714af91402321ba Mon Sep 17 00:00:00 2001
From: "Mark Palange (Mani)" <palange@lindenlab.com>
Date: Tue, 2 Feb 2010 14:45:42 -0800
Subject: [PATCH] merge

---
 etc/message.xml                               |   2 +-
 indra/lib/python/indra/util/llmanifest.py     |   1 +
 indra/llaudio/llstreamingaudio_fmod.cpp       |   2 +-
 indra/llcommon/llfasttimer.h                  | 194 +++++++-----
 indra/llmessage/llcurl.cpp                    |  20 +-
 indra/llmessage/llcurl.h                      |  11 +
 indra/llmessage/llhttpclient.cpp              |   2 +-
 indra/llmessage/llurlrequest.cpp              |   1 +
 indra/llplugin/llpluginclassmedia.cpp         |  35 ++-
 indra/llplugin/llpluginclassmedia.h           |  18 +-
 indra/llplugin/llpluginprocesschild.cpp       |  10 +-
 indra/llrender/llfontgl.cpp                   |  21 +-
 indra/llrender/llfontgl.h                     |   8 +-
 indra/llrender/llgl.cpp                       |  37 +++
 indra/llrender/llglstates.h                   |   2 +
 indra/llrender/llimagegl.cpp                  |  84 +++--
 indra/llrender/llimagegl.h                    |   2 +-
 indra/llrender/llrender.cpp                   |   2 +
 indra/llrender/llvertexbuffer.cpp             |  42 +--
 indra/llui/CMakeLists.txt                     |   4 +
 indra/llui/llcheckboxctrl.cpp                 |   2 +-
 indra/llui/llconsole.cpp                      |  10 +-
 indra/llui/lldockablefloater.cpp              |   9 +
 indra/llui/lldockablefloater.h                |  17 ++
 indra/llui/lldockcontrol.cpp                  |  12 +-
 indra/llui/llflatlistview.cpp                 |  12 +-
 indra/llui/llfloater.cpp                      |  64 ++--
 indra/llui/llfloater.h                        |   3 +-
 indra/llui/lllayoutstack.h                    |   5 +
 indra/llui/lllineeditor.cpp                   |   3 +-
 indra/llui/llmenubutton.h                     |   1 +
 indra/llui/llmenugl.cpp                       |  61 ++--
 indra/llui/llmultislider.cpp                  |   2 +-
 indra/llui/llpanel.cpp                        |  61 +++-
 indra/llui/llpanel.h                          |   3 +
 indra/llui/llresizehandle.cpp                 |  81 +++--
 indra/llui/llscrollcontainer.cpp              |   5 +
 indra/llui/llscrolllistcell.cpp               |   2 +-
 indra/llui/llscrolllistctrl.cpp               |   5 +-
 indra/llui/llscrolllistctrl.h                 |   3 +
 indra/llui/lltextbase.cpp                     |  21 +-
 indra/llui/lltexteditor.cpp                   |   3 +-
 indra/llui/lluictrl.cpp                       |   8 +
 indra/llui/llurlentry.cpp                     |  10 +-
 indra/llui/tests/llurlentry_test.cpp          |  66 ++++
 indra/llvfs/lldir.cpp                         |  15 +-
 indra/llvfs/lldir.h                           |   2 +-
 indra/llvfs/lldir_linux.cpp                   |   3 +-
 indra/llvfs/lldir_solaris.cpp                 |   2 +-
 indra/llwindow/llkeyboardwin32.cpp            |   2 +-
 indra/llwindow/llwindowwin32.cpp              |  24 +-
 .../webkit/media_plugin_webkit.cpp            |  57 +++-
 indra/newview/CMakeLists.txt                  |  38 ++-
 .../app_settings/ignorable_dialogs.xml        |  15 +-
 indra/newview/app_settings/settings.xml       |  87 +++---
 indra/newview/character/avatar_lad.xml        |  12 +-
 indra/newview/llagent.cpp                     |  27 +-
 indra/newview/llagent.h                       |   1 +
 indra/newview/llagentwearables.cpp            | 286 ++++++++++++++++--
 indra/newview/llappearancemgr.cpp             | 174 +++++++++--
 indra/newview/llappearancemgr.h               |  17 +-
 indra/newview/llappviewer.cpp                 |  59 ++--
 indra/newview/llavataractions.cpp             |  10 +-
 indra/newview/llavatariconctrl.cpp            |   4 +-
 indra/newview/llavatarlist.cpp                |  19 +-
 indra/newview/llavatarlist.h                  |   4 +
 indra/newview/llavatarlistitem.cpp            | 266 ++++++++++------
 indra/newview/llavatarlistitem.h              |  71 ++++-
 indra/newview/llbottomtray.cpp                |  96 +++++-
 indra/newview/llbottomtray.h                  |  17 +-
 indra/newview/llcallfloater.cpp               | 164 +++-------
 indra/newview/llcallfloater.h                 |  23 +-
 indra/newview/llchatbar.cpp                   |   3 +-
 indra/newview/llchathistory.cpp               |  65 ++--
 indra/newview/llchathistory.h                 |   1 +
 indra/newview/llchatitemscontainerctrl.cpp    |  64 ++--
 indra/newview/llchatitemscontainerctrl.h      |   1 +
 indra/newview/llchiclet.cpp                   |  67 +++-
 indra/newview/llchiclet.h                     |  21 +-
 indra/newview/llcompilequeue.cpp              |  15 +-
 indra/newview/lldateutil.cpp                  |   7 +-
 indra/newview/lldrawpoolbump.cpp              |   4 +-
 indra/newview/lldrawpoolwlsky.cpp             |  21 +-
 indra/newview/lldrawpoolwlsky.h               |   2 +-
 indra/newview/llfasttimerview.cpp             |   6 +-
 indra/newview/llfavoritesbar.cpp              |  38 +--
 indra/newview/llfavoritesbar.h                |  11 +-
 indra/newview/llfirstuse.cpp                  |  15 +-
 indra/newview/llfirstuse.h                    |   7 +
 indra/newview/llfloaterabout.cpp              |  19 +-
 indra/newview/llfloaterbulkpermission.cpp     |   1 -
 indra/newview/llfloatercamera.cpp             |  25 +-
 indra/newview/llfloatercamera.h               |   4 +-
 indra/newview/llfloaterchat.cpp               |  33 +-
 indra/newview/llfloaterchat.h                 |   2 +-
 indra/newview/llfloaterchatterbox.cpp         |  28 +-
 indra/newview/llfloatergesture.cpp            |  12 +-
 indra/newview/llfloatergesture.h              |   2 +-
 indra/newview/llfloatergroups.cpp             |   9 +-
 indra/newview/llfloaterinventory.cpp          |   4 +-
 indra/newview/llfloaterland.cpp               |   7 +-
 indra/newview/llfloaterland.h                 |   1 -
 indra/newview/llfloatermediasettings.cpp      |  10 +-
 indra/newview/llfloaterpreference.cpp         |  60 +++-
 indra/newview/llfloaterpreference.h           |   6 +-
 indra/newview/llfloaterregioninfo.cpp         |   7 +-
 indra/newview/llfloaterscriptlimits.cpp       | 101 ++++++-
 indra/newview/llfloaterscriptlimits.h         |  14 +-
 indra/newview/llfloatersearch.cpp             |  39 +++
 indra/newview/llfloatersettingsdebug.cpp      |   2 +-
 indra/newview/llfloatersnapshot.cpp           |   4 +-
 indra/newview/llfloatertools.cpp              |  60 ++--
 .../newview/llfloatervoicedevicesettings.cpp  |  38 +--
 indra/newview/llfloaterworldmap.cpp           |  76 ++---
 indra/newview/llfloaterworldmap.h             |   5 +-
 indra/newview/llfolderview.cpp                |  36 +--
 indra/newview/llfolderview.h                  |   2 +-
 indra/newview/llfoldervieweventlistener.h     |   1 +
 indra/newview/llfolderviewitem.cpp            | 133 ++++----
 indra/newview/llfolderviewitem.h              |  20 +-
 indra/newview/llgesturemgr.cpp                |  10 +
 indra/newview/llgesturemgr.h                  |   2 +
 indra/newview/llgroupactions.cpp              |  10 +-
 indra/newview/llgrouplist.cpp                 |   5 +-
 indra/newview/llhudtext.cpp                   |   6 +-
 indra/newview/llimfloater.cpp                 | 130 ++++----
 indra/newview/llimfloater.h                   |   5 +-
 indra/newview/llimfloatercontainer.cpp        |  11 +
 indra/newview/llimfloatercontainer.h          |   6 +-
 indra/newview/llimpanel.cpp                   |   2 +-
 indra/newview/llimview.cpp                    | 112 ++++---
 indra/newview/llimview.h                      |  17 +-
 indra/newview/llinspect.h                     |   2 +-
 indra/newview/llinspectavatar.cpp             | 103 +++++--
 indra/newview/llinspectobject.cpp             |  20 +-
 indra/newview/llinventorybridge.cpp           | 143 +++------
 indra/newview/llinventorybridge.h             |   1 +
 indra/newview/llinventoryfunctions.cpp        |   3 +-
 indra/newview/llinventorymodel.cpp            | 106 ++++++-
 indra/newview/llinventorymodel.h              |  33 ++
 indra/newview/llinventoryobserver.cpp         |  35 ++-
 indra/newview/llinventorypanel.cpp            |  53 ++--
 indra/newview/llinventorypanel.h              |   2 +-
 indra/newview/lllandmarklist.cpp              |   7 +
 indra/newview/lllocationhistory.cpp           |   6 +
 indra/newview/lllogchat.cpp                   |   4 -
 indra/newview/llmanip.cpp                     |   2 +-
 indra/newview/llmediactrl.cpp                 | 272 +++++++++--------
 indra/newview/llmediactrl.h                   |   1 -
 indra/newview/llmenucommands.cpp              |   3 +-
 indra/newview/llmorphview.cpp                 |   4 +-
 indra/newview/llmutelist.cpp                  |   7 +-
 indra/newview/llnamebox.cpp                   |  35 ++-
 indra/newview/llnamebox.h                     |   6 +
 indra/newview/llnamelistctrl.cpp              |  80 +++--
 indra/newview/llnamelistctrl.h                |   5 +-
 indra/newview/llnearbychat.cpp                |  28 +-
 indra/newview/llnearbychatbar.cpp             | 252 +++++++++++----
 indra/newview/llnearbychatbar.h               |  47 ++-
 indra/newview/llnearbychathandler.cpp         |  23 +-
 indra/newview/llnotificationofferhandler.cpp  |   4 +-
 indra/newview/lloutputmonitorctrl.cpp         |  65 +++-
 indra/newview/lloutputmonitorctrl.h           |  29 +-
 indra/newview/llpanelavatar.cpp               |  20 +-
 indra/newview/llpanelclassified.cpp           |  15 +-
 indra/newview/llpanelclassified.h             |   1 +
 indra/newview/llpanelgroup.cpp                |  79 ++++-
 indra/newview/llpanelgroup.h                  |   4 +
 indra/newview/llpanelgroupgeneral.cpp         |  11 +-
 indra/newview/llpanelgroupnotices.cpp         |   2 +-
 indra/newview/llpanelgrouproles.cpp           |  61 ++--
 indra/newview/llpanelgrouproles.h             |  13 +-
 indra/newview/llpanelhome.cpp                 |   2 +-
 indra/newview/llpanelimcontrolpanel.cpp       |   9 +-
 indra/newview/llpanellandaudio.cpp            |  62 ++--
 indra/newview/llpanellandaudio.h              |   4 +-
 indra/newview/llpanellandmarkinfo.cpp         |   7 +
 indra/newview/llpanellandmarks.cpp            |  57 +++-
 indra/newview/llpanellandmarks.h              |  16 +
 indra/newview/llpanelmaininventory.cpp        |   6 +-
 indra/newview/llpanelobject.cpp               |   4 +-
 indra/newview/llpanelobjectinventory.cpp      |   2 +-
 indra/newview/llpaneloutfitsinventory.cpp     | 175 +++++++++--
 indra/newview/llpaneloutfitsinventory.h       |   6 +-
 indra/newview/llpanelpeople.cpp               |  27 +-
 indra/newview/llpanelpeople.h                 |   2 +-
 indra/newview/llpanelpick.cpp                 | 100 +++---
 indra/newview/llpanelpick.h                   |  23 +-
 indra/newview/llpanelpicks.cpp                |  14 +-
 indra/newview/llpanelpicks.h                  |   1 +
 indra/newview/llpanelplaces.cpp               |  31 ++
 indra/newview/llpanelplaces.h                 |   6 +
 indra/newview/llpanelprimmediacontrols.cpp    | 120 ++++----
 indra/newview/llpanelprimmediacontrols.h      |   4 +-
 indra/newview/llpanelteleporthistory.cpp      |  14 +-
 indra/newview/llpanelvolume.cpp               |   4 +-
 indra/newview/llparticipantlist.cpp           |  23 +-
 indra/newview/llparticipantlist.h             |   2 +-
 indra/newview/llpreviewgesture.cpp            |   6 +
 indra/newview/llpreviewnotecard.cpp           |   1 -
 indra/newview/llpreviewscript.cpp             |   1 -
 201 files changed, 4193 insertions(+), 2010 deletions(-)

diff --git a/etc/message.xml b/etc/message.xml
index da08e12aa1b..c17ae3656d0 100644
--- a/etc/message.xml
+++ b/etc/message.xml
@@ -50,7 +50,7 @@
 				<key>OpenCircuit</key>
 				<map>
 					<key>flavor</key>
-					<string>template</string>
+					<string>llsd</string>
 					<key>trusted-sender</key>
 					<boolean>false</boolean>
 				</map>
diff --git a/indra/lib/python/indra/util/llmanifest.py b/indra/lib/python/indra/util/llmanifest.py
index 8c052106189..7e5b86c53f9 100644
--- a/indra/lib/python/indra/util/llmanifest.py
+++ b/indra/lib/python/indra/util/llmanifest.py
@@ -119,6 +119,7 @@ def get_channel(srctree):
         On Linux this would try to use Linux_i686Manifest.""",
          default=""),
     dict(name='build', description='Build directory.', default=DEFAULT_SRCTREE),
+    dict(name='buildtype', description='Build type (i.e. Debug, Release, RelWithDebInfo).', default=None),
     dict(name='configuration',
          description="""The build configuration used.""",
          default="Release"),
diff --git a/indra/llaudio/llstreamingaudio_fmod.cpp b/indra/llaudio/llstreamingaudio_fmod.cpp
index a71a87203c1..a4620fa13c5 100644
--- a/indra/llaudio/llstreamingaudio_fmod.cpp
+++ b/indra/llaudio/llstreamingaudio_fmod.cpp
@@ -174,7 +174,7 @@ void LLStreamingAudio_FMOD::update()
 		break;
 	case -3:
 		// failed to open, file not found, perhaps
-		llwarns << "InternetSteam - failed to open" << llendl;
+		llwarns << "InternetStream - failed to open" << llendl;
 		stop();
 		return;
 	case -4:
diff --git a/indra/llcommon/llfasttimer.h b/indra/llcommon/llfasttimer.h
index f5c90291b80..8af79c90fd6 100644
--- a/indra/llcommon/llfasttimer.h
+++ b/indra/llcommon/llfasttimer.h
@@ -1,11 +1,11 @@
-/** 
+/**
  * @file llfasttimer.h
  * @brief Declaration of a fast timer.
  *
  * $LicenseInfo:firstyear=2004&license=viewergpl$
- * 
+ *
  * Copyright (c) 2004-2009, Linden Research, Inc.
- * 
+ *
  * Second Life Viewer Source Code
  * The source code in this file ("Source Code") is provided by Linden Lab
  * to you under the terms of the GNU General Public License, version 2.0
@@ -13,17 +13,17 @@
  * ("Other License"), formally executed by you and Linden Lab.  Terms of
  * the GPL can be found in doc/GPL-license.txt in this distribution, or
  * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
- * 
+ *
  * There are special exceptions to the terms and conditions of the GPL as
  * it is applied to this Source Code. View the full text of the exception
  * in the file doc/FLOSS-exception.txt in this software distribution, or
  * online at
  * http://secondlifegrid.net/programs/open_source/licensing/flossexception
- * 
+ *
  * By copying, modifying or distributing this software, you acknowledge
  * that you have read and understood your obligations described above,
  * and agree to abide by those obligations.
- * 
+ *
  * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
  * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
  * COMPLETENESS OR PERFORMANCE.
@@ -39,13 +39,37 @@
 #define TIME_FAST_TIMERS 0
 
 #if LL_WINDOWS
+#define LL_INLINE __forceinline
+
+//
+// NOTE: put back in when we aren't using platform sdk anymore
+//
+// because MS has different signatures for these functions in winnt.h
+// need to rename them to avoid conflicts
+//#define _interlockedbittestandset _renamed_interlockedbittestandset
+//#define _interlockedbittestandreset _renamed_interlockedbittestandreset
+//#include <intrin.h>
+//#undef _interlockedbittestandset
+//#undef _interlockedbittestandreset
+
+//inline U32 get_cpu_clock_count_32()
+//{
+//	U64 time_stamp = __rdtsc();
+//	return (U32)(time_stamp >> 8);
+//}
+//
+//// return full timer value, *not* shifted by 8 bits
+//inline U64 get_cpu_clock_count_64()
+//{
+//	return __rdtsc();
+//}
 
 // shift off lower 8 bits for lower resolution but longer term timing
 // on 1Ghz machine, a 32-bit word will hold ~1000 seconds of timing
 inline U32 get_cpu_clock_count_32()
 {
 	U32 ret_val;
-	__asm 
+	__asm
 	{
         _emit   0x0f
         _emit   0x31
@@ -61,7 +85,7 @@ inline U32 get_cpu_clock_count_32()
 inline U64 get_cpu_clock_count_64()
 {
 	U64 ret_val;
-	__asm 
+	__asm
 	{
         _emit   0x0f
         _emit   0x31
@@ -72,19 +96,20 @@ inline U64 get_cpu_clock_count_64()
 	}
     return ret_val;
 }
-
-#endif // LL_WINDOWS
+#else
+#define LL_INLINE
+#endif
 
 #if (LL_LINUX || LL_SOLARIS || LL_DARWIN) && (defined(__i386__) || defined(__amd64__))
 inline U32 get_cpu_clock_count_32()
-{																	
-	U64 x;															
-	__asm__ volatile (".byte 0x0f, 0x31": "=A"(x));					
-	return (U32)x >> 8;													
+{
+	U64 x;
+	__asm__ volatile (".byte 0x0f, 0x31": "=A"(x));
+	return (U32)x >> 8;
 }
 
 inline U32 get_cpu_clock_count_64()
-{																	
+{
 	U64 x;
 	__asm__ volatile (".byte 0x0f, 0x31": "=A"(x));
 	return x >> 8;
@@ -103,7 +128,7 @@ inline U32 get_cpu_clock_count_32()
 }
 
 inline U32 get_cpu_clock_count_64()
-{																	
+{
 	return get_clock_count();
 }
 #endif
@@ -113,12 +138,27 @@ class LLMutex;
 #include <queue>
 #include "llsd.h"
 
-
 class LL_COMMON_API LLFastTimer
 {
 public:
+
+	class NamedTimer;
+
+	struct LL_COMMON_API FrameState
+	{
+		FrameState(NamedTimer* timerp);
+
+		U32 				mSelfTimeCounter;
+		U32 				mCalls;
+		FrameState*			mParent;		// info for caller timer
+		FrameState*			mLastCaller;	// used to bootstrap tree construction
+		NamedTimer*			mTimer;
+		U16					mActiveCount;	// number of timers with this ID active on stack
+		bool				mMoveUpTree;	// needs to be moved up the tree of timers at the end of frame
+	};
+
 	// stores a "named" timer instance to be reused via multiple LLFastTimer stack instances
-	class LL_COMMON_API NamedTimer 
+	class LL_COMMON_API NamedTimer
 	:	public LLInstanceTracker<NamedTimer>
 	{
 		friend class DeclareTimer;
@@ -149,25 +189,11 @@ class LL_COMMON_API LLFastTimer
 
 		static NamedTimer& getRootNamedTimer();
 
-		struct FrameState
-		{
-			FrameState(NamedTimer* timerp);
-
-			U32 		mSelfTimeCounter;
-			U32 		mCalls;
-			FrameState*	mParent;		// info for caller timer
-			FrameState*	mLastCaller;	// used to bootstrap tree construction
-			NamedTimer*	mTimer;
-			U16			mActiveCount;	// number of timers with this ID active on stack
-			bool		mMoveUpTree;	// needs to be moved up the tree of timers at the end of frame
-		};
-
 		S32 getFrameStateIndex() const { return mFrameStateIndex; }
 
 		FrameState& getFrameState() const;
 
-
-	private: 
+	private:
 		friend class LLFastTimer;
 		friend class NamedTimerFactory;
 
@@ -178,7 +204,7 @@ class LL_COMMON_API LLFastTimer
 		// recursive call to gather total time from children
 		static void accumulateTimings();
 
-		// updates cumulative times and hierarchy, 
+		// updates cumulative times and hierarchy,
 		// can be called multiple times in a frame, at any point
 		static void processTimes();
 
@@ -186,7 +212,6 @@ class LL_COMMON_API LLFastTimer
 		static void resetFrame();
 		static void reset();
 
-	
 		//
 		// members
 		//
@@ -207,58 +232,47 @@ class LL_COMMON_API LLFastTimer
 		std::vector<NamedTimer*>	mChildren;
 		bool						mCollapsed;				// don't show children
 		bool						mNeedsSorting;			// sort children whenever child added
-
 	};
 
 	// used to statically declare a new named timer
 	class LL_COMMON_API DeclareTimer
 	:	public LLInstanceTracker<DeclareTimer>
 	{
+		friend class LLFastTimer;
 	public:
 		DeclareTimer(const std::string& name, bool open);
 		DeclareTimer(const std::string& name);
 
 		static void updateCachedPointers();
 
-		// convertable to NamedTimer::FrameState for convenient usage of LLFastTimer(declared_timer)
-		operator NamedTimer::FrameState&() { return *mFrameState; }
 	private:
-		NamedTimer&				mTimer;
-		NamedTimer::FrameState* mFrameState; 
+		NamedTimer&		mTimer;
+		FrameState*		mFrameState;
 	};
 
-
 public:
-	static LLMutex* sLogLock;
-	static std::queue<LLSD> sLogQueue;
-	static BOOL sLog;
-	static BOOL sMetricLog;
-
-	typedef std::vector<NamedTimer::FrameState> info_list_t;
-	static info_list_t& getFrameStateList();
+	LLFastTimer(LLFastTimer::FrameState* state);
 
-	enum RootTimerMarker { ROOT };
-	LLFastTimer(RootTimerMarker);
-
-	LLFastTimer(NamedTimer::FrameState& timer)
-	:	mFrameState(&timer)
+	LL_INLINE LLFastTimer(LLFastTimer::DeclareTimer& timer)
+	:	mFrameState(timer.mFrameState)
 	{
 #if TIME_FAST_TIMERS
 		U64 timer_start = get_cpu_clock_count_64();
 #endif
 #if FAST_TIMER_ON
-		NamedTimer::FrameState* frame_state = &timer;
-		U32 cur_time = get_cpu_clock_count_32();
-		mStartSelfTime = cur_time;
-		mStartTotalTime = cur_time;
+		LLFastTimer::FrameState* frame_state = mFrameState;
+		mStartTime = get_cpu_clock_count_32();
 
 		frame_state->mActiveCount++;
 		frame_state->mCalls++;
 		// keep current parent as long as it is active when we are
 		frame_state->mMoveUpTree |= (frame_state->mParent->mActiveCount == 0);
-	
-		mLastTimer = sCurTimer;
-		sCurTimer = this;
+
+		LLFastTimer::CurTimerData* cur_timer_data = &LLFastTimer::sCurTimerData;
+		mLastTimerData = *cur_timer_data;
+		cur_timer_data->mCurTimer = this;
+		cur_timer_data->mFrameState = frame_state;
+		cur_timer_data->mChildTime = 0;
 #endif
 #if TIME_FAST_TIMERS
 		U64 timer_end = get_cpu_clock_count_64();
@@ -266,41 +280,54 @@ class LL_COMMON_API LLFastTimer
 #endif
 	}
 
-	~LLFastTimer()
+	LL_INLINE ~LLFastTimer()
 	{
 #if TIME_FAST_TIMERS
 		U64 timer_start = get_cpu_clock_count_64();
 #endif
 #if FAST_TIMER_ON
-		NamedTimer::FrameState* frame_state = mFrameState;
-		U32 cur_time = get_cpu_clock_count_32();
-		frame_state->mSelfTimeCounter += cur_time - mStartSelfTime;
+		LLFastTimer::FrameState* frame_state = mFrameState;
+		U32 total_time = get_cpu_clock_count_32() - mStartTime;
 
+		frame_state->mSelfTimeCounter += total_time - LLFastTimer::sCurTimerData.mChildTime;
 		frame_state->mActiveCount--;
-		LLFastTimer* last_timer = mLastTimer;
-		sCurTimer = last_timer;
 
 		// store last caller to bootstrap tree creation
-		frame_state->mLastCaller = last_timer->mFrameState;
+		// do this in the destructor in case of recursion to get topmost caller
+		frame_state->mLastCaller = mLastTimerData.mFrameState;
 
 		// we are only tracking self time, so subtract our total time delta from parents
-		U32 total_time = cur_time - mStartTotalTime;
-		last_timer->mStartSelfTime += total_time;
+		mLastTimerData.mChildTime += total_time;
+
+		LLFastTimer::sCurTimerData = mLastTimerData;
 #endif
 #if TIME_FAST_TIMERS
 		U64 timer_end = get_cpu_clock_count_64();
 		sTimerCycles += timer_end - timer_start;
 		sTimerCalls++;
-#endif	
+#endif
 	}
 
+public:
+	static LLMutex*			sLogLock;
+	static std::queue<LLSD> sLogQueue;
+	static BOOL				sLog;
+	static BOOL				sMetricLog;
+	static bool 			sPauseHistory;
+	static bool 			sResetHistory;
+	static U64				sTimerCycles;
+	static U32				sTimerCalls;
+
+	typedef std::vector<FrameState> info_list_t;
+	static info_list_t& getFrameStateList();
+
 
 	// call this once a frame to reset timers
 	static void nextFrame();
 
 	// dumps current cumulative frame stats to log
 	// call nextFrame() to reset timers
-	static void dumpCurTimes(); 
+	static void dumpCurTimes();
 
 	// call this to reset timer hierarchy, averages, etc.
 	static void reset();
@@ -312,23 +339,26 @@ class LL_COMMON_API LLFastTimer
 	static void writeLog(std::ostream& os);
 	static const NamedTimer* getTimerByName(const std::string& name);
 
-public:
-	static bool 			sPauseHistory;
-	static bool 			sResetHistory;
-	static U64				sTimerCycles;
-	static U32				sTimerCalls;
-	
+	struct CurTimerData
+	{
+		LLFastTimer*	mCurTimer;
+		FrameState*		mFrameState;
+		U32				mChildTime;
+	};
+	static CurTimerData		sCurTimerData;
+
 private:
-	static LLFastTimer*		sCurTimer;
 	static S32				sCurFrameIndex;
 	static S32				sLastFrameIndex;
 	static U64				sLastFrameTime;
 	static info_list_t*		sTimerInfos;
 
-	U32						mStartSelfTime;	// start time + time of all child timers
-	U32						mStartTotalTime;	// start time + time of all child timers
-	NamedTimer::FrameState*	mFrameState;
-	LLFastTimer*			mLastTimer;
+	U32							mStartTime;
+	LLFastTimer::FrameState*	mFrameState;
+	LLFastTimer::CurTimerData	mLastTimerData;
+
 };
 
+typedef class LLFastTimer LLFastTimer;
+
 #endif // LL_LLFASTTIMER_H
diff --git a/indra/llmessage/llcurl.cpp b/indra/llmessage/llcurl.cpp
index dc02367a622..024e17a7779 100644
--- a/indra/llmessage/llcurl.cpp
+++ b/indra/llmessage/llcurl.cpp
@@ -89,6 +89,10 @@ S32 gCurlMultiCount = 0;
 std::vector<LLMutex*> LLCurl::sSSLMutex;
 std::string LLCurl::sCAPath;
 std::string LLCurl::sCAFile;
+// Verify SSL certificates by default (matches libcurl default). The ability
+// to alter this flag is only to allow us to suppress verification if it's
+// broken for some reason.
+bool LLCurl::sSSLVerify = true;
 
 //static
 void LLCurl::setCAPath(const std::string& path)
@@ -102,6 +106,18 @@ void LLCurl::setCAFile(const std::string& file)
 	sCAFile = file;
 }
 
+//static
+void LLCurl::setSSLVerify(bool verify)
+{
+	sSSLVerify = verify;
+}
+
+//static
+bool LLCurl::getSSLVerify()
+{
+	return sSSLVerify;
+}
+
 //static
 std::string LLCurl::getVersionString()
 {
@@ -465,7 +481,8 @@ void LLCurl::Easy::prepRequest(const std::string& url,
 	setErrorBuffer();
 	setCA();
 
-	setopt(CURLOPT_SSL_VERIFYPEER, true);
+	setopt(CURLOPT_SSL_VERIFYPEER, LLCurl::getSSLVerify());
+	setopt(CURLOPT_SSL_VERIFYHOST, LLCurl::getSSLVerify()? 2 : 0);
 	setopt(CURLOPT_TIMEOUT, CURL_REQUEST_TIMEOUT);
 
 	setoptString(CURLOPT_URL, url);
@@ -1044,4 +1061,3 @@ void LLCurl::cleanupClass()
 #endif
 	curl_global_cleanup();
 }
-
diff --git a/indra/llmessage/llcurl.h b/indra/llmessage/llcurl.h
index 1bc17679669..caf02cccd90 100644
--- a/indra/llmessage/llcurl.h
+++ b/indra/llmessage/llcurl.h
@@ -157,6 +157,16 @@ class LLCurl
 	 */
 	static const std::string& getCAPath() { return sCAPath; }
 
+	/**
+	 * @ brief Set flag controlling whether to verify HTTPS certs.
+	 */
+	static void setSSLVerify(bool verify);
+
+	/**
+	 * @ brief Get flag controlling whether to verify HTTPS certs.
+	 */
+	static bool getSSLVerify();
+
 	/**
 	 * @ brief Initialize LLCurl class
 	 */
@@ -182,6 +192,7 @@ class LLCurl
 private:
 	static std::string sCAPath;
 	static std::string sCAFile;
+	static bool sSSLVerify;
 };
 
 namespace boost
diff --git a/indra/llmessage/llhttpclient.cpp b/indra/llmessage/llhttpclient.cpp
index 12ecbb36eb8..dd56e18caf8 100644
--- a/indra/llmessage/llhttpclient.cpp
+++ b/indra/llmessage/llhttpclient.cpp
@@ -222,7 +222,7 @@ static void request(
 	LLPumpIO::chain_t chain;
 
 	LLURLRequest* req = new LLURLRequest(method, url);
-	req->checkRootCertificate(true);
+	req->checkRootCertificate(LLCurl::getSSLVerify());
 
 	
 	lldebugs << LLURLRequest::actionAsVerb(method) << " " << url << " "
diff --git a/indra/llmessage/llurlrequest.cpp b/indra/llmessage/llurlrequest.cpp
index 81b7761ed5f..4e7ceff9843 100644
--- a/indra/llmessage/llurlrequest.cpp
+++ b/indra/llmessage/llurlrequest.cpp
@@ -163,6 +163,7 @@ void LLURLRequest::setBodyLimit(U32 size)
 void LLURLRequest::checkRootCertificate(bool check)
 {
 	mDetail->mCurlRequest->setopt(CURLOPT_SSL_VERIFYPEER, (check? TRUE : FALSE));
+	mDetail->mCurlRequest->setopt(CURLOPT_SSL_VERIFYHOST, (check? 2 : 0));
 	mDetail->mCurlRequest->setoptString(CURLOPT_ENCODING, "");
 }
 
diff --git a/indra/llplugin/llpluginclassmedia.cpp b/indra/llplugin/llpluginclassmedia.cpp
index 1a382643da5..3d2eaed5c5a 100644
--- a/indra/llplugin/llpluginclassmedia.cpp
+++ b/indra/llplugin/llpluginclassmedia.cpp
@@ -37,6 +37,8 @@
 #include "llpluginclassmedia.h"
 #include "llpluginmessageclasses.h"
 
+#include "llqtwebkit.h"
+
 static int LOW_PRIORITY_TEXTURE_SIZE_DEFAULT = 256;
 
 static int nextPowerOf2( int value )
@@ -124,7 +126,8 @@ void LLPluginClassMedia::reset()
 	mCanPaste = false;
 	mMediaName.clear();
 	mMediaDescription.clear();
-
+	mBackgroundColor = LLColor4(1.0f, 1.0f, 1.0f, 1.0f);
+	
 	// media_browser class
 	mNavigateURI.clear();
 	mNavigateResultCode = -1;
@@ -133,6 +136,9 @@ void LLPluginClassMedia::reset()
 	mHistoryForwardAvailable = false;
 	mStatusText.clear();
 	mProgressPercent = 0;	
+	mClickURL.clear();
+	mClickTarget.clear();
+	mClickTargetType = TARGET_NONE;
 	
 	// media_time class
 	mCurrentTime = 0.0f;
@@ -234,6 +240,10 @@ void LLPluginClassMedia::idle(void)
 			message.setValueS32("height", mRequestedMediaHeight);
 			message.setValueS32("texture_width", mRequestedTextureWidth);
 			message.setValueS32("texture_height", mRequestedTextureHeight);
+			message.setValueReal("background_r", mBackgroundColor.mV[VX]);
+			message.setValueReal("background_g", mBackgroundColor.mV[VY]);
+			message.setValueReal("background_b", mBackgroundColor.mV[VZ]);
+			message.setValueReal("background_a", mBackgroundColor.mV[VW]);
 			mPlugin->sendMessage(message);	// DO NOT just use sendMessage() here -- we want this to jump ahead of the queue.
 			
 			LL_DEBUGS("Plugin") << "Sending size_change" << LL_ENDL;
@@ -664,6 +674,26 @@ void LLPluginClassMedia::paste()
 	sendMessage(message);
 }
 
+LLPluginClassMedia::ETargetType getTargetTypeFromLLQtWebkit(int target_type)
+{
+	// convert a LinkTargetType value from llqtwebkit to an ETargetType
+	// so that we don't expose the llqtwebkit header in viewer code
+	switch (target_type)
+	{
+	case LinkTargetType::LTT_TARGET_NONE:
+		return LLPluginClassMedia::TARGET_NONE;
+
+	case LinkTargetType::LTT_TARGET_BLANK:
+		return LLPluginClassMedia::TARGET_BLANK;
+
+	case LinkTargetType::LTT_TARGET_EXTERNAL:
+		return LLPluginClassMedia::TARGET_EXTERNAL;
+
+	default:
+		return LLPluginClassMedia::TARGET_OTHER;
+	}
+}
+
 /* virtual */ 
 void LLPluginClassMedia::receivePluginMessage(const LLPluginMessage &message)
 {
@@ -916,12 +946,15 @@ void LLPluginClassMedia::receivePluginMessage(const LLPluginMessage &message)
 		{
 			mClickURL = message.getValue("uri");
 			mClickTarget = message.getValue("target");
+			U32 target_type = message.getValueU32("target_type");
+			mClickTargetType = ::getTargetTypeFromLLQtWebkit(target_type);
 			mediaEvent(LLPluginClassMediaOwner::MEDIA_EVENT_CLICK_LINK_HREF);
 		}
 		else if(message_name == "click_nofollow")
 		{
 			mClickURL = message.getValue("uri");
 			mClickTarget.clear();
+			mClickTargetType = TARGET_NONE;
 			mediaEvent(LLPluginClassMediaOwner::MEDIA_EVENT_CLICK_LINK_NOFOLLOW);
 		}
 		else
diff --git a/indra/llplugin/llpluginclassmedia.h b/indra/llplugin/llpluginclassmedia.h
index b58067733b5..ebb90995766 100644
--- a/indra/llplugin/llpluginclassmedia.h
+++ b/indra/llplugin/llpluginclassmedia.h
@@ -39,7 +39,7 @@
 #include "llrect.h"
 #include "llpluginclassmediaowner.h"
 #include <queue>
-
+#include "v4color.h"
 
 class LLPluginClassMedia : public LLPluginProcessParentOwner
 {
@@ -86,6 +86,8 @@ class LLPluginClassMedia : public LLPluginProcessParentOwner
 	void setSize(int width, int height);
 	void setAutoScale(bool auto_scale);
 	
+	void setBackgroundColor(LLColor4 color) { mBackgroundColor = color; };
+	
 	// Returns true if all of the texture parameters (depth, format, size, and texture size) are set up and consistent.
 	// This will initially be false, and will also be false for some time after setSize while the resize is processed.
 	// Note that if this returns true, it is safe to use all the get() functions above without checking for invalid return values
@@ -212,6 +214,17 @@ class LLPluginClassMedia : public LLPluginProcessParentOwner
 	// This is valid after MEDIA_EVENT_CLICK_LINK_HREF
 	std::string getClickTarget() const { return mClickTarget; };
 
+	typedef enum 
+	{
+		TARGET_NONE,        // empty href target string
+		TARGET_BLANK,       // target to open link in user's preferred browser
+		TARGET_EXTERNAL,    // target to open link in external browser
+		TARGET_OTHER        // nonempty and unsupported target type
+	}ETargetType;
+
+	// This is valid after MEDIA_EVENT_CLICK_LINK_HREF
+	ETargetType getClickTargetType() const { return mClickTargetType; };
+
 	std::string getMediaName() const { return mMediaName; };
 	std::string getMediaDescription() const { return mMediaDescription; };
 
@@ -328,6 +341,8 @@ class LLPluginClassMedia : public LLPluginProcessParentOwner
 	std::string		mMediaName;
 	std::string		mMediaDescription;
 	
+	LLColor4		mBackgroundColor;
+	
 	/////////////////////////////////////////
 	// media_browser class
 	std::string		mNavigateURI;
@@ -340,6 +355,7 @@ class LLPluginClassMedia : public LLPluginProcessParentOwner
 	std::string		mLocation;
 	std::string		mClickURL;
 	std::string		mClickTarget;
+	ETargetType     mClickTargetType;
 	
 	/////////////////////////////////////////
 	// media_time class
diff --git a/indra/llplugin/llpluginprocesschild.cpp b/indra/llplugin/llpluginprocesschild.cpp
index ccf6dab942a..07fc82c770f 100644
--- a/indra/llplugin/llpluginprocesschild.cpp
+++ b/indra/llplugin/llpluginprocesschild.cpp
@@ -54,8 +54,14 @@ LLPluginProcessChild::~LLPluginProcessChild()
 	if(mInstance != NULL)
 	{
 		sendMessageToPlugin(LLPluginMessage("base", "cleanup"));
-		delete mInstance;
-		mInstance = NULL;
+
+		// IMPORTANT: under some (unknown) circumstances the apr_dso_unload() triggered when mInstance is deleted 
+		// appears to fail and lock up which means that a given instance of the slplugin process never exits. 
+		// This is bad, especially when users try to update their version of SL - it fails because the slplugin 
+		// process as well as a bunch of plugin specific files are locked and cannot be overwritten.
+		exit( 0 );
+		//delete mInstance;
+		//mInstance = NULL;
 	}
 }
 
diff --git a/indra/llrender/llfontgl.cpp b/indra/llrender/llfontgl.cpp
index 37a28ac7213..1de1d6ded4a 100644
--- a/indra/llrender/llfontgl.cpp
+++ b/indra/llrender/llfontgl.cpp
@@ -472,7 +472,7 @@ F32 LLFontGL::getWidthF32(const llwchar* wchars, S32 begin_offset, S32 max_chars
 }
 
 // Returns the max number of complete characters from text (up to max_chars) that can be drawn in max_pixels
-S32 LLFontGL::maxDrawableChars(const llwchar* wchars, F32 max_pixels, S32 max_chars, BOOL end_on_word_boundary) const
+S32 LLFontGL::maxDrawableChars(const llwchar* wchars, F32 max_pixels, S32 max_chars, EWordWrapStyle end_on_word_boundary) const
 {
 	if (!wchars || !wchars[0] || max_chars == 0)
 	{
@@ -562,9 +562,24 @@ S32 LLFontGL::maxDrawableChars(const llwchar* wchars, F32 max_pixels, S32 max_ch
 		drawn_x = cur_x;
 	}
 
-	if( clip && end_on_word_boundary && (start_of_last_word != 0) )
+	if( clip )
 	{
-		i = start_of_last_word;
+		switch (end_on_word_boundary)
+		{
+		case ONLY_WORD_BOUNDARIES:
+			i = start_of_last_word;
+			break;
+		case WORD_BOUNDARY_IF_POSSIBLE:
+			if (start_of_last_word != 0)
+			{
+				i = start_of_last_word;
+			}
+			break;
+		default:
+		case ANYWHERE:
+			// do nothing
+			break;
+		}
 	}
 	return i;
 }
diff --git a/indra/llrender/llfontgl.h b/indra/llrender/llfontgl.h
index ea8eee76903..dfa4cf8ce55 100644
--- a/indra/llrender/llfontgl.h
+++ b/indra/llrender/llfontgl.h
@@ -122,7 +122,13 @@ class LLFontGL
 	// The following are called often, frequently with large buffers, so do not use a string interface
 	
 	// Returns the max number of complete characters from text (up to max_chars) that can be drawn in max_pixels
-	S32	maxDrawableChars(const llwchar* wchars, F32 max_pixels, S32 max_chars = S32_MAX, BOOL end_on_word_boundary = FALSE) const;
+	typedef enum e_word_wrap_style
+	{
+		ONLY_WORD_BOUNDARIES,
+		WORD_BOUNDARY_IF_POSSIBLE,
+		ANYWHERE
+	} EWordWrapStyle ;
+	S32	maxDrawableChars(const llwchar* wchars, F32 max_pixels, S32 max_chars = S32_MAX, EWordWrapStyle end_on_word_boundary = ANYWHERE) const;
 
 	// Returns the index of the first complete characters from text that can be drawn in max_pixels
 	// given that the character at start_pos should be the last character (or as close to last as possible).
diff --git a/indra/llrender/llgl.cpp b/indra/llrender/llgl.cpp
index 3400a723857..187a9a984e0 100644
--- a/indra/llrender/llgl.cpp
+++ b/indra/llrender/llgl.cpp
@@ -1919,6 +1919,16 @@ LLGLDepthTest::LLGLDepthTest(GLboolean depth_enabled, GLboolean write_enabled, G
 : mPrevDepthEnabled(sDepthEnabled), mPrevDepthFunc(sDepthFunc), mPrevWriteEnabled(sWriteEnabled)
 {
 	stop_glerror();
+	
+	checkState();
+
+	if (!depth_enabled)
+	{ // always disable depth writes if depth testing is disabled
+	  // GL spec defines this as a requirement, but some implementations allow depth writes with testing disabled
+	  // The proper way to write to depth buffer with testing disabled is to enable testing and use a depth_func of GL_ALWAYS
+		write_enabled = FALSE;
+	}
+
 	if (depth_enabled != sDepthEnabled)
 	{
 		gGL.flush();
@@ -1942,6 +1952,7 @@ LLGLDepthTest::LLGLDepthTest(GLboolean depth_enabled, GLboolean write_enabled, G
 
 LLGLDepthTest::~LLGLDepthTest()
 {
+	checkState();
 	if (sDepthEnabled != mPrevDepthEnabled )
 	{
 		gGL.flush();
@@ -1963,6 +1974,32 @@ LLGLDepthTest::~LLGLDepthTest()
 	}
 }
 
+void LLGLDepthTest::checkState()
+{
+	if (gDebugGL)
+	{
+		GLint func = 0;
+		GLboolean mask = FALSE;
+
+		glGetIntegerv(GL_DEPTH_FUNC, &func);
+		glGetBooleanv(GL_DEPTH_WRITEMASK, &mask);
+
+		if (glIsEnabled(GL_DEPTH_TEST) != sDepthEnabled ||
+			sWriteEnabled != mask ||
+			sDepthFunc != func)
+		{
+			if (gDebugSession)
+			{
+				gFailLog << "Unexpected depth testing state." << std::endl;
+			}
+			else
+			{
+				LL_GL_ERRS << "Unexpected depth testing state." << LL_ENDL;
+			}
+		}
+	}
+}
+
 LLGLClampToFarClip::LLGLClampToFarClip(glh::matrix4f P)
 {
 	for (U32 i = 0; i < 4; i++)
diff --git a/indra/llrender/llglstates.h b/indra/llrender/llglstates.h
index 4a51cac438e..968a37cab06 100644
--- a/indra/llrender/llglstates.h
+++ b/indra/llrender/llglstates.h
@@ -46,6 +46,8 @@ class LLGLDepthTest
 	
 	~LLGLDepthTest();
 	
+	void checkState();
+
 	GLboolean mPrevDepthEnabled;
 	GLenum mPrevDepthFunc;
 	GLboolean mPrevWriteEnabled;
diff --git a/indra/llrender/llimagegl.cpp b/indra/llrender/llimagegl.cpp
index f8d7ea00e0c..cd493481d5b 100644
--- a/indra/llrender/llimagegl.cpp
+++ b/indra/llrender/llimagegl.cpp
@@ -428,49 +428,56 @@ LLImageGL::~LLImageGL()
 
 void LLImageGL::init(BOOL usemipmaps)
 {
-#ifdef DEBUG_MISS
-	mMissed				= FALSE;
-#endif
+	// keep these members in the same order as declared in llimagehl.h
+	// so that it is obvious by visual inspection if we forgot to
+	// init a field.
+
+	mTextureMemory = 0;
+	mLastBindTime = 0.f;
+
+	mPickMask = NULL;
+	mUseMipMaps = usemipmaps;
+	mHasExplicitFormat = FALSE;
+	mAutoGenMips = FALSE;
+
+	mIsMask = FALSE;
+	mNeedsAlphaAndPickMask = TRUE ;
+	mAlphaStride = 0 ;
+	mAlphaOffset = 0 ;
 
-	mPickMask		  = NULL;
-	mTextureMemory    = 0;
-	mLastBindTime     = 0.f;
+	mGLTextureCreated = FALSE ;
+	mTexName = 0;
+	mWidth = 0;
+	mHeight	= 0;
+	mCurrentDiscardLevel = -1;	
+
+	mDiscardLevelInAtlas = -1 ;
+	mTexelsInAtlas = 0 ;
+	mTexelsInGLTexture = 0 ;
 	
-	mTarget			  = GL_TEXTURE_2D;
-	mBindTarget		  = LLTexUnit::TT_TEXTURE;
-	mUseMipMaps		  = usemipmaps;
-	mHasMipMaps		  = false;
-	mAutoGenMips	  = FALSE;
-	mTexName          = 0;
-	mIsResident       = 0;
+	mTarget = GL_TEXTURE_2D;
+	mBindTarget = LLTexUnit::TT_TEXTURE;
+	mHasMipMaps = false;
+
+	mIsResident = 0;
+
+	mComponents = 0;
+	mMaxDiscardLevel = MAX_DISCARD_LEVEL;
 
 	mTexOptionsDirty = true;
 	mAddressMode = LLTexUnit::TAM_WRAP;
 	mFilterOption = LLTexUnit::TFO_ANISOTROPIC;
-	mWidth				= 0;
-	mHeight				= 0;
-	mComponents			= 0;
-	
-	mMaxDiscardLevel = MAX_DISCARD_LEVEL;
-	mCurrentDiscardLevel = -1;	
 	
 	mFormatInternal = -1;
 	mFormatPrimary = (LLGLenum) 0;
 	mFormatType = GL_UNSIGNED_BYTE;
 	mFormatSwapBytes = FALSE;
-	mHasExplicitFormat = FALSE;
-
-	mGLTextureCreated = FALSE ;
 
-	mIsMask = FALSE;
-	mCategory = -1 ;
-	mAlphaStride = 0 ;
-	mAlphaOffset = 0 ;
-	mNeedsAlphaAndPickMask = TRUE ;
+#ifdef DEBUG_MISS
+	mMissed	= FALSE;
+#endif
 
-	mDiscardLevelInAtlas = -1 ;
-	mTexelsInAtlas = 0 ;
-	mTexelsInGLTexture = 0 ;
+	mCategory = -1;
 }
 
 void LLImageGL::cleanup()
@@ -1669,7 +1676,7 @@ void LLImageGL::updatePickMask(S32 width, S32 height, const U8* data_in)
 	}
 
 	if (mFormatType != GL_UNSIGNED_BYTE ||
-		mFormatPrimary != GL_RGBA)
+	    mFormatPrimary != GL_RGBA)
 	{
 		//cannot generate a pick mask for this texture
 		delete [] mPickMask;
@@ -1729,12 +1736,25 @@ BOOL LLImageGL::getMask(const LLVector2 &tc)
 		if (u < 0.f || u > 1.f ||
 		    v < 0.f || v > 1.f)
 		{
-			llerrs << "WTF?" << llendl;
+			LL_WARNS_ONCE("render") << "Ugh, u/v out of range in image mask pick" << LL_ENDL;
+			u = v = 0.f;
+			llassert(false);
 		}
 		
 		S32 x = (S32)(u * width);
 		S32 y = (S32)(v * height);
 
+		if (x >= width)
+		{
+			LL_WARNS_ONCE("render") << "Ooh, width overrun on pick mask read, that coulda been bad." << LL_ENDL;
+			x = llmax(0, width-1);
+		}
+		if (y >= height)
+		{
+			LL_WARNS_ONCE("render") << "Ooh, height overrun on pick mask read, that woulda been bad." << LL_ENDL;
+			y = llmax(0, height-1);
+		}
+
 		S32 idx = y*width+x;
 		S32 offset = idx%8;
 
diff --git a/indra/llrender/llimagegl.h b/indra/llrender/llimagegl.h
index 937065043c1..facfb7bd62d 100644
--- a/indra/llrender/llimagegl.h
+++ b/indra/llrender/llimagegl.h
@@ -224,7 +224,7 @@ class LLImageGL : public LLRefCount
 	
 	bool	mTexOptionsDirty;
 	LLTexUnit::eTextureAddressMode		mAddressMode;	// Defaults to TAM_WRAP
-	LLTexUnit::eTextureFilterOptions	mFilterOption;	// Defaults to TFO_TRILINEAR
+	LLTexUnit::eTextureFilterOptions	mFilterOption;	// Defaults to TFO_ANISOTROPIC
 	
 	LLGLint  mFormatInternal; // = GL internalformat
 	LLGLenum mFormatPrimary;  // = GL format (pixel data format)
diff --git a/indra/llrender/llrender.cpp b/indra/llrender/llrender.cpp
index fc45df81539..f97d81126ec 100644
--- a/indra/llrender/llrender.cpp
+++ b/indra/llrender/llrender.cpp
@@ -162,6 +162,8 @@ void LLTexUnit::enable(eTextureType type)
 			disable(); // Force a disable of a previous texture type if it's enabled.
 		}
 		mCurrTexType = type;
+
+		gGL.flush();
 		glEnable(sGLTextureType[type]);
 	}
 }
diff --git a/indra/llrender/llvertexbuffer.cpp b/indra/llrender/llvertexbuffer.cpp
index db4189dfea9..572ae139099 100644
--- a/indra/llrender/llvertexbuffer.cpp
+++ b/indra/llrender/llvertexbuffer.cpp
@@ -1061,17 +1061,20 @@ void LLVertexBuffer::setBuffer(U32 data_mask)
 				}
 			}
 
-			glGetIntegerv(GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB, &buff);
-			if ((GLuint)buff != mGLIndices)
+			if (mGLIndices)
 			{
-				if (gDebugSession)
-				{
-					error = TRUE;
-					gFailLog << "Invalid GL index buffer bound: " << buff <<  std::endl;
-				}
-				else
+				glGetIntegerv(GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB, &buff);
+				if ((GLuint)buff != mGLIndices)
 				{
-					llerrs << "Invalid GL index buffer bound: " << buff << llendl;
+					if (gDebugSession)
+					{
+						error = TRUE;
+						gFailLog << "Invalid GL index buffer bound: " << buff <<  std::endl;
+					}
+					else
+					{
+						llerrs << "Invalid GL index buffer bound: " << buff << llendl;
+					}
 				}
 			}
 		}
@@ -1095,17 +1098,20 @@ void LLVertexBuffer::setBuffer(U32 data_mask)
 					}
 				}
 
-				glGetIntegerv(GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB, &buff);
-				if ((GLuint)buff != mGLIndices)
+				if (mGLIndices != 0)
 				{
-					if (gDebugSession)
-					{
-						error = TRUE;
-						gFailLog << "Invalid GL index buffer bound: "<< std::endl;
-					}
-					else
+					glGetIntegerv(GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB, &buff);
+					if ((GLuint)buff != mGLIndices)
 					{
-						llerrs << "Invalid GL index buffer bound: " << buff << llendl;
+						if (gDebugSession)
+						{
+							error = TRUE;
+							gFailLog << "Invalid GL index buffer bound: "<< std::endl;
+						}
+						else
+						{
+							llerrs << "Invalid GL index buffer bound: " << buff << llendl;
+						}
 					}
 				}
 			}
diff --git a/indra/llui/CMakeLists.txt b/indra/llui/CMakeLists.txt
index 82ec02d2ebc..ce068618e20 100644
--- a/indra/llui/CMakeLists.txt
+++ b/indra/llui/CMakeLists.txt
@@ -26,6 +26,8 @@ include_directories(
     )
 
 set(llui_SOURCE_FILES
+    llaccordionctrl.cpp
+    llaccordionctrltab.cpp
     llbutton.cpp
     llcheckboxctrl.cpp
     llclipboard.cpp
@@ -111,6 +113,8 @@ set(llui_SOURCE_FILES
 set(llui_HEADER_FILES
     CMakeLists.txt
 
+    llaccordionctrl.h
+    llaccordionctrltab.h
     llbutton.h
     llcallbackmap.h
     llcheckboxctrl.h
diff --git a/indra/llui/llcheckboxctrl.cpp b/indra/llui/llcheckboxctrl.cpp
index cd10dfdb1c4..3d32157406f 100644
--- a/indra/llui/llcheckboxctrl.cpp
+++ b/indra/llui/llcheckboxctrl.cpp
@@ -107,8 +107,8 @@ LLCheckBoxCtrl::LLCheckBoxCtrl(const LLCheckBoxCtrl::Params& p)
 	{
 		tbparams.font(p.font);
 	}
+	tbparams.text_color( p.enabled() ? p.text_enabled_color() : p.text_disabled_color() );
 	mLabel = LLUICtrlFactory::create<LLTextBox> (tbparams);
-
 	addChild(mLabel);
 
 	// Button
diff --git a/indra/llui/llconsole.cpp b/indra/llui/llconsole.cpp
index fa0abd55d02..59499f987b7 100644
--- a/indra/llui/llconsole.cpp
+++ b/indra/llui/llconsole.cpp
@@ -180,7 +180,7 @@ void LLConsole::draw()
 	// draw remaining lines
 	F32 y_pos = 0.f;
 
-	LLUIImagePtr imagep = LLUI::getUIImage("rounded_square.tga");
+	LLUIImagePtr imagep = LLUI::getUIImage("Rounded_Square");
 
 //	F32 console_opacity = llclamp(gSavedSettings.getF32("ConsoleBackgroundOpacity"), 0.f, 1.f);
 	F32 console_opacity = llclamp(LLUI::sSettingGroups["config"]->getF32("ConsoleBackgroundOpacity"), 0.f, 1.f);
@@ -330,7 +330,7 @@ void LLConsole::Paragraph::updateLines(F32 screen_width, const LLFontGL* font, b
 			skip_chars = 0;
 		}
 
-		U32 drawable = font->maxDrawableChars(mParagraphText.c_str()+paragraph_offset, screen_width, line_end - paragraph_offset, TRUE);
+		U32 drawable = font->maxDrawableChars(mParagraphText.c_str()+paragraph_offset, screen_width, line_end - paragraph_offset, LLFontGL::WORD_BOUNDARY_IF_POSSIBLE);
 
 		if (drawable != 0)
 		{
@@ -392,4 +392,10 @@ void LLConsole::addLine(const LLWString& wline, F32 size, const LLColor4 &color)
 	Paragraph paragraph(wline, color, mTimer.getElapsedTimeF32(), mFont,  (F32)getRect().getWidth() );
 	
 	mParagraphs.push_back ( paragraph );
+
+	// remove old paragraphs which can't possibly be visible any more.  ::draw() will do something similar but more conservative - we do this here because ::draw() isn't guaranteed to ever be called!  (i.e. the console isn't visible)
+        while ((S32)mParagraphs.size() > llmax((S32)0, (S32)(mMaxLines)))
+        {
+                mParagraphs.pop_front();
+        }
 }
diff --git a/indra/llui/lldockablefloater.cpp b/indra/llui/lldockablefloater.cpp
index 6a5b475134b..74438b184a8 100644
--- a/indra/llui/lldockablefloater.cpp
+++ b/indra/llui/lldockablefloater.cpp
@@ -57,11 +57,20 @@ LLDockableFloater::LLDockableFloater(LLDockControl* dockControl,
 	, mOverlapsScreenChannel(false)
 {
 	init(this);
+	mUseTongue = true;
 }
 
 LLDockableFloater::LLDockableFloater(LLDockControl* dockControl, bool uniqueDocking,
 		const LLSD& key, const Params& params) :
 	LLFloater(key, params), mDockControl(dockControl), mUniqueDocking(uniqueDocking)
+{
+	init(this);
+	mUseTongue = true;
+}
+
+LLDockableFloater::LLDockableFloater(LLDockControl* dockControl, bool uniqueDocking,
+		bool useTongue, const LLSD& key, const Params& params) :
+	LLFloater(key, params), mDockControl(dockControl), mUseTongue(useTongue), mUniqueDocking(uniqueDocking)
 {
 	init(this);
 }
diff --git a/indra/llui/lldockablefloater.h b/indra/llui/lldockablefloater.h
index ae4f99e2050..2b1ce99ae2e 100644
--- a/indra/llui/lldockablefloater.h
+++ b/indra/llui/lldockablefloater.h
@@ -62,6 +62,20 @@ class LLDockableFloater : public LLFloater
 	 */
 	LLDockableFloater(LLDockControl* dockControl, bool uniqueDocking,
 			const LLSD& key, const Params& params = getDefaultParams());
+
+	/**
+	 * Constructor.
+	 * @param dockControl a pointer to the doc control instance
+	 * @param uniqueDocking - a flag defines is docking should work as tab(at one
+	 * moment only one docked floater can be shown).
+	 * @praram useTongue - a flag defines is dock tongue should be used.
+	 * @params key a floater key.
+ 	 * @params params a floater parameters
+	 */
+	LLDockableFloater(LLDockControl* dockControl, bool uniqueDocking,
+			bool useTongue, const LLSD& key,
+			const Params& params = getDefaultParams());
+
 	virtual ~LLDockableFloater();
 
 	static LLHandle<LLFloater> getInstanceHandle() { return sInstanceHandle; }
@@ -104,6 +118,7 @@ class LLDockableFloater : public LLFloater
 	virtual void setOverlapsScreenChannel(bool overlaps) { mOverlapsScreenChannel = overlaps; }
 
 	bool getUniqueDocking() { return mUniqueDocking;	}
+	bool getUseTongue() { return mUseTongue; }
 private:
 	/**
 	 * Provides unique of dockable floater.
@@ -125,6 +140,8 @@ class LLDockableFloater : public LLFloater
 	 */
 	bool mUniqueDocking;
 
+	bool mUseTongue;
+
 	bool mOverlapsScreenChannel;
 };
 
diff --git a/indra/llui/lldockcontrol.cpp b/indra/llui/lldockcontrol.cpp
index 1c3c8449c5f..0d8e54aa486 100644
--- a/indra/llui/lldockcontrol.cpp
+++ b/indra/llui/lldockcontrol.cpp
@@ -182,12 +182,12 @@ void LLDockControl::moveDockable()
 	LLRect rootRect;
 	mGetAllowedRectCallback(rootRect);
 
-	bool unique_docking = false;
+	bool use_tongue = false;
 	LLDockableFloater* dockable_floater =
 			dynamic_cast<LLDockableFloater*> (mDockableFloater);
 	if (dockable_floater != NULL)
 	{
-		unique_docking = dockable_floater->getUniqueDocking();
+		use_tongue = dockable_floater->getUseTongue();
 	}
 
 	LLRect dockableRect = mDockableFloater->calcScreenRect();
@@ -218,7 +218,7 @@ void LLDockControl::moveDockable()
 		x = dockRect.getCenterX() - dockableRect.getWidth() / 2;
 		y = dockRect.mTop + dockableRect.getHeight();
 		// unique docking used with dock tongue, so add tongue height o the Y coordinate
-		if (unique_docking)
+		if (use_tongue)
 		{
 			y += mDockTongue->getHeight();
 		}
@@ -287,15 +287,15 @@ void LLDockControl::forceRecalculatePosition()
 
 void LLDockControl::drawToungue()
 {
-	bool unique_docking = false;
+	bool use_tongue = false;
 	LLDockableFloater* dockable_floater =
 			dynamic_cast<LLDockableFloater*> (mDockableFloater);
 	if (dockable_floater != NULL)
 	{
-		unique_docking = dockable_floater->getUniqueDocking();
+		use_tongue = dockable_floater->getUseTongue();
 	}
 
-	if (mEnabled && unique_docking)
+	if (mEnabled && use_tongue)
 	{
 		mDockTongue->draw(mDockTongueX, mDockTongueY);
 	}
diff --git a/indra/llui/llflatlistview.cpp b/indra/llui/llflatlistview.cpp
index 3754d155cff..3694ecd4f49 100644
--- a/indra/llui/llflatlistview.cpp
+++ b/indra/llui/llflatlistview.cpp
@@ -711,19 +711,12 @@ void LLFlatListView::selectLastItem		()
 
 void LLFlatListView::ensureSelectedVisible()
 {
-	LLRect visible_rc = getVisibleContentRect();
 	LLRect selected_rc = getLastSelectedItemRect();
 
-	if ( !visible_rc.contains (selected_rc) )
+	if ( selected_rc.isValid() )
 	{
-		// But scroll in Items panel coordinates
 		scrollToShowRect(selected_rc);
 	}
-
-	// In case we are in accordion tab notify parent to show selected rectangle
-	LLRect screen_rc;
-	localRectToScreen(selected_rc, &screen_rc);
-	notifyParent(LLSD().with("scrollToShowRect",screen_rc.getValue()));
 }
 
 
@@ -906,7 +899,8 @@ void LLFlatListView::notifyParentItemsRectChanged()
 	params["width"] = req_rect.getWidth();
 	params["height"] = req_rect.getHeight();
 
-	getParent()->notifyParent(params);
+	if (getParent()) // dummy widgets don't have a parent
+		getParent()->notifyParent(params);
 }
 
 void LLFlatListView::setNoItemsCommentVisible(bool visible) const
diff --git a/indra/llui/llfloater.cpp b/indra/llui/llfloater.cpp
index 845203b420e..79d8f90fec6 100644
--- a/indra/llui/llfloater.cpp
+++ b/indra/llui/llfloater.cpp
@@ -233,6 +233,7 @@ LLFloater::LLFloater(const LLSD& key, const LLFloater::Params& p)
 	mAutoFocus(TRUE), // automatically take focus when opened
 	mCanDock(false),
 	mDocked(false),
+	mTornOff(false),
 	mHasBeenDraggedWhileMinimized(FALSE),
 	mPreviousMinimizedBottom(0),
 	mPreviousMinimizedLeft(0)
@@ -878,9 +879,11 @@ void LLFloater::setSnappedTo(const LLView* snap_view)
 	else
 	{
 		//RN: assume it's a floater as it must be a sibling to our parent floater
-		LLFloater* floaterp = (LLFloater*)snap_view;
-		
-		setSnapTarget(floaterp->getHandle());
+		const LLFloater* floaterp = dynamic_cast<const LLFloater*>(snap_view);
+		if (floaterp)
+		{
+			setSnapTarget(floaterp->getHandle());
+		}
 	}
 }
 
@@ -1065,10 +1068,6 @@ void LLFloater::setMinimized(BOOL minimize)
 		reshape( mExpandedRect.getWidth(), mExpandedRect.getHeight(), TRUE );
 	}
 	
-	// don't show the help button while minimized - it's
-	// not very useful when minimized and uses up space
-	mButtonsEnabled[BUTTON_HELP] = !minimize;
-
 	applyTitle ();
 
 	make_ui_sound("UISndWindowClose");
@@ -1361,6 +1360,7 @@ void LLFloater::bringToFront( S32 x, S32 y )
 // virtual
 void LLFloater::setVisibleAndFrontmost(BOOL take_focus)
 {
+	gFocusMgr.setTopCtrl(NULL);
 	setVisible(TRUE);
 	setFrontmost(take_focus);
 }
@@ -1458,6 +1458,7 @@ void LLFloater::onClickTearOff(LLFloater* self)
 		}
 		self->setTornOff(false);
 	}
+	self->updateButtons();
 }
 
 // static
@@ -1741,14 +1742,32 @@ void LLFloater::updateButtons()
 	S32 button_count = 0;
 	for (S32 i = 0; i < BUTTON_COUNT; i++)
 	{
-		if(!mButtons[i]) continue;
-		mButtons[i]->setEnabled(mButtonsEnabled[i]);
+		if (!mButtons[i])
+		{
+			continue;
+		}
+
+		bool enabled = mButtonsEnabled[i];
+		if (i == BUTTON_HELP)
+		{
+			// don't show the help button if the floater is minimized
+			// or if it is a docked tear-off floater
+			if (isMinimized() || (mButtonsEnabled[BUTTON_TEAR_OFF] && ! mTornOff))
+			{
+				enabled = false;
+			}
+		}
+		if (i == BUTTON_CLOSE && mButtonScale != 1.f)
+		{
+			//*HACK: always render close button for hosted floaters so
+			//that users don't accidentally hit the button when
+			//closing multiple windows in the chatterbox
+			enabled = true;
+		}
 
-		if (mButtonsEnabled[i] 
-			//*HACK: always render close button for hosted floaters
-			// so that users don't accidentally hit the button when closing multiple windows
-			// in the chatterbox
-			|| (i == BUTTON_CLOSE && mButtonScale != 1.f))
+		mButtons[i]->setEnabled(enabled);
+
+		if (enabled)
 		{
 			button_count++;
 
@@ -1775,7 +1794,7 @@ void LLFloater::updateButtons()
 			// the restore button should have a tab stop so that it takes action when you Ctrl-Tab to a minimized floater
 			mButtons[i]->setTabStop(i == BUTTON_RESTORE);
 		}
-		else if (mButtons[i])
+		else
 		{
 			mButtons[i]->setVisible(FALSE);
 		}
@@ -2344,7 +2363,7 @@ void LLFloaterView::adjustToFitScreen(LLFloater* floater, BOOL allow_partial_out
 	LLRect::tCoordType screen_width = getSnapRect().getWidth();
 	LLRect::tCoordType screen_height = getSnapRect().getHeight();
 
-
+	
 	// only automatically resize non-minimized, resizable floaters
 	if( floater->isResizable() && !floater->isMinimized() )
 	{
@@ -2369,16 +2388,13 @@ void LLFloaterView::adjustToFitScreen(LLFloater* floater, BOOL allow_partial_out
 			new_width = llmax(new_width, min_width);
 			new_height = llmax(new_height, min_height);
 
+			LLRect new_rect;
+			new_rect.setLeftTopAndSize(view_rect.mLeft,view_rect.mTop,new_width, new_height);
+
 			floater->reshape( new_width, new_height, TRUE );
-			if (floater->followsRight())
-			{
-				floater->translate(old_width - new_width, 0);
-			}
+			floater->setRect(new_rect);
 
-			if (floater->followsTop())
-			{
-				floater->translate(0, old_height - new_height);
-			}
+			floater->translateIntoRect( getLocalRect(), false );
 		}
 	}
 
diff --git a/indra/llui/llfloater.h b/indra/llui/llfloater.h
index daf558de24f..f70495c0f03 100644
--- a/indra/llui/llfloater.h
+++ b/indra/llui/llfloater.h
@@ -256,7 +256,7 @@ friend class LLMultiFloater;
 	bool            isDocked() const { return mDocked; }
 	virtual void    setDocked(bool docked, bool pop_on_undock = true);
 
-	virtual void    setTornOff(bool torn_off) {}
+	virtual void    setTornOff(bool torn_off) { mTornOff = torn_off; }
 
 	// Return a closeable floater, if any, given the current focus.
 	static LLFloater* getClosableFloaterFromFocus(); 
@@ -387,6 +387,7 @@ friend class LLMultiFloater;
 
 	bool            mCanDock;
 	bool            mDocked;
+	bool            mTornOff;
 
 	static LLMultiFloater* sHostp;
 	static BOOL		sQuitting;
diff --git a/indra/llui/lllayoutstack.h b/indra/llui/lllayoutstack.h
index cde383b047a..c4f10038f86 100644
--- a/indra/llui/lllayoutstack.h
+++ b/indra/llui/lllayoutstack.h
@@ -91,6 +91,11 @@ class LLLayoutStack : public LLView, public LLInstanceTracker<LLLayoutStack>
 	bool getPanelMinSize(const std::string& panel_name, S32* min_widthp, S32* min_heightp);
 	
 	void updateLayout(BOOL force_resize = FALSE);
+	
+	S32 getPanelSpacing() const { return mPanelSpacing; }
+	BOOL getAnimate () const { return mAnimate; }
+	void setAnimate (BOOL animate) { mAnimate = animate; }
+	
 	static void updateClass();
 
 protected:
diff --git a/indra/llui/lllineeditor.cpp b/indra/llui/lllineeditor.cpp
index 8a21155cc3a..73e4d126f32 100644
--- a/indra/llui/lllineeditor.cpp
+++ b/indra/llui/lllineeditor.cpp
@@ -1583,7 +1583,6 @@ void LLLineEditor::draw()
 	F32 alpha = getDrawContext().mAlpha;
 	S32 text_len = mText.length();
 	static LLUICachedControl<S32> lineeditor_cursor_thickness ("UILineEditorCursorThickness", 0);
-	static LLUICachedControl<S32> lineeditor_v_pad ("UILineEditorVPad", 0);
 	static LLUICachedControl<F32> preedit_marker_brightness ("UIPreeditMarkerBrightness", 0);
 	static LLUICachedControl<S32> preedit_marker_gap ("UIPreeditMarkerGap", 0);
 	static LLUICachedControl<S32> preedit_marker_position ("UIPreeditMarkerPosition", 0);
@@ -1609,6 +1608,8 @@ void LLLineEditor::draw()
 	LLRect background( 0, getRect().getHeight(), getRect().getWidth(), 0 );
 	background.stretch( -mBorderThickness );
 
+	S32 lineeditor_v_pad = llround((background.getHeight() - mGLFont->getLineHeight())/2);
+
 	drawBackground();
 	
 	// draw text
diff --git a/indra/llui/llmenubutton.h b/indra/llui/llmenubutton.h
index 02eb9d38067..d0e99d9f40a 100644
--- a/indra/llui/llmenubutton.h
+++ b/indra/llui/llmenubutton.h
@@ -55,6 +55,7 @@ class LLMenuButton
 	/*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask);
 	/*virtual*/ BOOL handleKeyHere(KEY key, MASK mask );
 	void hideMenu();
+	LLMenuGL* getMenu() { return mMenu; }
 
 protected:
 	friend class LLUICtrlFactory;
diff --git a/indra/llui/llmenugl.cpp b/indra/llui/llmenugl.cpp
index 2648cbf08db..c172a2b714f 100644
--- a/indra/llui/llmenugl.cpp
+++ b/indra/llui/llmenugl.cpp
@@ -46,6 +46,7 @@
 
 #include "llmenugl.h"
 
+#include "llgl.h"
 #include "llmath.h"
 #include "llrender.h"
 #include "llfocusmgr.h"
@@ -98,7 +99,7 @@ const S32 TEAROFF_SEPARATOR_HEIGHT_PIXELS = 10;
 const S32 MENU_ITEM_PADDING = 4;
 
 const std::string BOOLEAN_TRUE_PREFIX( "\xE2\x9C\x94" ); // U+2714 HEAVY CHECK MARK
-const std::string BRANCH_SUFFIX( ">" );
+const std::string BRANCH_SUFFIX( "\xE2\x96\xB6" ); // U+25B6 BLACK RIGHT-POINTING TRIANGLE
 const std::string ARROW_UP  ("^^^^^^^");
 const std::string ARROW_DOWN("vvvvvvv");
 
@@ -477,6 +478,7 @@ void LLMenuItemGL::draw( void )
 		if (dynamic_cast<LLMenuItemCallGL*>(this))
 			debug_count++;
 		gGL.color4fv( mHighlightBackground.get().mV );
+
 		gl_rect_2d( 0, getRect().getHeight(), getRect().getWidth(), 0 );
 	}
 
@@ -1143,37 +1145,41 @@ BOOL LLMenuItemBranchGL::handleKeyHere( KEY key, MASK mask )
 	if (!branch)
 		return LLMenuItemGL::handleKeyHere(key, mask);
 
-	if (getMenu()->getVisible() && branch->getVisible() && key == KEY_LEFT)
+	// an item is highlighted, my menu is open, and I have an active sub menu or we are in
+	// keyboard navigation mode
+	if (getHighlight() 
+		&& getMenu()->isOpen() 
+		&& (isActive() || LLMenuGL::getKeyboardMode()))
 	{
-		// switch to keyboard navigation mode
-		LLMenuGL::setKeyboardMode(TRUE);
-
-		BOOL handled = branch->clearHoverItem();
-		if (branch->getTornOff())
-		{
-			((LLFloater*)branch->getParent())->setFocus(FALSE);
-		}
-		if (handled && getMenu()->getTornOff())
+		if (branch->getVisible() && key == KEY_LEFT)
 		{
-			((LLFloater*)getMenu()->getParent())->setFocus(TRUE);
-		}
-		return handled;
-	}
+			// switch to keyboard navigation mode
+			LLMenuGL::setKeyboardMode(TRUE);
 
-	if (getHighlight() && 
-		getMenu()->isOpen() && 
-		key == KEY_RIGHT && !branch->getHighlightedItem())
-	{
-		// switch to keyboard navigation mode
-		LLMenuGL::setKeyboardMode(TRUE);
+			BOOL handled = branch->clearHoverItem();
+			if (branch->getTornOff())
+			{
+				((LLFloater*)branch->getParent())->setFocus(FALSE);
+			}
+			if (handled && getMenu()->getTornOff())
+			{
+				((LLFloater*)getMenu()->getParent())->setFocus(TRUE);
+			}
+			return handled;
+		}
 
-		LLMenuItemGL* itemp = branch->highlightNextItem(NULL);
-		if (itemp)
+		if (key == KEY_RIGHT && !branch->getHighlightedItem())
 		{
-			return TRUE;
+			// switch to keyboard navigation mode
+			LLMenuGL::setKeyboardMode(TRUE);
+
+			LLMenuItemGL* itemp = branch->highlightNextItem(NULL);
+			if (itemp)
+			{
+				return TRUE;
+			}
 		}
 	}
-
 	return LLMenuItemGL::handleKeyHere(key, mask);
 }
 
@@ -1431,7 +1437,7 @@ BOOL LLMenuItemBranchDownGL::handleKeyHere(KEY key, MASK mask)
 {
 	BOOL menu_open = getBranch()->getVisible();
 	// don't do keyboard navigation of top-level menus unless in keyboard mode, or menu expanded
-	if (getHighlight() && getMenu()->getVisible() && (isActive() || LLMenuGL::getKeyboardMode()))
+	if (getHighlight() && getMenu()->isOpen() && (isActive() || LLMenuGL::getKeyboardMode()))
 	{
 		if (key == KEY_LEFT)
 		{
@@ -2836,6 +2842,7 @@ BOOL LLMenuGL::handleScrollWheel( S32 x, S32 y, S32 clicks )
 	return TRUE;
 }
 
+
 void LLMenuGL::draw( void )
 {
 	if (mNeedsArrange)
@@ -2959,7 +2966,7 @@ void LLMenuGL::showPopup(LLView* spawning_view, LLMenuGL* menu, S32 x, S32 y)
 	LLUI::getMousePositionLocal(menu->getParent(), &mouse_x, &mouse_y);
 	LLMenuHolderGL::sContextMenuSpawnPos.set(mouse_x,mouse_y);
 
-	const LLRect menu_region_rect = LLMenuGL::sMenuContainer->getMenuRect();
+	const LLRect menu_region_rect = LLMenuGL::sMenuContainer->getRect();
 
 	const S32 HPAD = 2;
 	LLRect rect = menu->getRect();
diff --git a/indra/llui/llmultislider.cpp b/indra/llui/llmultislider.cpp
index aea7c5f87c3..27a727fdf5e 100644
--- a/indra/llui/llmultislider.cpp
+++ b/indra/llui/llmultislider.cpp
@@ -490,7 +490,7 @@ void LLMultiSlider::draw()
 	F32 opacity = getEnabled() ? 1.f : 0.3f;
 
 	// Track
-	LLUIImagePtr thumb_imagep = LLUI::getUIImage("rounded_square.tga");
+	LLUIImagePtr thumb_imagep = LLUI::getUIImage("Rounded_Square");
 
 	static LLUICachedControl<S32> multi_track_height ("UIMultiTrackHeight", 0);
 	S32 height_offset = (getRect().getHeight() - multi_track_height) / 2;
diff --git a/indra/llui/llpanel.cpp b/indra/llui/llpanel.cpp
index db328824382..7f23fe2671f 100644
--- a/indra/llui/llpanel.cpp
+++ b/indra/llui/llpanel.cpp
@@ -43,6 +43,7 @@
 #include "llerror.h"
 #include "lltimer.h"
 
+#include "llaccordionctrltab.h"
 #include "llbutton.h"
 #include "llmenugl.h"
 //#include "llstatusbar.h"
@@ -851,14 +852,26 @@ static LLPanel *childGetVisibleTabWithHelp(LLView *parent)
 	// look through immediate children first for an active tab with help
 	for (child = parent->getFirstChild(); child; child = parent->findNextSibling(child))
 	{
+		LLPanel *curTabPanel = NULL;
+
+		// do we have a tab container?
 		LLTabContainer *tab = dynamic_cast<LLTabContainer *>(child);
 		if (tab && tab->getVisible())
 		{
-			LLPanel *curTabPanel = tab->getCurrentPanel();
-			if (curTabPanel && !curTabPanel->getHelpTopic().empty())
-			{
-				return curTabPanel;
-			}
+			curTabPanel = tab->getCurrentPanel();
+		}
+
+		// do we have an accordion tab?
+		LLAccordionCtrlTab* accordion = dynamic_cast<LLAccordionCtrlTab *>(child);
+		if (accordion && accordion->getDisplayChildren())
+		{
+			curTabPanel = dynamic_cast<LLPanel *>(accordion->getAccordionView());
+		}
+
+		// if we found a valid tab, does it have a help topic?
+		if (curTabPanel && !curTabPanel->getHelpTopic().empty())
+		{
+			return curTabPanel;
 		}
 	}
 
@@ -885,6 +898,44 @@ LLPanel *LLPanel::childGetVisibleTabWithHelp()
 	return ::childGetVisibleTabWithHelp(this);
 }
 
+static LLPanel *childGetVisiblePanelWithHelp(LLView *parent)
+{
+	LLView *child;
+
+	// look through immediate children first for an active panel with help
+	for (child = parent->getFirstChild(); child; child = parent->findNextSibling(child))
+	{
+		// do we have a panel with a help topic?
+		LLPanel *panel = dynamic_cast<LLPanel *>(child);
+		if (panel && panel->getVisible() && !panel->getHelpTopic().empty())
+		{
+			return panel;
+		}
+	}
+
+	// then try a bit harder and recurse through all children
+	for (child = parent->getFirstChild(); child; child = parent->findNextSibling(child))
+	{
+		if (child->getVisible())
+		{
+			LLPanel* panel = ::childGetVisiblePanelWithHelp(child);
+			if (panel)
+			{
+				return panel;
+			}
+		}
+	}
+
+	// couldn't find any active panels with a help topic string
+	return NULL;
+}
+
+LLPanel *LLPanel::childGetVisiblePanelWithHelp()
+{
+	// find a visible tab with a help topic (to determine help context)
+	return ::childGetVisiblePanelWithHelp(this);
+}
+
 void LLPanel::childSetPrevalidate(const std::string& id, BOOL (*func)(const LLWString &) )
 {
 	LLLineEditor* child = findChild<LLLineEditor>(id);
diff --git a/indra/llui/llpanel.h b/indra/llui/llpanel.h
index d0986a06d39..6de83fe3a79 100644
--- a/indra/llui/llpanel.h
+++ b/indra/llui/llpanel.h
@@ -214,7 +214,10 @@ class LLPanel : public LLUICtrl
 	// LLTabContainer
 	void childShowTab(const std::string& id, const std::string& tabname, bool visible = true);
 	LLPanel *childGetVisibleTab(const std::string& id) const;
+
+	// Find a child with a nonempty Help topic 
 	LLPanel *childGetVisibleTabWithHelp();
+	LLPanel *childGetVisiblePanelWithHelp();
 
 	// LLTextBox/LLTextEditor/LLLineEditor
 	void childSetText(const std::string& id, const LLStringExplicit& text) { childSetValue(id, LLSD(text)); }
diff --git a/indra/llui/llresizehandle.cpp b/indra/llui/llresizehandle.cpp
index 6239a8f7214..3df09d124ab 100644
--- a/indra/llui/llresizehandle.cpp
+++ b/indra/llui/llresizehandle.cpp
@@ -124,7 +124,7 @@ BOOL LLResizeHandle::handleHover(S32 x, S32 y, MASK mask)
 	{
 		// Make sure the mouse in still over the application.  We don't want to make the parent
 		// so big that we can't see the resize handle any more.
-	
+
 		S32 screen_x;
 		S32 screen_y;
 		localPointToScreen(x, y, &screen_x, &screen_y);
@@ -146,68 +146,61 @@ BOOL LLResizeHandle::handleHover(S32 x, S32 y, MASK mask)
 			LLRect scaled_rect = orig_rect;
 			S32 delta_x = screen_x - mDragLastScreenX;
 			S32 delta_y = screen_y - mDragLastScreenY;
+
+			if(delta_x == 0 && delta_y == 0)
+				return FALSE;
+
 			LLCoordGL mouse_dir;
 			// use hysteresis on mouse motion to preserve user intent when mouse stops moving
 			mouse_dir.mX = (screen_x == mLastMouseScreenX) ? mLastMouseDir.mX : screen_x - mLastMouseScreenX;
 			mouse_dir.mY = (screen_y == mLastMouseScreenY) ? mLastMouseDir.mY : screen_y - mLastMouseScreenY;
+			
 			mLastMouseScreenX = screen_x;
 			mLastMouseScreenY = screen_y;
 			mLastMouseDir = mouse_dir;
 
-			S32 x_multiple = 1;
-			S32 y_multiple = 1;
-			switch( mCorner )
-			{
-			case LEFT_TOP:
-				x_multiple = -1; 
-				y_multiple =  1;	
-				break;
-			case LEFT_BOTTOM:	
-				x_multiple = -1; 
-				y_multiple = -1;	
-				break;
-			case RIGHT_TOP:		
-				x_multiple =  1; 
-				y_multiple =  1;	
-				break;
-			case RIGHT_BOTTOM:	
-				x_multiple =  1; 
-				y_multiple = -1;	
-				break;
-			}
+			S32 new_width = orig_rect.getWidth();
+			S32 new_height = orig_rect.getHeight();
 
-			S32 new_width = orig_rect.getWidth() + x_multiple * delta_x;
-			if( new_width < mMinWidth )
-			{
-				new_width = mMinWidth;
-				delta_x = x_multiple * (mMinWidth - orig_rect.getWidth());
-			}
-
-			S32 new_height = orig_rect.getHeight() + y_multiple * delta_y;
-			if( new_height < mMinHeight )
-			{
-				new_height = mMinHeight;
-				delta_y = y_multiple * (mMinHeight - orig_rect.getHeight());
-			}
+			S32 new_pos_x = orig_rect.mLeft;
+			S32 new_pos_y = orig_rect.mTop;
 
 			switch( mCorner )
 			{
-			case LEFT_TOP:		
-				scaled_rect.translate(delta_x, 0);			
+			case LEFT_TOP:
+				new_width-=delta_x;
+				new_height+=delta_y;
+				new_pos_x+=delta_x;
+				new_pos_y+=delta_y;
 				break;
 			case LEFT_BOTTOM:	
-				scaled_rect.translate(delta_x, delta_y);	
+				new_width-=delta_x;
+				new_height-=delta_y;
+				new_pos_x+=delta_x;
 				break;
 			case RIGHT_TOP:		
+				new_width+=delta_x;
+				new_height+=delta_y;
+				new_pos_y+=delta_y;
 				break;
 			case RIGHT_BOTTOM:	
-				scaled_rect.translate(0, delta_y);			
+				new_width+=delta_x;
+				new_height-=delta_y;
 				break;
 			}
 
+			new_width = llmax(new_width,mMinWidth);
+			new_height = llmax(new_height,mMinHeight);
+			
+			LLRect::tCoordType screen_width = resizing_view->getParent()->getSnapRect().getWidth();
+			LLRect::tCoordType screen_height = resizing_view->getParent()->getSnapRect().getHeight();
+			
+			new_width = llmin(new_width, screen_width);
+			new_height = llmin(new_height, screen_height);
+			
 			// temporarily set new parent rect
-			scaled_rect.mRight = scaled_rect.mLeft + new_width;
-			scaled_rect.mTop = scaled_rect.mBottom + new_height;
+			scaled_rect.setLeftTopAndSize(new_pos_x,new_pos_y,new_width,new_height);
+				
 			resizing_view->setRect(scaled_rect);
 
 			LLView* snap_view = NULL;
@@ -258,7 +251,11 @@ BOOL LLResizeHandle::handleHover(S32 x, S32 y, MASK mask)
 			resizing_view->setRect(orig_rect);
 
 			// translate and scale to new shape
-			resizing_view->setShape(scaled_rect, true);
+			resizing_view->reshape(scaled_rect.getWidth(),scaled_rect.getHeight());
+			resizing_view->setRect(scaled_rect);
+			//set shape to handle dependent floaters...
+			resizing_view->handleReshape(scaled_rect, false);
+			
 			
 			// update last valid mouse cursor position based on resized view's actual size
 			LLRect new_rect = resizing_view->getRect();
diff --git a/indra/llui/llscrollcontainer.cpp b/indra/llui/llscrollcontainer.cpp
index a5e47e8547f..94465a67cea 100644
--- a/indra/llui/llscrollcontainer.cpp
+++ b/indra/llui/llscrollcontainer.cpp
@@ -668,6 +668,11 @@ void LLScrollContainer::scrollToShowRect(const LLRect& rect, const LLRect& const
 
 	// propagate scroll to document
 	updateScroll();
+
+	// In case we are in accordion tab notify parent to show selected rectangle
+	LLRect screen_rc;
+	localRectToScreen(rect_to_constrain, &screen_rc);
+	notifyParent(LLSD().with("scrollToShowRect",screen_rc.getValue()));
 }
 
 void LLScrollContainer::pageUp(S32 overlap)
diff --git a/indra/llui/llscrolllistcell.cpp b/indra/llui/llscrolllistcell.cpp
index 7238d903a30..3cc92baa8dc 100644
--- a/indra/llui/llscrolllistcell.cpp
+++ b/indra/llui/llscrolllistcell.cpp
@@ -188,7 +188,7 @@ LLScrollListText::LLScrollListText(const LLScrollListCell::Params& p)
 	// initialize rounded rect image
 	if (!mRoundedRectImage)
 	{
-		mRoundedRectImage = LLUI::getUIImage("rounded_square.tga");
+		mRoundedRectImage = LLUI::getUIImage("Rounded_Square");
 	}
 }
 
diff --git a/indra/llui/llscrolllistctrl.cpp b/indra/llui/llscrolllistctrl.cpp
index a53a30b5012..4e84013db0c 100644
--- a/indra/llui/llscrolllistctrl.cpp
+++ b/indra/llui/llscrolllistctrl.cpp
@@ -142,6 +142,7 @@ LLScrollListCtrl::Params::Params()
 	contents(""),
 	scroll_bar_bg_visible("scroll_bar_bg_visible"),
 	scroll_bar_bg_color("scroll_bar_bg_color")
+	, border("border")
 {
 	name = "scroll_list";
 	mouse_opaque = true;
@@ -231,10 +232,8 @@ LLScrollListCtrl::LLScrollListCtrl(const LLScrollListCtrl::Params& p)
 	if (p.has_border)
 	{
 		LLRect border_rect = getLocalRect();
-		LLViewBorder::Params params;
-		params.name("dig border");
+		LLViewBorder::Params params = p.border;
 		params.rect(border_rect);
-		params.bevel_style(LLViewBorder::BEVEL_IN);
 		mBorder = LLUICtrlFactory::create<LLViewBorder> (params);
 		addChild(mBorder);
 	}
diff --git a/indra/llui/llscrolllistctrl.h b/indra/llui/llscrolllistctrl.h
index 78bc60db6ed..907dc90bead 100644
--- a/indra/llui/llscrolllistctrl.h
+++ b/indra/llui/llscrolllistctrl.h
@@ -51,6 +51,7 @@
 #include "lldate.h"
 #include "llscrolllistitem.h"
 #include "llscrolllistcolumn.h"
+#include "llviewborder.h"
 
 class LLScrollListCell;
 class LLTextBox;
@@ -109,6 +110,8 @@ class LLScrollListCtrl : public LLUICtrl, public LLEditMenuHandler,
 							scroll_bar_bg_color;
 
 		Optional<Contents> contents;
+
+		Optional<LLViewBorder::Params> border;
 		
 		Params();
 	};
diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp
index 7447a984aca..17aecaf32fd 100644
--- a/indra/llui/lltextbase.cpp
+++ b/indra/llui/lltextbase.cpp
@@ -346,7 +346,8 @@ void LLTextBase::drawSelectionBackground()
 					S32 segment_line_start = segmentp->getStart() + segment_offset;
 					S32 segment_line_end = llmin(segmentp->getEnd(), line_iter->mDocIndexEnd);
 
-					S32 segment_width, segment_height;
+					S32 segment_width = 0;
+					S32 segment_height = 0;
 
 					// if selection after beginning of segment
 					if(selection_left >= segment_line_start)
@@ -433,7 +434,8 @@ void LLTextBase::drawCursor()
 
 			if (LL_KIM_OVERWRITE == gKeyboard->getInsertMode() && !hasSelection())
 			{
-				S32 segment_width, segment_height;
+				S32 segment_width = 0;
+				S32 segment_height = 0;
 				segmentp->getDimensions(mCursorPos - segmentp->getStart(), 1, segment_width, segment_height);
 				S32 width = llmax(CURSOR_THICKNESS, segment_width);
 				cursor_rect.mRight = cursor_rect.mLeft + width;
@@ -2443,10 +2445,12 @@ void LLNormalTextSegment::setToolTip(const std::string& tooltip)
 
 bool LLNormalTextSegment::getDimensions(S32 first_char, S32 num_chars, S32& width, S32& height) const
 {
-	height = mFontHeight;
+	height = 0;
+	width = 0;
 	bool force_newline = false;
 	if (num_chars > 0)
 	{
+		height = mFontHeight;
 		LLWString text = mEditor.getWText();
 		// if last character is a newline, then return true, forcing line break
 		llwchar last_char = text[mStart + first_char + num_chars - 1];
@@ -2461,10 +2465,6 @@ bool LLNormalTextSegment::getDimensions(S32 first_char, S32 num_chars, S32& widt
 			width = mStyle->getFont()->getWidth(text.c_str(), mStart + first_char, num_chars);
 		}
 	}
-	else
-	{
-		width = 0;
-	}
 
 	LLUIImagePtr image = mStyle->getImage();
 	if( image.notNull())
@@ -2509,10 +2509,15 @@ S32	LLNormalTextSegment::getNumChars(S32 num_pixels, S32 segment_offset, S32 lin
 	// set max characters to length of segment, or to first newline
 	max_chars = llmin(max_chars, last_char - (mStart + segment_offset));
 
+	// if no character yet displayed on this line, don't require word wrapping since
+	// we can just move to the next line, otherwise insist on it so we make forward progress
+	LLFontGL::EWordWrapStyle word_wrap_style = (line_offset == 0) 
+		? LLFontGL::WORD_BOUNDARY_IF_POSSIBLE 
+		: LLFontGL::ONLY_WORD_BOUNDARIES;
 	S32 num_chars = mStyle->getFont()->maxDrawableChars(text.c_str() + segment_offset + mStart, 
 												(F32)num_pixels,
 												max_chars, 
-												TRUE);
+												word_wrap_style);
 
 	if (num_chars == 0 
 		&& line_offset == 0 
diff --git a/indra/llui/lltexteditor.cpp b/indra/llui/lltexteditor.cpp
index e8fc9475a54..f2c3879a6c9 100644
--- a/indra/llui/lltexteditor.cpp
+++ b/indra/llui/lltexteditor.cpp
@@ -308,7 +308,8 @@ LLTextEditor::~LLTextEditor()
 	// Scrollbar is deleted by LLView
 	std::for_each(mUndoStack.begin(), mUndoStack.end(), DeletePointer());
 
-	delete mContextMenu;
+	// context menu is owned by menu holder, not us
+	//delete mContextMenu;
 }
 
 ////////////////////////////////////////////////////////////
diff --git a/indra/llui/lluictrl.cpp b/indra/llui/lluictrl.cpp
index 6044908ca79..3ade46d367f 100644
--- a/indra/llui/lluictrl.cpp
+++ b/indra/llui/lluictrl.cpp
@@ -868,6 +868,14 @@ bool LLUICtrl::findHelpTopic(std::string& help_topic_out)
 
 		if (panel)
 		{
+			// does the panel have a sub-panel with a help topic?
+			LLPanel *subpanel = panel->childGetVisiblePanelWithHelp();
+			if (subpanel)
+			{
+				help_topic_out = subpanel->getHelpTopic();
+				return true; // success (subpanel)
+			}
+
 			// does the panel have an active tab with a help topic?
 			LLPanel *tab = panel->childGetVisibleTabWithHelp();
 			if (tab)
diff --git a/indra/llui/llurlentry.cpp b/indra/llui/llurlentry.cpp
index 983f0a2d499..4927e57a52e 100644
--- a/indra/llui/llurlentry.cpp
+++ b/indra/llui/llurlentry.cpp
@@ -101,7 +101,7 @@ std::string LLUrlEntryBase::getLabelFromWikiLink(const std::string &url)
 	{
 		start++;
 	}
-	return url.substr(start, url.size()-start-1);
+	return unescapeUrl(url.substr(start, url.size()-start-1));
 }
 
 std::string LLUrlEntryBase::getUrlFromWikiLink(const std::string &string)
@@ -201,8 +201,12 @@ std::string LLUrlEntryHTTPLabel::getUrl(const std::string &string)
 //
 LLUrlEntryHTTPNoProtocol::LLUrlEntryHTTPNoProtocol()
 {
-	mPattern = boost::regex("(\\bwww\\.\\S+\\.\\S+|\\b[^ \t\n\r\f\v:/]+.com\\S*|\\b[^ \t\n\r\f\v:/]+.net\\S*|\\b[^ \t\n\r\f\v:/]+.edu\\S*|\\b[^ \t\n\r\f\v:/]+.org\\S*)",
-							boost::regex::perl|boost::regex::icase);
+	mPattern = boost::regex("("
+				"\\bwww\\.\\S+\\.\\S+" // i.e. www.FOO.BAR
+				"|" // or
+				"(?<!@)\\b[^[:space:]:@/]+\\.(?:com|net|edu|org)([/:]\\S*)?\\b" // i.e. FOO.net
+				")",
+				boost::regex::perl|boost::regex::icase);
 	mMenuName = "menu_url_http.xml";
 	mTooltip = LLTrans::getString("TooltipHttpUrl");
 }
diff --git a/indra/llui/tests/llurlentry_test.cpp b/indra/llui/tests/llurlentry_test.cpp
index 128cd134c13..80be8fcbf72 100644
--- a/indra/llui/tests/llurlentry_test.cpp
+++ b/indra/llui/tests/llurlentry_test.cpp
@@ -545,4 +545,70 @@ namespace tut
 				  "XXX [secondlife:///app/teleport/Ahern/50/50/50/ Teleport to Ahern] YYY",
 				  "[secondlife:///app/teleport/Ahern/50/50/50/ Teleport to Ahern]");
 	}
+
+	template<> template<>
+	void object::test<11>()
+	{
+		//
+		// test LLUrlEntryHTTPNoProtocol - general URLs without a protocol
+		//
+		LLUrlEntryHTTPNoProtocol url;
+		boost::regex r = url.getPattern();
+
+		testRegex("naked .com URL", r,
+				  "see google.com",
+				  "google.com");
+
+		testRegex("naked .org URL", r,
+				  "see en.wikipedia.org for details",
+				  "en.wikipedia.org");
+
+		testRegex("naked .net URL", r,
+				  "example.net",
+				  "example.net");
+
+		testRegex("naked .edu URL (2 instances)", r,
+				  "MIT web site is at web.mit.edu and also www.mit.edu",
+				  "web.mit.edu");
+
+		testRegex("don't match e-mail addresses", r,
+				  "test@lindenlab.com",
+				  "");
+
+		testRegex(".com URL with path", r,
+				  "see secondlife.com/status for grid status",
+				  "secondlife.com/status");
+
+		testRegex(".com URL with port", r,
+				  "secondlife.com:80",
+				  "secondlife.com:80");
+
+		testRegex(".com URL with port and path", r,
+				  "see secondlife.com:80/status",
+				  "secondlife.com:80/status");
+
+		testRegex("www.*.com URL with port and path", r,
+				  "see www.secondlife.com:80/status",
+				  "www.secondlife.com:80/status");
+
+		testRegex("invalid .com URL [1]", r,
+				  "..com",
+				  "");
+
+		testRegex("invalid .com URL [2]", r,
+				  "you.come",
+				  "");
+
+		testRegex("invalid .com URL [3]", r,
+				  "recommended",
+				  "");
+
+		testRegex("invalid .edu URL", r,
+				  "hi there scheduled maitenance has begun",
+				  "");
+
+		testRegex("invalid .net URL", r,
+				  "foo.netty",
+				  "");
+	}
 }
diff --git a/indra/llvfs/lldir.cpp b/indra/llvfs/lldir.cpp
index b2b17fdd565..da4abde451f 100644
--- a/indra/llvfs/lldir.cpp
+++ b/indra/llvfs/lldir.cpp
@@ -200,6 +200,11 @@ const std::string &LLDir::getOSUserAppDir() const
 
 const std::string &LLDir::getLindenUserDir() const
 {
+	if (mLindenUserDir.empty())
+	{
+		lldebugs << "getLindenUserDir() called early, we don't have the user name yet - returning empty string to caller" << llendl;
+	}
+
 	return mLindenUserDir;
 }
 
@@ -337,7 +342,7 @@ std::string LLDir::getExpandedFilename(ELLPath location, const std::string& subd
 		break;
 		
 	case LL_PATH_CACHE:
-	    prefix = getCacheDir();
+		prefix = getCacheDir();
 		break;
 		
 	case LL_PATH_USER_SETTINGS:
@@ -348,6 +353,11 @@ std::string LLDir::getExpandedFilename(ELLPath location, const std::string& subd
 
 	case LL_PATH_PER_SL_ACCOUNT:
 		prefix = getLindenUserDir();
+		if (prefix.empty())
+		{
+			// if we're asking for the per-SL-account directory but we haven't logged in yet (or otherwise don't know the account name from which to build this string), then intentionally return a blank string to the caller and skip the below warning about a blank prefix.
+			return std::string();
+		}
 		break;
 		
 	case LL_PATH_CHAT_LOGS:
@@ -557,7 +567,7 @@ std::string LLDir::getForbiddenFileChars()
 
 void LLDir::setLindenUserDir(const std::string &first, const std::string &last)
 {
-	// if both first and last aren't set, assume we're grabbing the cached dir
+	// if both first and last aren't set, that's bad.
 	if (!first.empty() && !last.empty())
 	{
 		// some platforms have case-sensitive filesystems, so be
@@ -571,6 +581,7 @@ void LLDir::setLindenUserDir(const std::string &first, const std::string &last)
 		mLindenUserDir += firstlower;
 		mLindenUserDir += "_";
 		mLindenUserDir += lastlower;
+		llinfos << "Got name for LLDir::setLindenUserDir(first='" << first << "', last='" << last << "')" << llendl;
 	}
 	else
 	{
diff --git a/indra/llvfs/lldir.h b/indra/llvfs/lldir.h
index 206e3223e3b..9067d75baca 100644
--- a/indra/llvfs/lldir.h
+++ b/indra/llvfs/lldir.h
@@ -44,7 +44,7 @@ typedef enum ELLPath
 	LL_PATH_NONE = 0,
 	LL_PATH_USER_SETTINGS = 1,
 	LL_PATH_APP_SETTINGS = 2,	
-	LL_PATH_PER_SL_ACCOUNT = 3,	
+	LL_PATH_PER_SL_ACCOUNT = 3, // returns/expands to blank string if we don't know the account name yet
 	LL_PATH_CACHE = 4,	
 	LL_PATH_CHARACTER = 5,	
 	LL_PATH_HELP = 6,		
diff --git a/indra/llvfs/lldir_linux.cpp b/indra/llvfs/lldir_linux.cpp
index ee902d1de79..a9736560eca 100644
--- a/indra/llvfs/lldir_linux.cpp
+++ b/indra/llvfs/lldir_linux.cpp
@@ -112,9 +112,10 @@ LLDir_Linux::LLDir_Linux()
 		// ...normal installation running
 		mSkinBaseDir = mAppRODataDir + mDirDelimiter + "skins";
     }	
+
 	mOSUserDir = getCurrentUserHome(tmp_str);
 	mOSUserAppDir = "";
-	mLindenUserDir = tmp_str;
+	mLindenUserDir = "";
 
 	char path [32];	/* Flawfinder: ignore */ 
 
diff --git a/indra/llvfs/lldir_solaris.cpp b/indra/llvfs/lldir_solaris.cpp
index a8fad8e5bdf..8ac5a41e934 100644
--- a/indra/llvfs/lldir_solaris.cpp
+++ b/indra/llvfs/lldir_solaris.cpp
@@ -100,7 +100,7 @@ LLDir_Solaris::LLDir_Solaris()
 	mAppRODataDir = strdup(tmp_str);
 	mOSUserDir = getCurrentUserHome(tmp_str);
 	mOSUserAppDir = "";
-	mLindenUserDir = tmp_str;
+	mLindenUserDir = "";
 
 	char path [LL_MAX_PATH];	/* Flawfinder: ignore */ 
 
diff --git a/indra/llwindow/llkeyboardwin32.cpp b/indra/llwindow/llkeyboardwin32.cpp
index 35a3e7621af..ab5ecb4e63c 100644
--- a/indra/llwindow/llkeyboardwin32.cpp
+++ b/indra/llwindow/llkeyboardwin32.cpp
@@ -80,7 +80,7 @@ LLKeyboardWin32::LLKeyboardWin32()
 	mTranslateKeyMap[VK_OEM_COMMA]  = ',';
 	mTranslateKeyMap[VK_OEM_MINUS]  = '-';
 	mTranslateKeyMap[VK_OEM_PERIOD] = '.';
-	mTranslateKeyMap[VK_OEM_2] = KEY_PAD_DIVIDE;
+	mTranslateKeyMap[VK_OEM_2] = '/';//This used to be KEY_PAD_DIVIDE, but that breaks typing into text fields in media prims
 	mTranslateKeyMap[VK_OEM_3] = '`';
 	mTranslateKeyMap[VK_OEM_4] = '[';
 	mTranslateKeyMap[VK_OEM_5] = '\\';
diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp
index 3b9c840e729..b591111b757 100644
--- a/indra/llwindow/llwindowwin32.cpp
+++ b/indra/llwindow/llwindowwin32.cpp
@@ -2184,7 +2184,7 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_
 			{
 				window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_MBUTTONUP");
 				LLFastTimer t2(FTM_MOUSEHANDLER);
-				// Because we move the cursor position in tllviewerhe app, we need to query
+				// Because we move the cursor position in the llviewer app, we need to query
 				// to find out where the cursor at the time the event is handled.
 				// If we don't do this, many clicks could get buffered up, and if the
 				// first click changes the cursor position, all subsequent clicks
@@ -2214,7 +2214,27 @@ LRESULT CALLBACK LLWindowWin32::mainWindowProc(HWND h_wnd, UINT u_msg, WPARAM w_
 				window_imp->mCallbacks->handlePingWatchdog(window_imp, "Main:WM_MOUSEWHEEL");
 				static short z_delta = 0;
 
-				z_delta += HIWORD(w_param);
+				RECT	client_rect;
+
+				// eat scroll events that occur outside our window, since we use mouse position to direct scroll
+				// instead of keyboard focus
+				// NOTE: mouse_coord is in *window* coordinates for scroll events
+				POINT mouse_coord = {(S32)(S16)LOWORD(l_param), (S32)(S16)HIWORD(l_param)};
+
+				if (ScreenToClient(window_imp->mWindowHandle, &mouse_coord)
+					&& GetClientRect(window_imp->mWindowHandle, &client_rect))
+				{
+					// we have a valid mouse point and client rect
+					if (mouse_coord.x < client_rect.left || client_rect.right < mouse_coord.x
+						|| mouse_coord.y < client_rect.top || client_rect.bottom < mouse_coord.y)
+					{
+						// mouse is outside of client rect, so don't do anything
+						return 0;
+					}
+				}
+
+				S16 incoming_z_delta = HIWORD(w_param);
+				z_delta += incoming_z_delta;
 				// cout << "z_delta " << z_delta << endl;
 
 				// current mouse wheels report changes in increments of zDelta (+120, -120)
diff --git a/indra/media_plugins/webkit/media_plugin_webkit.cpp b/indra/media_plugins/webkit/media_plugin_webkit.cpp
index 4b6da552cfe..42d680ade61 100644
--- a/indra/media_plugins/webkit/media_plugin_webkit.cpp
+++ b/indra/media_plugins/webkit/media_plugin_webkit.cpp
@@ -84,6 +84,7 @@ class MediaPluginWebKit :
 		INIT_STATE_NAVIGATING,			// Browser instance has been set up and initial navigate to about:blank has been issued
 		INIT_STATE_NAVIGATE_COMPLETE,	// initial navigate to about:blank has completed
 		INIT_STATE_WAIT_REDRAW,			// First real navigate begin has been received, waiting for page changed event to start handling redraws
+		INIT_STATE_WAIT_COMPLETE,		// Waiting for first real navigate complete event
 		INIT_STATE_RUNNING				// All initialization gymnastics are complete.
 	};
 	int mBrowserWindowId;
@@ -97,6 +98,9 @@ class MediaPluginWebKit :
 	int mLastMouseX;
 	int mLastMouseY;
 	bool mFirstFocus;
+	F32 mBackgroundR;
+	F32 mBackgroundG;
+	F32 mBackgroundB;
 	
 	void setInitState(int state)
 	{
@@ -122,7 +126,7 @@ class MediaPluginWebKit :
 			}
 		}
 		
-		if ( (mInitState == INIT_STATE_RUNNING) && mNeedsUpdate )
+		if ( (mInitState > INIT_STATE_WAIT_REDRAW) && mNeedsUpdate )
 		{
 			const unsigned char* browser_pixels = LLQtWebKit::getInstance()->grabBrowserWindow( mBrowserWindowId );
 
@@ -171,6 +175,15 @@ class MediaPluginWebKit :
 		}
 		std::string application_dir = std::string( cwd );
 
+#if LL_DARWIN
+	// When running under the Xcode debugger, there's a setting called "Break on Debugger()/DebugStr()" which defaults to being turned on.
+	// This causes the environment variable USERBREAK to be set to 1, which causes these legacy calls to break into the debugger.
+	// This wouldn't cause any problems except for the fact that the current release version of the Flash plugin has a call to Debugger() in it
+	// which gets hit when the plugin is probed by webkit.
+	// Unsetting the environment variable here works around this issue.
+	unsetenv("USERBREAK");
+#endif
+
 #if LL_WINDOWS
 		//*NOTE:Mani - On windows, at least, the component path is the
 		// location of this dll's image file. 
@@ -236,8 +249,9 @@ class MediaPluginWebKit :
 			// don't flip bitmap
 			LLQtWebKit::getInstance()->flipWindow( mBrowserWindowId, true );
 			
-			// set background color to be black - mostly for initial login page
-			LLQtWebKit::getInstance()->setBackgroundColor( mBrowserWindowId, 0x00, 0x00, 0x00 );
+			// set background color
+			// convert background color channels from [0.0, 1.0] to [0, 255];
+			LLQtWebKit::getInstance()->setBackgroundColor( mBrowserWindowId, int(mBackgroundR * 255.0f), int(mBackgroundG * 255.0f), int(mBackgroundB * 255.0f) );
 
 			// Set state _before_ starting the navigate, since onNavigateBegin might get called before this call returns.
 			setInitState(INIT_STATE_NAVIGATING);
@@ -245,7 +259,21 @@ class MediaPluginWebKit :
 			// Don't do this here -- it causes the dreaded "white flash" when loading a browser instance.
 			// FIXME: Re-added this because navigating to a "page" initializes things correctly - especially
 			// for the HTTP AUTH dialog issues (DEV-41731). Will fix at a later date.
-			LLQtWebKit::getInstance()->navigateTo( mBrowserWindowId, "about:blank" );
+			// Build a data URL like this: "data:text/html,%3Chtml%3E%3Cbody bgcolor=%22#RRGGBB%22%3E%3C/body%3E%3C/html%3E"
+			// where RRGGBB is the background color in HTML style
+			std::stringstream url;
+			
+			url << "data:text/html,%3Chtml%3E%3Cbody%20bgcolor=%22#";
+			// convert background color channels from [0.0, 1.0] to [0, 255];
+			url << std::setfill('0') << std::setw(2) << std::hex << int(mBackgroundR * 255.0f);
+			url << std::setfill('0') << std::setw(2) << std::hex << int(mBackgroundG * 255.0f);
+			url << std::setfill('0') << std::setw(2) << std::hex << int(mBackgroundB * 255.0f);
+			url << "%22%3E%3C/body%3E%3C/html%3E";
+			
+			lldebugs << "data url is: " << url.str() << llendl;
+						
+			LLQtWebKit::getInstance()->navigateTo( mBrowserWindowId, url.str() );
+//			LLQtWebKit::getInstance()->navigateTo( mBrowserWindowId, "about:blank" );
 
 			return true;
 		};
@@ -295,7 +323,7 @@ class MediaPluginWebKit :
 	{
 		if(mInitState == INIT_STATE_WAIT_REDRAW)
 		{
-			setInitState(INIT_STATE_RUNNING);
+			setInitState(INIT_STATE_WAIT_COMPLETE);
 		}
 		
 		// flag that an update is required
@@ -317,7 +345,9 @@ class MediaPluginWebKit :
 
 		if(mInitState == INIT_STATE_NAVIGATE_COMPLETE)
 		{
-			setInitState(INIT_STATE_WAIT_REDRAW);
+			// Skip the WAIT_REDRAW state now -- with the right background color set, it should no longer be necessary.
+//			setInitState(INIT_STATE_WAIT_REDRAW);
+			setInitState(INIT_STATE_WAIT_COMPLETE);
 		}
 		
 	}
@@ -328,6 +358,14 @@ class MediaPluginWebKit :
 	{
 		if(mInitState >= INIT_STATE_NAVIGATE_COMPLETE)
 		{
+			if(mInitState < INIT_STATE_RUNNING)
+			{
+				setInitState(INIT_STATE_RUNNING);
+				
+				// Clear the history, so the "back" button doesn't take you back to "about:blank".
+				LLQtWebKit::getInstance()->clearHistory(mBrowserWindowId);
+			}
+			
 			LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA_BROWSER, "navigate_complete");
 			message.setValue("uri", event.getEventUri());
 			message.setValueS32("result_code", event.getIntValue());
@@ -400,6 +438,7 @@ class MediaPluginWebKit :
 		LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA_BROWSER, "click_href");
 		message.setValue("uri", event.getStringValue());
 		message.setValue("target", event.getStringValue2());
+		message.setValueU32("target_type", event.getLinkType());
 		sendMessage(message);
 	}
 	
@@ -695,7 +734,11 @@ void MediaPluginWebKit::receiveMessage(const char *message_string)
 				S32 height = message_in.getValueS32("height");
 				S32 texture_width = message_in.getValueS32("texture_width");
 				S32 texture_height = message_in.getValueS32("texture_height");
-				
+				mBackgroundR = message_in.getValueReal("background_r");
+				mBackgroundG = message_in.getValueReal("background_g");
+				mBackgroundB = message_in.getValueReal("background_b");
+//				mBackgroundA = message_in.setValueReal("background_a");		// Ignore any alpha
+								
 				if(!name.empty())
 				{
 					// Find the shared memory region with this name
diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt
index 8918fc30189..5373556c20f 100644
--- a/indra/newview/CMakeLists.txt
+++ b/indra/newview/CMakeLists.txt
@@ -63,8 +63,6 @@ include_directories(
     )
 
 set(viewer_SOURCE_FILES
-    llaccordionctrl.cpp
-    llaccordionctrltab.cpp
     llagent.cpp
     llagentaccess.cpp
     llagentdata.cpp
@@ -158,7 +156,6 @@ set(viewer_SOURCE_FILES
     llfloaterbuycurrency.cpp
     llfloaterbuyland.cpp
     llfloatercamera.cpp
-    llfloaterchat.cpp
     llfloaterchatterbox.cpp
     llfloatercolorpicker.cpp
     llfloatercustomize.cpp
@@ -214,7 +211,6 @@ set(viewer_SOURCE_FILES
     llfloaterurldisplay.cpp
     llfloaterurlentry.cpp
     llfloatervoicedevicesettings.cpp
-    llfloatervolumepulldown.cpp
     llfloaterwater.cpp
     llfloaterwhitelistentry.cpp
     llfloaterwindlight.cpp
@@ -252,6 +248,7 @@ set(viewer_SOURCE_FILES
     llinspectgroup.cpp
     llinspectobject.cpp
     llinspectremoteobject.cpp
+    llinspecttoast.cpp
     llinventorybridge.cpp
     llinventoryclipboard.cpp
     llinventoryfilter.cpp
@@ -349,6 +346,7 @@ set(viewer_SOURCE_FILES
     llpanelshower.cpp
     llpanelteleporthistory.cpp
     llpanelvolume.cpp
+    llpanelvolumepulldown.cpp
     llparcelselection.cpp
     llparticipantlist.cpp
     llpatchvertexarray.cpp
@@ -387,6 +385,7 @@ set(viewer_SOURCE_FILES
     llspatialpartition.cpp
     llspeakbutton.cpp
     llspeakers.cpp
+    llspeakingindicatormanager.cpp
     llsplitbutton.cpp
     llsprite.cpp
     llstartup.cpp
@@ -569,8 +568,6 @@ endif (LINUX)
 set(viewer_HEADER_FILES
     CMakeLists.txt
     ViewerInstall.cmake
-    llaccordionctrl.h
-    llaccordionctrltab.h
     llagent.h
     llagentaccess.h
     llagentdata.h
@@ -667,7 +664,6 @@ set(viewer_HEADER_FILES
     llfloaterbuycurrency.h
     llfloaterbuyland.h
     llfloatercamera.h
-    llfloaterchat.h
     llfloaterchatterbox.h
     llfloatercolorpicker.h
     llfloatercustomize.h
@@ -759,6 +755,7 @@ set(viewer_HEADER_FILES
     llinspectgroup.h
     llinspectobject.h
     llinspectremoteobject.h
+    llinspecttoast.h
     llinventorybridge.h
     llinventoryclipboard.h
     llinventoryfilter.h
@@ -852,6 +849,7 @@ set(viewer_HEADER_FILES
     llpanelshower.h
     llpanelteleporthistory.h
     llpanelvolume.h
+    llpanelvolumepulldown.h
     llparcelselection.h
     llparticipantlist.h
     llpatchvertexarray.h
@@ -892,6 +890,7 @@ set(viewer_HEADER_FILES
     llspatialpartition.h
     llspeakbutton.h
     llspeakers.h
+    llspeakingindicatormanager.h
     llsplitbutton.h
     llsprite.h
     llstartup.h
@@ -1406,11 +1405,11 @@ if (WINDOWS)
       # Note the need to specify multiple names explicitly.
       set(GOOGLE_PERF_TOOLS_SOURCE
         ${SHARED_LIB_STAGING_DIR}/Release/libtcmalloc_minimal.dll
-	${SHARED_LIB_STAGING_DIR}/RelWithDebInfo/libtcmalloc_minimal.dll
-	${SHARED_LIB_STAGING_DIR}/Debug/libtcmalloc_minimal-debug.dll
-	)
+        ${SHARED_LIB_STAGING_DIR}/RelWithDebInfo/libtcmalloc_minimal.dll
+        ${SHARED_LIB_STAGING_DIR}/Debug/libtcmalloc_minimal-debug.dll
+        )
     endif(USE_GOOGLE_PERFTOOLS)
-	  
+  
 
     set(COPY_INPUT_DEPENDECIES
       # The following commented dependencies are determined at variably at build time. Can't do this here.
@@ -1499,15 +1498,16 @@ if (WINDOWS)
         --actions=copy
         --artwork=${ARTWORK_DIR}
         --build=${CMAKE_CURRENT_BINARY_DIR}
+        --buildtype=${CMAKE_BUILD_TYPE}
         --configuration=${CMAKE_CFG_INTDIR}
         --dest=${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}
         --grid=${GRID}
         --source=${CMAKE_CURRENT_SOURCE_DIR}
-	--touch=${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/copy_touched.bat
+        --touch=${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/copy_touched.bat
       DEPENDS 
-	${CMAKE_CURRENT_SOURCE_DIR}/viewer_manifest.py
-	stage_third_party_libs
-	${COPY_INPUT_DEPENDECIES}
+        ${CMAKE_CURRENT_SOURCE_DIR}/viewer_manifest.py
+        stage_third_party_libs
+        ${COPY_INPUT_DEPENDECIES}
       COMMENT "Performing viewer_manifest copy"
       )
     
@@ -1569,6 +1569,7 @@ if (WINDOWS)
           ${CMAKE_CURRENT_SOURCE_DIR}/viewer_manifest.py
           --artwork=${ARTWORK_DIR}
           --build=${CMAKE_CURRENT_BINARY_DIR}
+          --buildtype=${CMAKE_BUILD_TYPE}
           --channel=${VIEWER_CHANNEL}
           --configuration=${CMAKE_CFG_INTDIR}
           --dest=${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}
@@ -1650,6 +1651,7 @@ if (LINUX)
         --arch=${ARCH}
         --artwork=${ARTWORK_DIR}
         --build=${CMAKE_CURRENT_BINARY_DIR}
+        --buildtype=${CMAKE_BUILD_TYPE}
         --channel=${VIEWER_CHANNEL}
         --configuration=${CMAKE_CFG_INTDIR}
         --dest=${CMAKE_CURRENT_BINARY_DIR}/packaged
@@ -1695,6 +1697,7 @@ if (DARWIN)
       --actions=copy
       --artwork=${ARTWORK_DIR}
       --build=${CMAKE_CURRENT_BINARY_DIR}
+      --buildtype=${CMAKE_BUILD_TYPE}
       --configuration=${CMAKE_CFG_INTDIR}
       --dest=${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${product}.app
       --grid=${GRID}
@@ -1715,6 +1718,7 @@ if (DARWIN)
         ARGS
           ${CMAKE_CURRENT_SOURCE_DIR}/viewer_manifest.py
           --grid=${GRID}
+          --buildtype=${CMAKE_BUILD_TYPE}
           --configuration=${CMAKE_CFG_INTDIR}
           --channel=${VIEWER_CHANNEL}
           --login_channel=${VIEWER_LOGIN_CHANNEL}
@@ -1734,6 +1738,7 @@ if (DARWIN)
         ARGS
           ${CMAKE_CURRENT_SOURCE_DIR}/viewer_manifest.py
           --grid=${GRID}
+          --buildtype=${CMAKE_BUILD_TYPE}
           --configuration=${CMAKE_CFG_INTDIR}
           --channel=${VIEWER_CHANNEL}
           --login_channel=${VIEWER_LOGIN_CHANNEL}
@@ -1761,9 +1766,10 @@ if (LL_TESTS)
     llagentaccess.cpp
     lldateutil.cpp
     llmediadataclient.cpp
-    llviewerhelputil.cpp
     lllogininstance.cpp
+    llviewerhelputil.cpp
   )
+
   ##################################################
   # DISABLING PRECOMPILED HEADERS USAGE FOR TESTS 
   ##################################################
diff --git a/indra/newview/app_settings/ignorable_dialogs.xml b/indra/newview/app_settings/ignorable_dialogs.xml
index ab18febcccc..e825f13e829 100644
--- a/indra/newview/app_settings/ignorable_dialogs.xml
+++ b/indra/newview/app_settings/ignorable_dialogs.xml
@@ -177,21 +177,10 @@
       <key>Value</key>
       <integer>1</integer>
     </map>
-    <key>FirstStreamingMusic</key>
+    <key>FirstStreamingMedia</key>
     <map>
       <key>Comment</key>
-      <string>Enables FirstStreamingMusic warning dialog</string>
-      <key>Persist</key>
-      <integer>1</integer>
-      <key>Type</key>
-      <string>Boolean</string>
-      <key>Value</key>
-      <integer>1</integer>
-    </map>
-    <key>FirstStreamingVideo</key>
-    <map>
-      <key>Comment</key>
-      <string>Enables FirstStreamingVideo warning dialog</string>
+      <string>Enables FirstStreamingMedia warning dialog</string>
       <key>Persist</key>
       <integer>1</integer>
       <key>Type</key>
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index e24e1a86054..a4fc095727d 100644
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -276,7 +276,7 @@
       <key>Value</key>
       <real>0.5</real>
     </map>
-	<key>AudioSteamingMedia</key>
+	<key>AudioStreamingMedia</key>
     <map>
       <key>Comment</key>
       <string>Enable streaming</string>
@@ -285,7 +285,7 @@
       <key>Type</key>
       <string>Boolean</string>
       <key>Value</key>
-      <integer>0</integer>
+      <integer>1</integer>
     </map>
     <key>AudioStreamingMusic</key>
     <map>
@@ -296,7 +296,7 @@
       <key>Type</key>
       <string>Boolean</string>
       <key>Value</key>
-      <integer>0</integer>
+      <integer>1</integer>
     </map>
     <key>AudioStreamingVideo</key>
     <map>
@@ -307,7 +307,7 @@
       <key>Type</key>
       <string>Boolean</string>
       <key>Value</key>
-      <integer>0</integer>
+      <integer>1</integer>
     </map>
   <key>AuditTexture</key>
   <map>
@@ -408,6 +408,17 @@
       <key>Value</key>
       <integer>1</integer>
     </map>
+    <key>AvalinePhoneSeparator</key>
+    <map>
+      <key>Comment</key>
+      <string>Separator of phone parts to have Avaline numbers human readable in Voice Control Panel</string>
+      <key>Persist</key>
+      <integer>1</integer>
+      <key>Type</key>
+      <string>String</string>
+      <key>Value</key>
+      <string>-</string>
+    </map>
     <key>AvatarAxisDeadZone0</key>
     <map>
       <key>Comment</key>
@@ -1130,9 +1141,9 @@
       <key>Persist</key>
       <integer>1</integer>
       <key>Type</key>
-      <string>Boolean</string>
+      <string>S32</string>
       <key>Value</key>
-      <integer>1</integer>
+      <integer>5</integer>
     </map>
     <key>CameraAngle</key>
     <map>
@@ -3246,17 +3257,6 @@
       <key>Value</key>
       <real>0.75</real>
     </map>
-    <key>FolderIndentation</key>
-    <map>
-      <key>Comment</key>
-      <string>Number of pixels to indent subfolders in inventory</string>
-      <key>Persist</key>
-      <integer>1</integer>
-      <key>Type</key>
-      <string>S32</string>
-      <key>Value</key>
-      <integer>8</integer>
-    </map>
     <key>FolderLoadingMessageWaitTime</key>
     <map>
       <key>Comment</key>
@@ -3596,7 +3596,7 @@
       <key>Type</key>
       <string>String</string>
       <key>Value</key>
-      <string>http://viewer-help.secondlife.com/[LANGUAGE]/[CHANNEL]/[VERSION]/[TOPIC]</string>
+      <string>http://viewer-help.secondlife.com/[LANGUAGE]/[CHANNEL]/[VERSION]/[TOPIC][DEBUG_MODE]</string>
     </map>
     <key>HomeSidePanelURL</key>
     <map>
@@ -3607,7 +3607,7 @@
       <key>Type</key>
       <string>String</string>
       <key>Value</key>
-      <string>http://lecs.viewer-sidebar.secondlife.com.s3.amazonaws.com/sidebar.html</string>
+      <string>http://lecs.viewer-sidebar.secondlife.com.s3.amazonaws.com/sidebar.html?p=[AUTH_TOKEN]&amp;lang=[LANGUAGE]&amp;channel=[CHANNEL]&amp;version=[VERSION]&amp;major=[VERSION_MAJOR]&amp;minor=[VERSION_MINOR]</string>
     </map>
     <key>SearchURL</key>
     <map>
@@ -3618,7 +3618,7 @@
       <key>Type</key>
       <string>String</string>
       <key>Value</key>
-      <string>http://int.searchwww-phx0.damballah.lindenlab.com/viewer/[CATEGORY]?q=[QUERY]&amp;p=[AUTH_TOKEN]&amp;r=[MATURITY]&amp;lang=[LANGUAGE]&amp;g=[GODLIKE]&amp;sid=[SESSION_ID]&amp;rid=[REGION_ID]&amp;pid=[PARCEL_ID]</string>
+      <string>http://search.secondlife.com/viewer/[CATEGORY]?q=[QUERY]&amp;p=[AUTH_TOKEN]&amp;r=[MATURITY]&amp;lang=[LANGUAGE]&amp;g=[GODLIKE]&amp;sid=[SESSION_ID]&amp;rid=[REGION_ID]&amp;pid=[PARCEL_ID]</string>
     </map>
     <key>HighResSnapshot</key>
     <map>
@@ -3653,17 +3653,6 @@
       <key>Value</key>
       <string />
     </map>
-    <key>IMInChat</key>
-    <map>
-      <key>Comment</key>
-      <string>Copy IM into chat console</string>
-      <key>Persist</key>
-      <integer>1</integer>
-      <key>Type</key>
-      <string>Boolean</string>
-      <key>Value</key>
-      <integer>0</integer>
-    </map>
     <key>IMShowTimestamps</key>
     <map>
       <key>Comment</key>
@@ -4809,6 +4798,17 @@
       <key>Value</key>
       <integer>0</integer>
     </map>
+	<key>MyOutfitsAutofill</key>
+	<map>
+		<key>Comment</key>
+		<string>Always autofill My Outfits from library when empty (else happens just once).</string>
+		<key>Persist</key>
+		<integer>1</integer>
+		<key>Type</key>
+		<string>Boolean</string>
+		<key>Value</key>
+		<integer>0</integer>
+	</map>
     <key>NearMeRange</key>
     <map>
       <key>Comment</key>
@@ -5040,6 +5040,18 @@
       <key>Value</key>
       <integer>5</integer>
     </map>
+    <key>ToastButtonWidth</key>
+    <map>
+      <key>Comment</key>
+      <string>Default width of buttons in the toast. 
+      Note if required width will be less then this one, a button will be reshaped to default size , otherwise to required</string>
+      <key>Persist</key>
+      <integer>1</integer>
+      <key>Type</key>
+      <string>S32</string>
+      <key>Value</key>
+      <integer>90</integer>
+    </map>
     <key>ChannelBottomPanelMargin</key>
     <map>
       <key>Comment</key>
@@ -9320,18 +9332,7 @@
       <string>S32</string>
       <key>Value</key>
       <integer>2</integer>
-    </map>
-    <key>UILineEditorVPad</key>
-    <map>
-      <key>Comment</key>
-      <string>UI Line Editor Vertical Pad</string>
-      <key>Persist</key>
-      <integer>1</integer>
-      <key>Type</key>
-      <string>S32</string>
-      <key>Value</key>
-      <integer>5</integer>
-    </map>
+    </map> 
     <key>UIMaxComboWidth</key>
     <map>
       <key>Comment</key>
diff --git a/indra/newview/character/avatar_lad.xml b/indra/newview/character/avatar_lad.xml
index ae89eb44135..448e20b3827 100644
--- a/indra/newview/character/avatar_lad.xml
+++ b/indra/newview/character/avatar_lad.xml
@@ -5608,9 +5608,7 @@
   <layer_set
     body_region="head"
     width="512"
-    height="512"
-  clear_alpha="false"
-    alpha_tga_file="head_alpha.tga">
+    height="512">
     <layer
        name="head bump base"
        fixed_color = "128,128,128,255"
@@ -6608,6 +6606,13 @@ render_pass="bump">
       <texture
        local_texture="head_bodypaint" />
     </layer>
+    <layer
+	name="eyelash alpha"
+	visibility_mask="TRUE">
+       <texture
+	   tga_file="head_alpha.tga"
+	   file_is_mask="TRUE" />
+    </layer>
     <layer
        name="head alpha"
        visibility_mask="TRUE">
@@ -6620,6 +6625,7 @@ render_pass="bump">
          local_texture="head_tattoo" />
     </layer>
 
+
   </layer_set>
 
   <!-- =========================================================== -->
diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp
index d2a56f65dd7..da0e9238d63 100644
--- a/indra/newview/llagent.cpp
+++ b/indra/newview/llagent.cpp
@@ -43,7 +43,7 @@
 #include "llcallingcard.h"
 #include "llchannelmanager.h"
 #include "llconsole.h"
-#include "llfirstuse.h"
+//#include "llfirstuse.h"
 #include "llfloatercamera.h"
 #include "llfloatercustomize.h"
 #include "llfloaterreg.h"
@@ -514,6 +514,8 @@ void LLAgent::resetView(BOOL reset_camera, BOOL change_camera)
 		}
 
 		setFocusOnAvatar(TRUE, ANIMATE);
+
+		mCameraFOVZoomFactor = 0.f;
 	}
 
 	mHUDTargetZoom = 1.f;
@@ -2804,6 +2806,7 @@ void LLAgent::endAnimationUpdateUI()
 		gStatusBar->setVisibleForMouselook(true);
 
 		LLBottomTray::getInstance()->setVisible(TRUE);
+		LLBottomTray::getInstance()->onMouselookModeOut();
 
 		LLSideTray::getInstance()->getButtonsPanel()->setVisible(TRUE);
 		LLSideTray::getInstance()->updateSidetrayVisibility();
@@ -2812,7 +2815,7 @@ void LLAgent::endAnimationUpdateUI()
 
 		LLToolMgr::getInstance()->setCurrentToolset(gBasicToolset);
 
-		LLFloaterCamera::toPrevModeIfInAvatarViewMode();
+		LLFloaterCamera::onLeavingMouseLook();
 
 		// Only pop if we have pushed...
 		if (TRUE == mViewsPushed)
@@ -2902,6 +2905,7 @@ void LLAgent::endAnimationUpdateUI()
 		LLNavigationBar::getInstance()->setVisible(FALSE);
 		gStatusBar->setVisibleForMouselook(false);
 
+		LLBottomTray::getInstance()->onMouselookModeIn();
 		LLBottomTray::getInstance()->setVisible(FALSE);
 
 		LLSideTray::getInstance()->getButtonsPanel()->setVisible(FALSE);
@@ -2915,10 +2919,6 @@ void LLAgent::endAnimationUpdateUI()
 		// JC - Added for always chat in third person option
 		gFocusMgr.setKeyboardFocus(NULL);
 
-		//Making sure Camera Controls floater is in the right state 
-		//when entering Mouse Look using wheel scrolling
-		LLFloaterCamera::updateIfNotInAvatarViewMode();
-
 		LLToolMgr::getInstance()->setCurrentToolset(gMouselookToolset);
 
 		mViewsPushed = TRUE;
@@ -3588,7 +3588,7 @@ F32	LLAgent::calcCameraFOVZoomFactor()
 	{
 		return 0.f;
 	}
-	else if (mFocusObject.notNull() && !mFocusObject->isAvatar())
+	else if (mFocusObject.notNull() && !mFocusObject->isAvatar() && !mFocusOnAvatar)
 	{
 		// don't FOV zoom on mostly transparent objects
 		LLVector3 focus_offset = mFocusObjectOffset;
@@ -5161,6 +5161,11 @@ BOOL LLAgent::setUserGroupFlags(const LLUUID& group_id, BOOL accept_notices, BOO
 	return FALSE;
 }
 
+BOOL LLAgent::canJoinGroups() const
+{
+	return mGroups.count() < MAX_AGENT_GROUPS;
+}
+
 LLQuaternion LLAgent::getHeadRotation()
 {
 	if (mAvatarObject.isNull() || !mAvatarObject->mPelvisp || !mAvatarObject->mHeadp)
@@ -5694,10 +5699,10 @@ void LLAgent::processScriptControlChange(LLMessageSystem *msg, void **)
 			}
 		
 			// Any control taken?  If so, might be first time.
-			if (total_count > 0)
-			{
-				LLFirstUse::useOverrideKeys();
-			}
+			//if (total_count > 0)
+			//{
+				//LLFirstUse::useOverrideKeys();
+			//}
 		}
 		else
 		{
diff --git a/indra/newview/llagent.h b/indra/newview/llagent.h
index 2e95dc72be1..beede7fbe34 100644
--- a/indra/newview/llagent.h
+++ b/indra/newview/llagent.h
@@ -972,6 +972,7 @@ class LLAgent : public LLOldEvents::LLObservable
 	BOOL 			setGroupContribution(const LLUUID& group_id, S32 contribution);
 	BOOL 			setUserGroupFlags(const LLUUID& group_id, BOOL accept_notices, BOOL list_in_profile);
 	const std::string &getGroupName() const 	{ return mGroupName; }
+	BOOL			canJoinGroups() const;
 private:
 	std::string		mGroupName;
 	LLUUID			mGroupID;
diff --git a/indra/newview/llagentwearables.cpp b/indra/newview/llagentwearables.cpp
index dc1598aacda..c21cdf95085 100644
--- a/indra/newview/llagentwearables.cpp
+++ b/indra/newview/llagentwearables.cpp
@@ -95,19 +95,38 @@ class LLLibraryOutfitsFetch : public LLInventoryFetchDescendentsObserver
 	enum ELibraryOutfitFetchStep {
 		LOFS_FOLDER = 0,
 		LOFS_OUTFITS,
+		LOFS_LIBRARY,
+		LOFS_IMPORTED,
 		LOFS_CONTENTS
 	};
-	LLLibraryOutfitsFetch() : mCurrFetchStep(LOFS_FOLDER), mOutfitsPopulated(false) {}
+	LLLibraryOutfitsFetch() : mCurrFetchStep(LOFS_FOLDER), mOutfitsPopulated(false) 
+	{
+		mMyOutfitsID = LLUUID::null;
+		mClothingID = LLUUID::null;
+		mLibraryClothingID = LLUUID::null;
+		mImportedClothingID = LLUUID::null;
+		mImportedClothingName = "Imported Library Clothing";
+	}
 	~LLLibraryOutfitsFetch() {}
-	virtual void done();	
+	virtual void done();
 	void doneIdle();
+	LLUUID mMyOutfitsID;
+	void importedFolderFetch();
 protected:
 	void folderDone(void);
 	void outfitsDone(void);
+	void libraryDone(void);
+	void importedFolderDone(void);
 	void contentsDone(void);
 	enum ELibraryOutfitFetchStep mCurrFetchStep;
-	std::vector< std::pair< LLUUID, std::string > > mOutfits;
+	typedef std::vector< std::pair< LLUUID, std::string > > cloth_folder_vec_t;
+	cloth_folder_vec_t mLibraryClothingFolders;
+	cloth_folder_vec_t mImportedClothingFolders;
 	bool mOutfitsPopulated;
+	LLUUID mClothingID;
+	LLUUID mLibraryClothingID;
+	LLUUID mImportedClothingID;
+	std::string mImportedClothingName;
 };
 
 LLAgentWearables gAgentWearables;
@@ -116,6 +135,39 @@ BOOL LLAgentWearables::mInitialWearablesUpdateReceived = FALSE;
 
 using namespace LLVOAvatarDefines;
 
+// HACK: For EXT-3923: Pants item shows in inventory with skin icon and messes with "current look"
+// Some db items are corrupted, have inventory flags = 0, implying wearable type = shape, even though
+// wearable type stored in asset is some other value.
+// Calling this function whenever a wearable is added to increase visibility if this problem
+// turns up in other inventories.
+void checkWearableAgainstInventory(LLWearable *wearable)
+{
+	if (wearable->getItemID().isNull())
+		return;
+	
+	// Check for wearable type consistent with inventory item wearable type.
+	LLViewerInventoryItem *item = gInventory.getItem(wearable->getItemID());
+	if (item)
+	{
+		if (!item->isWearableType())
+		{
+			llwarns << "wearable associated with non-wearable item" << llendl;
+		}
+		if (item->getWearableType() != wearable->getType())
+		{
+			llwarns << "type mismatch: wearable " << wearable->getName()
+					<< " has type " << wearable->getType()
+					<< " but inventory item " << item->getName()
+					<< " has type "  << item->getWearableType() << llendl;
+		}
+	}
+	else
+	{
+		llwarns << "wearable inventory item not found" << wearable->getName()
+				<< " itemID " << wearable->getItemID().asString() << llendl;
+	}
+}
+
 void LLAgentWearables::dump()
 {
 	llinfos << "LLAgentWearablesDump" << llendl;
@@ -657,6 +709,7 @@ LLWearable* LLAgentWearables::getWearable(const EWearableType type, U32 index)
 
 void LLAgentWearables::setWearable(const EWearableType type, U32 index, LLWearable *wearable)
 {
+
 	LLWearable *old_wearable = getWearable(type,index);
 	if (!old_wearable)
 	{
@@ -680,6 +733,7 @@ void LLAgentWearables::setWearable(const EWearableType type, U32 index, LLWearab
 		wearable_vec[index] = wearable;
 		old_wearable->setLabelUpdated();
 		wearableUpdated(wearable);
+		checkWearableAgainstInventory(wearable);
 	}
 }
 
@@ -695,6 +749,7 @@ U32 LLAgentWearables::pushWearable(const EWearableType type, LLWearable *wearabl
 	{
 		mWearableDatas[type].push_back(wearable);
 		wearableUpdated(wearable);
+		checkWearableAgainstInventory(wearable);
 		return mWearableDatas[type].size()-1;
 	}
 	return MAX_WEARABLES_PER_TYPE;
@@ -875,7 +930,7 @@ void LLAgentWearables::processAgentInitialWearablesUpdate(LLMessageSystem* mesgs
 	
 	// If this is the very first time the user has logged into viewer2+ (from a legacy viewer, or new account)
 	// then auto-populate outfits from the library into the My Outfits folder.
-	if (LLInventoryModel::getIsFirstTimeInViewer2())
+	if (LLInventoryModel::getIsFirstTimeInViewer2() || gSavedSettings.getBOOL("MyOutfitsAutofill"))
 	{
 		gAgentWearables.populateMyOutfitsFolder();
 	}
@@ -1309,15 +1364,15 @@ void LLAgentWearables::makeNewOutfit(const std::string& new_folder_name,
 	} 
 }
 
-class LLAutoRenameFolder: public LLInventoryCallback
+class LLShowCreatedOutfit: public LLInventoryCallback
 {
 public:
-	LLAutoRenameFolder(LLUUID& folder_id):
+	LLShowCreatedOutfit(LLUUID& folder_id):
 		mFolderID(folder_id)
 	{
 	}
 
-	virtual ~LLAutoRenameFolder()
+	virtual ~LLShowCreatedOutfit()
 	{
 		LLSD key;
 		LLSideTray::getInstance()->showPanel("panel_outfits_inventory", key);
@@ -1327,13 +1382,15 @@ class LLAutoRenameFolder: public LLInventoryCallback
 		{
 			outfit_panel->getRootFolder()->clearSelection();
 			outfit_panel->getRootFolder()->setSelectionByID(mFolderID, TRUE);
-			outfit_panel->getRootFolder()->setNeedsAutoRename(TRUE);
 		}
 		LLAccordionCtrlTab* tab_outfits = outfit_panel ? outfit_panel->findChild<LLAccordionCtrlTab>("tab_outfits") : 0;
 		if (tab_outfits && !tab_outfits->getDisplayChildren())
 		{
 			tab_outfits->changeOpenClose(tab_outfits->getDisplayChildren());
 		}
+
+		LLAppearanceManager::instance().updateIsDirty();
+		LLAppearanceManager::instance().updatePanelOutfitName("");
 	}
 	
 	virtual void fire(const LLUUID&)
@@ -1358,9 +1415,10 @@ LLUUID LLAgentWearables::makeNewOutfitLinks(const std::string& new_folder_name)
 		LLFolderType::FT_OUTFIT,
 		new_folder_name);
 
-	LLPointer<LLInventoryCallback> cb = new LLAutoRenameFolder(folder_id);
+	LLPointer<LLInventoryCallback> cb = new LLShowCreatedOutfit(folder_id);
 	LLAppearanceManager::instance().shallowCopyCategory(LLAppearanceManager::instance().getCOF(),folder_id, cb);
-	
+	LLAppearanceManager::instance().createBaseOutfitLink(folder_id, cb);
+
 	return folder_id;
 }
 
@@ -1705,6 +1763,7 @@ void LLAgentWearables::setWearableFinal(LLInventoryItem* new_item, LLWearable* n
 		mWearableDatas[type].push_back(new_wearable);
 		llinfos << "Added additional wearable for type " << type
 				<< " size is now " << mWearableDatas[type].size() << llendl;
+		checkWearableAgainstInventory(new_wearable);
 	}
 	else
 	{
@@ -2088,11 +2147,15 @@ void LLAgentWearables::populateMyOutfitsFolder(void)
 	// Get the complete information on the items in the inventory and 
 	// setup an observer that will wait for that to happen.
 	LLInventoryFetchDescendentsObserver::folder_ref_t folders;
-	const LLUUID my_outfits_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_MY_OUTFITS);
+	outfits->mMyOutfitsID = gInventory.findCategoryUUIDForType(LLFolderType::FT_MY_OUTFITS);
 
-	folders.push_back(my_outfits_id);
+	folders.push_back(outfits->mMyOutfitsID);
 	gInventory.addObserver(outfits);
 	outfits->fetchDescendents(folders);
+	if (outfits->isEverythingComplete())
+	{
+		outfits->done();
+	}
 }
 
 void LLLibraryOutfitsFetch::done()
@@ -2106,13 +2169,24 @@ void LLLibraryOutfitsFetch::done()
 void LLLibraryOutfitsFetch::doneIdle()
 {
 	gInventory.addObserver(this); // Add this back in since it was taken out during ::done()
+	
 	switch (mCurrFetchStep)
 	{
 		case LOFS_FOLDER:
 			folderDone();
+			mCurrFetchStep = LOFS_OUTFITS;
 			break;
 		case LOFS_OUTFITS:
 			outfitsDone();
+			mCurrFetchStep = LOFS_LIBRARY;
+			break;
+		case LOFS_LIBRARY:
+			libraryDone();
+			mCurrFetchStep = LOFS_IMPORTED;
+			break;
+		case LOFS_IMPORTED:
+			importedFolderDone();
+			mCurrFetchStep = LOFS_CONTENTS;
 			break;
 		case LOFS_CONTENTS:
 			contentsDone();
@@ -2134,67 +2208,217 @@ void LLLibraryOutfitsFetch::doneIdle()
 
 void LLLibraryOutfitsFetch::folderDone(void)
 {
-	// Early out if we already have items in My Outfits.
 	LLInventoryModel::cat_array_t cat_array;
 	LLInventoryModel::item_array_t wearable_array;
-	gInventory.collectDescendents(mCompleteFolders.front(), cat_array, wearable_array, 
+	gInventory.collectDescendents(mMyOutfitsID, cat_array, wearable_array, 
 								  LLInventoryModel::EXCLUDE_TRASH);
+	
+	// Early out if we already have items in My Outfits.
 	if (cat_array.count() > 0 || wearable_array.count() > 0)
 	{
 		mOutfitsPopulated = true;
 		return;
 	}
 	
-	// Get the UUID of the library's clothing folder
-	const LLUUID library_clothing_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_CLOTHING, false, true);
+	mClothingID = gInventory.findCategoryUUIDForType(LLFolderType::FT_CLOTHING);
+	mLibraryClothingID = gInventory.findCategoryUUIDForType(LLFolderType::FT_CLOTHING, false, true);
 	
 	mCompleteFolders.clear();
 	
 	// Get the complete information on the items in the inventory.
 	LLInventoryFetchDescendentsObserver::folder_ref_t folders;
-	folders.push_back(library_clothing_id);
-	mCurrFetchStep = LOFS_OUTFITS;
+	folders.push_back(mClothingID);
+	folders.push_back(mLibraryClothingID);
 	fetchDescendents(folders);
+	if (isEverythingComplete())
+	{
+		done();
+	}
 }
 
 void LLLibraryOutfitsFetch::outfitsDone(void)
 {
 	LLInventoryModel::cat_array_t cat_array;
 	LLInventoryModel::item_array_t wearable_array;
-	gInventory.collectDescendents(mCompleteFolders.front(), cat_array, wearable_array, 
-								  LLInventoryModel::EXCLUDE_TRASH);
-	
 	LLInventoryFetchDescendentsObserver::folder_ref_t folders;
 	
+	// Collect the contents of the Library's Clothing folder
+	gInventory.collectDescendents(mLibraryClothingID, cat_array, wearable_array, 
+								  LLInventoryModel::EXCLUDE_TRASH);
+	
 	llassert(cat_array.count() > 0);
 	for (LLInventoryModel::cat_array_t::const_iterator iter = cat_array.begin();
 		 iter != cat_array.end();
 		 ++iter)
 	{
 		const LLViewerInventoryCategory *cat = iter->get();
+		
+		// Get the names and id's of every outfit in the library, except for ruth and other "misc" outfits.
 		if (cat->getName() != "More Outfits" && cat->getName() != "Ruth")
 		{
+			// Get the name of every outfit in the library 
 			folders.push_back(cat->getUUID());
-			mOutfits.push_back(std::make_pair(cat->getUUID(), cat->getName()));
+			mLibraryClothingFolders.push_back(std::make_pair(cat->getUUID(), cat->getName()));
 		}
 	}
+	
+	// Collect the contents of your Inventory Clothing folder
+	cat_array.clear();
+	wearable_array.clear();
+	gInventory.collectDescendents(mClothingID, cat_array, wearable_array, 
+								  LLInventoryModel::EXCLUDE_TRASH);
+
+	// Check if you already have an "Imported Library Clothing" folder
+	for (LLInventoryModel::cat_array_t::const_iterator iter = cat_array.begin();
+		 iter != cat_array.end();
+		 ++iter)
+	{
+		const LLViewerInventoryCategory *cat = iter->get();
+		if (cat->getName() == mImportedClothingName)
+		{
+			mImportedClothingID = cat->getUUID();
+		}
+	}
+	
 	mCompleteFolders.clear();
+	
+	fetchDescendents(folders);
+	if (isEverythingComplete())
+	{
+		done();
+	}
+}
 
-	mCurrFetchStep = LOFS_CONTENTS;
+class LLLibraryOutfitsCopyDone: public LLInventoryCallback
+{
+public:
+	LLLibraryOutfitsCopyDone(LLLibraryOutfitsFetch * fetcher):
+	mFireCount(0), mLibraryOutfitsFetcher(fetcher)
+	{
+	}
+	
+	virtual ~LLLibraryOutfitsCopyDone()
+	{
+		if (mLibraryOutfitsFetcher)
+		{
+			gInventory.addObserver(mLibraryOutfitsFetcher);
+			mLibraryOutfitsFetcher->done();
+		}
+	}
+	
+	/* virtual */ void fire(const LLUUID& inv_item)
+	{
+		mFireCount++;
+	}
+private:
+	U32 mFireCount;
+	LLLibraryOutfitsFetch * mLibraryOutfitsFetcher;
+};
+
+void LLLibraryOutfitsFetch::libraryDone(void)
+{
+	// Copy the clothing folders from the library into the imported clothing folder if necessary.
+	if (mImportedClothingID == LLUUID::null)
+	{
+		gInventory.removeObserver(this);
+		LLPointer<LLInventoryCallback> copy_waiter = new LLLibraryOutfitsCopyDone(this);
+		mImportedClothingID = gInventory.createNewCategory(mClothingID,
+														   LLFolderType::FT_NONE,
+														   mImportedClothingName);
+		
+		for (cloth_folder_vec_t::const_iterator iter = mLibraryClothingFolders.begin();
+			 iter != mLibraryClothingFolders.end();
+			 ++iter)
+		{
+			LLUUID folder_id = gInventory.createNewCategory(mImportedClothingID,
+															LLFolderType::FT_NONE,
+															iter->second);
+			LLAppearanceManager::getInstance()->shallowCopyCategory(iter->first, folder_id, copy_waiter);
+		}
+	}
+	else
+	{
+		// Skip straight to fetching the contents of the imported folder
+		importedFolderFetch();
+	}
+}
+
+void LLLibraryOutfitsFetch::importedFolderFetch(void)
+{
+	// Fetch the contents of the Imported Clothing Folder
+	LLInventoryFetchDescendentsObserver::folder_ref_t folders;
+	folders.push_back(mImportedClothingID);
+	
+	mCompleteFolders.clear();
+	
 	fetchDescendents(folders);
+	if (isEverythingComplete())
+	{
+		done();
+	}
 }
 
-void LLLibraryOutfitsFetch::contentsDone(void)
+void LLLibraryOutfitsFetch::importedFolderDone(void)
 {
-	for(S32 i = 0; i < (S32)mOutfits.size(); ++i)
+	LLInventoryModel::cat_array_t cat_array;
+	LLInventoryModel::item_array_t wearable_array;
+	LLInventoryFetchDescendentsObserver::folder_ref_t folders;
+	
+	// Collect the contents of the Imported Clothing folder
+	gInventory.collectDescendents(mImportedClothingID, cat_array, wearable_array, 
+								  LLInventoryModel::EXCLUDE_TRASH);
+	
+	for (LLInventoryModel::cat_array_t::const_iterator iter = cat_array.begin();
+		 iter != cat_array.end();
+		 ++iter)
+	{
+		const LLViewerInventoryCategory *cat = iter->get();
+		
+		// Get the name of every imported outfit
+		folders.push_back(cat->getUUID());
+		mImportedClothingFolders.push_back(std::make_pair(cat->getUUID(), cat->getName()));
+	}
+	
+	mCompleteFolders.clear();
+	fetchDescendents(folders);
+	if (isEverythingComplete())
+	{
+		done();
+	}
+}
+
+void LLLibraryOutfitsFetch::contentsDone(void)
+{		
+	LLInventoryModel::cat_array_t cat_array;
+	LLInventoryModel::item_array_t wearable_array;
+	
+	for (cloth_folder_vec_t::const_iterator folder_iter = mImportedClothingFolders.begin();
+		 folder_iter != mImportedClothingFolders.end();
+		 ++folder_iter)
 	{
 		// First, make a folder in the My Outfits directory.
-		const LLUUID parent_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_MY_OUTFITS);
-		LLUUID folder_id = gInventory.createNewCategory(parent_id,
-														LLFolderType::FT_OUTFIT,
-														mOutfits[i].second);
-		LLAppearanceManager::getInstance()->shallowCopyCategory(mOutfits[i].first, folder_id, NULL);
+		LLUUID new_outfit_folder_id = gInventory.createNewCategory(mMyOutfitsID, LLFolderType::FT_OUTFIT, folder_iter->second);
+		
+		cat_array.clear();
+		wearable_array.clear();
+		// Collect the contents of each imported clothing folder, so we can create new outfit links for it
+		gInventory.collectDescendents(folder_iter->first, cat_array, wearable_array, 
+									  LLInventoryModel::EXCLUDE_TRASH);
+		
+		for (LLInventoryModel::item_array_t::const_iterator wearable_iter = wearable_array.begin();
+			 wearable_iter != wearable_array.end();
+			 ++wearable_iter)
+		{
+			const LLViewerInventoryItem *item = wearable_iter->get();
+			link_inventory_item(gAgent.getID(),
+								item->getLinkedUUID(),
+								new_outfit_folder_id,
+								item->getName(),
+								LLAssetType::AT_LINK,
+								NULL);
+		}
 	}
+
 	mOutfitsPopulated = true;
 }
 
@@ -2236,6 +2460,8 @@ void LLInitialWearablesFetch::processContents()
 	}
 	else
 	{
+		// if we're constructing the COF from the wearables message, we don't have a proper outfit link
+		LLAppearanceManager::instance().setOutfitDirty(true);
 		processWearablesMessage();
 	}
 	delete this;
diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp
index 43b2f34ecd7..748d8bdfbf0 100644
--- a/indra/newview/llappearancemgr.cpp
+++ b/indra/newview/llappearancemgr.cpp
@@ -364,7 +364,7 @@ LLUUID LLAppearanceManager::getCOF()
 }
 
 
-const LLViewerInventoryItem* LLAppearanceManager::getCurrentOutfitLink()
+const LLViewerInventoryItem* LLAppearanceManager::getBaseOutfitLink()
 {
 	const LLUUID& current_outfit_cat = getCOF();
 	LLInventoryModel::cat_array_t cat_array;
@@ -392,6 +392,21 @@ const LLViewerInventoryItem* LLAppearanceManager::getCurrentOutfitLink()
 	return NULL;
 }
 
+bool LLAppearanceManager::getBaseOutfitName(std::string& name)
+{
+	const LLViewerInventoryItem* outfit_link = getBaseOutfitLink();
+	if(outfit_link)
+	{
+		const LLViewerInventoryCategory *cat = outfit_link->getLinkedCategory();
+		if (cat)
+		{
+			name = cat->getName();
+			return true;
+		}
+	}
+	return false;
+}
+
 // Update appearance from outfit folder.
 void LLAppearanceManager::changeOutfit(bool proceed, const LLUUID& category, bool append)
 {
@@ -444,6 +459,28 @@ void LLAppearanceManager::shallowCopyCategory(const LLUUID& src_id, const LLUUID
 	}
 }
 
+void LLAppearanceManager::purgeBaseOutfitLink(const LLUUID& category)
+{
+	LLInventoryModel::cat_array_t cats;
+	LLInventoryModel::item_array_t items;
+	gInventory.collectDescendents(category, cats, items,
+								  LLInventoryModel::EXCLUDE_TRASH);
+	for (S32 i = 0; i < items.count(); ++i)
+	{
+		LLViewerInventoryItem *item = items.get(i);
+		if (item->getActualType() != LLAssetType::AT_LINK_FOLDER)
+			continue;
+		if (item->getIsLinkType())
+		{
+			LLViewerInventoryCategory* catp = item->getLinkedCategory();
+			if(catp && catp->getPreferredType() == LLFolderType::FT_OUTFIT)
+			{
+				gInventory.purgeObject(item->getUUID());
+			}
+		}
+	}
+}
+
 void LLAppearanceManager::purgeCategory(const LLUUID& category, bool keep_outfit_links)
 {
 	LLInventoryModel::cat_array_t cats;
@@ -578,17 +615,9 @@ void LLAppearanceManager::updateCOF(const LLUUID& category, bool append)
 	linkAll(cof, gest_items, link_waiter);
 
 	// Add link to outfit if category is an outfit. 
-	LLViewerInventoryCategory* catp = gInventory.getCategory(category);
 	if (!append)
 	{
-		std::string new_outfit_name = "";
-		if (catp && catp->getPreferredType() == LLFolderType::FT_OUTFIT)
-		{
-			link_inventory_item(gAgent.getID(), category, cof, catp->getName(),
-								LLAssetType::AT_LINK_FOLDER, link_waiter);
-			new_outfit_name = catp->getName();
-		}
-		updatePanelOutfitName(new_outfit_name);
+		createBaseOutfitLink(category, link_waiter);
 	}
 }
 
@@ -602,6 +631,23 @@ void LLAppearanceManager::updatePanelOutfitName(const std::string& name)
 	}
 }
 
+void LLAppearanceManager::createBaseOutfitLink(const LLUUID& category, LLPointer<LLInventoryCallback> link_waiter)
+{
+	const LLUUID cof = getCOF();
+	LLViewerInventoryCategory* catp = gInventory.getCategory(category);
+	std::string new_outfit_name = "";
+
+	purgeBaseOutfitLink(cof);
+
+	if (catp && catp->getPreferredType() == LLFolderType::FT_OUTFIT)
+	{
+		link_inventory_item(gAgent.getID(), category, cof, catp->getName(),
+							LLAssetType::AT_LINK_FOLDER, link_waiter);
+		new_outfit_name = catp->getName();
+	}
+	
+	updatePanelOutfitName(new_outfit_name);
+}
 
 void LLAppearanceManager::updateAgentWearables(LLWearableHoldingPattern* holder, bool append)
 {
@@ -644,6 +690,10 @@ void LLAppearanceManager::updateAgentWearables(LLWearableHoldingPattern* holder,
 
 void LLAppearanceManager::updateAppearanceFromCOF()
 {
+	// update dirty flag to see if the state of the COF matches
+	// the saved outfit stored as a folder link
+	updateIsDirty();
+
 	dumpCat(getCOF(),"COF, start");
 
 	bool follow_folder_links = true;
@@ -693,14 +743,30 @@ void LLAppearanceManager::updateAppearanceFromCOF()
 		LLDynamicArray<LLFoundData*> found_container;
 		for(S32 i = 0; i  < wear_items.count(); ++i)
 		{
-			found = new LLFoundData(wear_items.get(i)->getLinkedUUID(), // Wear the base item, not the link
-									wear_items.get(i)->getAssetUUID(),
-									wear_items.get(i)->getName(),
-									wear_items.get(i)->getType());
-			holder->mFoundList.push_front(found);
-			found_container.put(found);
+			LLViewerInventoryItem *item = wear_items.get(i);
+			LLViewerInventoryItem *linked_item = item ? item->getLinkedItem() : NULL;
+			if (item && linked_item)
+			{
+				found = new LLFoundData(linked_item->getUUID(),
+										linked_item->getAssetUUID(),
+										linked_item->getName(),
+										linked_item->getType());
+				holder->mFoundList.push_front(found);
+				found_container.put(found);
+			}
+			else
+			{
+				if (!item)
+				{
+					llwarns << "attempt to wear a null item " << llendl;
+				}
+				else if (!linked_item)
+				{
+					llwarns << "attempt to wear a broken link " << item->getName() << llendl;
+				}
+			}
 		}
-		for(S32 i = 0; i < wear_items.count(); ++i)
+		for(S32 i = 0; i < found_container.count(); ++i)
 		{
 			holder->append = false;
 			found = found_container.get(i);
@@ -959,7 +1025,9 @@ void LLAppearanceManager::addCOFItemLink(const LLInventoryItem *item, bool do_up
 	if (linked_already)
 	{
 		if (do_update)
+		{	
 			LLAppearanceManager::updateAppearanceFromCOF();
+		}
 		return;
 	}
 	else
@@ -1013,6 +1081,75 @@ void LLAppearanceManager::removeCOFItemLinks(const LLUUID& item_id, bool do_upda
 	}
 }
 
+void LLAppearanceManager::updateIsDirty()
+{
+	LLUUID cof = getCOF();
+	LLUUID base_outfit;
+
+	// find base outfit link 
+	const LLViewerInventoryItem* base_outfit_item = getBaseOutfitLink();
+	LLViewerInventoryCategory* catp = NULL;
+	if (base_outfit_item && base_outfit_item->getIsLinkType())
+	{
+		catp = base_outfit_item->getLinkedCategory();
+	}
+	if(catp && catp->getPreferredType() == LLFolderType::FT_OUTFIT)
+	{
+		base_outfit = catp->getUUID();
+	}
+
+	if(base_outfit.isNull())
+	{
+		// no outfit link found, display "unsaved outfit"
+		mOutfitIsDirty = true;
+	}
+	else
+	{
+		LLInventoryModel::cat_array_t cof_cats;
+		LLInventoryModel::item_array_t cof_items;
+		gInventory.collectDescendents(cof, cof_cats, cof_items,
+									  LLInventoryModel::EXCLUDE_TRASH);
+
+		LLInventoryModel::cat_array_t outfit_cats;
+		LLInventoryModel::item_array_t outfit_items;
+		gInventory.collectDescendents(base_outfit, outfit_cats, outfit_items,
+									  LLInventoryModel::EXCLUDE_TRASH);
+
+		if(outfit_items.count() != cof_items.count() -1)
+		{
+			// Current outfit folder should have one more item than the outfit folder.
+			// this one item is the link back to the outfit folder itself.
+			mOutfitIsDirty = true;
+		}
+		else
+		{
+			typedef std::set<LLUUID> item_set_t;
+			item_set_t cof_set;
+			item_set_t outfit_set;
+
+			// sort COF items by UUID
+			for (S32 i = 0; i < cof_items.count(); ++i)
+			{
+				LLViewerInventoryItem *item = cof_items.get(i);
+				// don't add the base outfit link to the list of objects we're comparing
+				if(item != base_outfit_item)
+				{
+					cof_set.insert(item->getLinkedUUID());
+				}
+			}
+
+			// sort outfit folder by UUID
+			for (S32 i = 0; i < outfit_items.count(); ++i)
+			{
+				LLViewerInventoryItem *item = outfit_items.get(i);
+				outfit_set.insert(item->getLinkedUUID());
+			}
+
+			mOutfitIsDirty = (outfit_set != cof_set);
+		}
+	}
+}
+
 //#define DUMP_CAT_VERBOSE
 
 void LLAppearanceManager::dumpCat(const LLUUID& cat_id, const std::string& msg)
@@ -1049,7 +1186,8 @@ void LLAppearanceManager::dumpItemArray(const LLInventoryModel::item_array_t& it
 }
 
 LLAppearanceManager::LLAppearanceManager():
-	mAttachmentInvLinkEnabled(false)
+	mAttachmentInvLinkEnabled(false),
+	mOutfitIsDirty(false)
 {
 }
 
diff --git a/indra/newview/llappearancemgr.h b/indra/newview/llappearancemgr.h
index b625d42a50f..20745b70e4b 100644
--- a/indra/newview/llappearancemgr.h
+++ b/indra/newview/llappearancemgr.h
@@ -62,11 +62,14 @@ class LLAppearanceManager: public LLSingleton<LLAppearanceManager>
 	LLUUID getCOF();
 
 	// Finds the folder link to the currently worn outfit
-	const LLViewerInventoryItem *getCurrentOutfitLink();
+	const LLViewerInventoryItem *getBaseOutfitLink();
+	bool getBaseOutfitName(std::string &name);
 
 	// Update the displayed outfit name in UI.
 	void updatePanelOutfitName(const std::string& name);
 
+	void createBaseOutfitLink(const LLUUID& category, LLPointer<LLInventoryCallback> link_waiter);
+
 	void updateAgentWearables(LLWearableHoldingPattern* holder, bool append);
 
 	// For debugging - could be moved elsewhere.
@@ -94,6 +97,16 @@ class LLAppearanceManager: public LLSingleton<LLAppearanceManager>
 	// Add COF link to ensemble folder.
 	void addEnsembleLink(LLInventoryCategory* item, bool do_update = true);
 
+	//has the current outfit changed since it was loaded?
+	bool isOutfitDirty() { return mOutfitIsDirty; }
+
+	// set false if you just loaded the outfit, true otherwise
+	void setOutfitDirty(bool isDirty) { mOutfitIsDirty = isDirty; }
+	
+	// manually compare ouftit folder link to COF to see if outfit has changed.
+	// should only be necessary to do on initial login.
+	void updateIsDirty();
+
 protected:
 	LLAppearanceManager();
 	~LLAppearanceManager();
@@ -114,9 +127,11 @@ class LLAppearanceManager: public LLSingleton<LLAppearanceManager>
 								   bool follow_folder_links);
 
 	void purgeCategory(const LLUUID& category, bool keep_outfit_links);
+	void purgeBaseOutfitLink(const LLUUID& category);
 
 	std::set<LLUUID> mRegisteredAttachments;
 	bool mAttachmentInvLinkEnabled;
+	bool mOutfitIsDirty;
 };
 
 #define SUPPORT_ENSEMBLES 0
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index 21d908035fa..8507c62d276 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -71,7 +71,7 @@
 #include "lluicolortable.h"
 #include "llurldispatcher.h"
 #include "llurlhistory.h"
-#include "llfirstuse.h"
+//#include "llfirstuse.h"
 #include "llrender.h"
 #include "llteleporthistory.h"
 #include "lllocationhistory.h"
@@ -313,6 +313,7 @@ void init_default_trans_args()
 {
 	default_trans_args.insert("SECOND_LIFE"); // World
 	default_trans_args.insert("APP_NAME");
+	default_trans_args.insert("CAPITALIZED_APP_NAME");
 	default_trans_args.insert("SECOND_LIFE_GRID");
 	default_trans_args.insert("SUPPORT_SITE");
 }
@@ -921,7 +922,6 @@ bool LLAppViewer::mainLoop()
 {
 	LLMemType mt1(LLMemType::MTYPE_MAIN);
 	mMainloopTimeout = new LLWatchdogTimeout();
-	// *FIX:Mani - Make this a setting, once new settings exist in this branch.
 	
 	//-------------------------------------------
 	// Run main loop until time to quit
@@ -931,12 +931,13 @@ bool LLAppViewer::mainLoop()
 	gServicePump = new LLPumpIO(gAPRPoolp);
 	LLHTTPClient::setPump(*gServicePump);
 	LLCurl::setCAFile(gDirUtilp->getCAFile());
+	LLCurl::setSSLVerify(! gSavedSettings.getBOOL("NoVerifySSLCert"));
 	
 	// Note: this is where gLocalSpeakerMgr and gActiveSpeakerMgr used to be instantiated.
 
 	LLVoiceChannel::initClass();
 	LLVoiceClient::init(gServicePump);
-				
+
 	LLTimer frameTimer,idleTimer;
 	LLTimer debugTime;
 	LLViewerJoystick* joystick(LLViewerJoystick::getInstance());
@@ -1371,7 +1372,7 @@ bool LLAppViewer::cleanup()
 	if( gViewerWindow)
 		gViewerWindow->shutdownViews();
 
-	llinfos << "Cleaning up Inevntory" << llendflush;
+	llinfos << "Cleaning up Inventory" << llendflush;
 	
 	// Cleanup Inventory after the UI since it will delete any remaining observers
 	// (Deleted observers should have already removed themselves)
@@ -1473,10 +1474,17 @@ bool LLAppViewer::cleanup()
 	
 	LLUIColorTable::instance().saveUserSettings();
 
-	// PerAccountSettingsFile should be empty if no use has been logged on.
+	// PerAccountSettingsFile should be empty if no user has been logged on.
 	// *FIX:Mani This should get really saved in a "logoff" mode. 
-	gSavedPerAccountSettings.saveToFile(gSavedSettings.getString("PerAccountSettingsFile"), TRUE);
-	llinfos << "Saved settings" << llendflush;
+	if (gSavedSettings.getString("PerAccountSettingsFile").empty())
+	{
+		llinfos << "Not saving per-account settings; don't know the account name yet." << llendl;
+	}
+	else
+	{
+		gSavedPerAccountSettings.saveToFile(gSavedSettings.getString("PerAccountSettingsFile"), TRUE);
+		llinfos << "Saved settings" << llendflush;
+	}
 
 	std::string crash_settings_filename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, CRASH_SETTINGS_FILE);
 	// save all settings, even if equals defaults
@@ -1910,26 +1918,25 @@ bool LLAppViewer::initConfiguration()
 	// These are warnings that appear on the first experience of that condition.
 	// They are already set in the settings_default.xml file, but still need to be added to LLFirstUse
 	// for disable/reset ability
-	LLFirstUse::addConfigVariable("FirstBalanceIncrease");
-	LLFirstUse::addConfigVariable("FirstBalanceDecrease");
-	LLFirstUse::addConfigVariable("FirstSit");
-	LLFirstUse::addConfigVariable("FirstMap");
-	LLFirstUse::addConfigVariable("FirstGoTo");
-	LLFirstUse::addConfigVariable("FirstBuild");
+//	LLFirstUse::addConfigVariable("FirstBalanceIncrease");
+//	LLFirstUse::addConfigVariable("FirstBalanceDecrease");
+//	LLFirstUse::addConfigVariable("FirstSit");
+//	LLFirstUse::addConfigVariable("FirstMap");
+//	LLFirstUse::addConfigVariable("FirstGoTo");
+//	LLFirstUse::addConfigVariable("FirstBuild");
 //	LLFirstUse::addConfigVariable("FirstLeftClickNoHit");
-	LLFirstUse::addConfigVariable("FirstTeleport");
-	LLFirstUse::addConfigVariable("FirstOverrideKeys");
-	LLFirstUse::addConfigVariable("FirstAttach");
-	LLFirstUse::addConfigVariable("FirstAppearance");
-	LLFirstUse::addConfigVariable("FirstInventory");
-	LLFirstUse::addConfigVariable("FirstSandbox");
-	LLFirstUse::addConfigVariable("FirstFlexible");
-	LLFirstUse::addConfigVariable("FirstDebugMenus");
-	LLFirstUse::addConfigVariable("FirstStreamingMusic");
-	LLFirstUse::addConfigVariable("FirstStreamingVideo");
-	LLFirstUse::addConfigVariable("FirstSculptedPrim");
-	LLFirstUse::addConfigVariable("FirstVoice");
-	LLFirstUse::addConfigVariable("FirstMedia");
+//	LLFirstUse::addConfigVariable("FirstTeleport");
+//	LLFirstUse::addConfigVariable("FirstOverrideKeys");
+//	LLFirstUse::addConfigVariable("FirstAttach");
+//	LLFirstUse::addConfigVariable("FirstAppearance");
+//	LLFirstUse::addConfigVariable("FirstInventory");
+//	LLFirstUse::addConfigVariable("FirstSandbox");
+//	LLFirstUse::addConfigVariable("FirstFlexible");
+//	LLFirstUse::addConfigVariable("FirstDebugMenus");
+//	LLFirstUse::addConfigVariable("FirstStreamingMedia");
+//	LLFirstUse::addConfigVariable("FirstSculptedPrim");
+//	LLFirstUse::addConfigVariable("FirstVoice");
+//	LLFirstUse::addConfigVariable("FirstMedia");
 		
 	// - read command line settings.
 	LLControlGroupCLP clp;
diff --git a/indra/newview/llavataractions.cpp b/indra/newview/llavataractions.cpp
index 2a8c55e5dbf..40c9bb6afab 100644
--- a/indra/newview/llavataractions.cpp
+++ b/indra/newview/llavataractions.cpp
@@ -168,8 +168,10 @@ void LLAvatarActions::offerTeleport(const LLUUID& invitee)
 // static
 void LLAvatarActions::offerTeleport(const std::vector<LLUUID>& ids) 
 {
-	if (ids.size() > 0)
-		handle_lure(ids);
+	if (ids.size() == 0)
+		return;
+
+	handle_lure(ids);
 }
 
 // static
@@ -595,9 +597,11 @@ void LLAvatarActions::requestFriendship(const LLUUID& target_id, const std::stri
 
 	LLSD args;
 	args["TO_NAME"] = target_name;
+
 	LLSD payload;
+	payload["from_id"] = target_id;
 	payload["SESSION_NAME"] = target_name;
-	payload["SUPPRES_TOST"] = true;
+	payload["SUPPRESS_TOAST"] = true;
 	LLNotificationsUtil::add("FriendshipOffered", args, payload);
 }
 
diff --git a/indra/newview/llavatariconctrl.cpp b/indra/newview/llavatariconctrl.cpp
index 42ae122ff91..87b8d807c4e 100644
--- a/indra/newview/llavatariconctrl.cpp
+++ b/indra/newview/llavatariconctrl.cpp
@@ -64,7 +64,7 @@ void LLAvatarIconIDCache::load	()
 	llinfos << "Loading avatar icon id cache." << llendl;
 	
 	// build filename for each user
-	std::string resolved_filename = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, mFilename);
+	std::string resolved_filename = gDirUtilp->getExpandedFilename(LL_PATH_CACHE, mFilename);
 	llifstream file(resolved_filename);
 
 	if (!file.is_open())
@@ -97,7 +97,7 @@ void LLAvatarIconIDCache::load	()
 
 void LLAvatarIconIDCache::save	()
 {
-	std::string resolved_filename = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, mFilename);
+	std::string resolved_filename = gDirUtilp->getExpandedFilename(LL_PATH_CACHE, mFilename);
 
 	// open a file for writing
 	llofstream file (resolved_filename);
diff --git a/indra/newview/llavatarlist.cpp b/indra/newview/llavatarlist.cpp
index 5df73a994e4..6784e6693b0 100644
--- a/indra/newview/llavatarlist.cpp
+++ b/indra/newview/llavatarlist.cpp
@@ -82,7 +82,7 @@ void LLAvatarList::setSpeakingIndicatorsVisible(bool visible)
 	getItems(items);
 	for( std::vector<LLPanel*>::const_iterator it = items.begin(); it != items.end(); it++)
 	{
-		static_cast<LLAvatarListItem*>(*it)->setSpeakingIndicatorVisible(mShowSpeakingIndicator);
+		static_cast<LLAvatarListItem*>(*it)->showSpeakingIndicator(mShowSpeakingIndicator);
 	}
 }
 
@@ -320,21 +320,25 @@ boost::signals2::connection LLAvatarList::setRefreshCompleteCallback(const commi
 	return mRefreshCompleteSignal.connect(cb);
 }
 
+boost::signals2::connection LLAvatarList::setItemDoubleClickCallback(const mouse_signal_t::slot_type& cb)
+{
+	return mItemDoubleClickSignal.connect(cb);
+}
+
 void LLAvatarList::addNewItem(const LLUUID& id, const std::string& name, BOOL is_online, EAddPosition pos)
 {
 	LLAvatarListItem* item = new LLAvatarListItem();
-	item->showInfoBtn(true);
-	item->showSpeakingIndicator(true);
 	item->setName(name);
 	item->setAvatarId(id, mIgnoreOnlineStatus);
 	item->setOnline(mIgnoreOnlineStatus ? true : is_online);
 	item->showLastInteractionTime(mShowLastInteractionTime);
 
-	item->childSetVisible("info_btn", false);
 	item->setAvatarIconVisible(mShowIcons);
 	item->setShowInfoBtn(mShowInfoBtn);
 	item->setShowProfileBtn(mShowProfileBtn);
-	item->setSpeakingIndicatorVisible(mShowSpeakingIndicator);
+	item->showSpeakingIndicator(mShowSpeakingIndicator);
+
+	item->setDoubleClickCallback(boost::bind(&LLAvatarList::onItemDoucleClicked, this, _1, _2, _3, _4));
 
 	addItem(item, id, pos);
 }
@@ -403,6 +407,11 @@ void LLAvatarList::updateLastInteractionTimes()
 	}
 }
 
+void LLAvatarList::onItemDoucleClicked(LLUICtrl* ctrl, S32 x, S32 y, MASK mask)
+{
+	mItemDoubleClickSignal(ctrl, x, y, mask);
+}
+
 bool LLAvatarItemComparator::compare(const LLPanel* item1, const LLPanel* item2) const
 {
 	const LLAvatarListItem* avatar_item1 = dynamic_cast<const LLAvatarListItem*>(item1);
diff --git a/indra/newview/llavatarlist.h b/indra/newview/llavatarlist.h
index 0d2ce884ae7..a58a5623786 100644
--- a/indra/newview/llavatarlist.h
+++ b/indra/newview/llavatarlist.h
@@ -92,6 +92,8 @@ class LLAvatarList : public LLFlatListView
 
 	boost::signals2::connection setRefreshCompleteCallback(const commit_signal_t::slot_type& cb);
 
+	boost::signals2::connection setItemDoubleClickCallback(const mouse_signal_t::slot_type& cb);
+
 protected:
 	void refresh();
 
@@ -101,6 +103,7 @@ class LLAvatarList : public LLFlatListView
 		std::vector<LLUUID>& vadded,
 		std::vector<LLUUID>& vremoved);
 	void updateLastInteractionTimes();
+	void onItemDoucleClicked(LLUICtrl* ctrl, S32 x, S32 y, MASK mask);
 
 private:
 
@@ -120,6 +123,7 @@ class LLAvatarList : public LLFlatListView
 	LLAvatarListItem::ContextMenu* mContextMenu;
 
 	commit_signal_t mRefreshCompleteSignal;
+	mouse_signal_t mItemDoubleClickSignal;
 };
 
 /** Abstract comparator for avatar items */
diff --git a/indra/newview/llavatarlistitem.cpp b/indra/newview/llavatarlistitem.cpp
index 6945ac69323..66ab32f3e88 100644
--- a/indra/newview/llavatarlistitem.cpp
+++ b/indra/newview/llavatarlistitem.cpp
@@ -44,10 +44,10 @@
 #include "llbutton.h"
 
 bool LLAvatarListItem::sStaticInitialized = false;
-S32 LLAvatarListItem::sIconWidth = 0;
-S32 LLAvatarListItem::sInfoBtnWidth = 0;
-S32 LLAvatarListItem::sProfileBtnWidth = 0;
-S32 LLAvatarListItem::sSpeakingIndicatorWidth = 0;
+S32 LLAvatarListItem::sLeftPadding = 0;
+S32 LLAvatarListItem::sRightNamePadding = 0;
+S32 LLAvatarListItem::sChildrenWidths[LLAvatarListItem::ALIC_COUNT];
+
 
 LLAvatarListItem::LLAvatarListItem(bool not_from_ui_factory/* = true*/)
 :	LLPanel(),
@@ -91,43 +91,25 @@ BOOL  LLAvatarListItem::postBuild()
 	mProfileBtn->setVisible(false);
 	mProfileBtn->setClickedCallback(boost::bind(&LLAvatarListItem::onProfileBtnClick, this));
 
-	// Remember avatar icon width including its padding from the name text box,
-	// so that we can hide and show the icon again later.
 	if (!sStaticInitialized)
 	{
-		sIconWidth = mAvatarName->getRect().mLeft - mAvatarIcon->getRect().mLeft;
-		sInfoBtnWidth = mInfoBtn->getRect().mRight - mSpeakingIndicator->getRect().mRight;
-		sProfileBtnWidth = mProfileBtn->getRect().mRight - mInfoBtn->getRect().mRight;
-		sSpeakingIndicatorWidth = mSpeakingIndicator->getRect().mRight - mAvatarName->getRect().mRight;
+		// Remember children widths including their padding from the next sibling,
+		// so that we can hide and show them again later.
+		initChildrenWidths(this);
 
 		sStaticInitialized = true;
 	}
 
-/*
-	if(!p.buttons.profile)
-	{
-		delete mProfile;
-		mProfile = NULL;
-
-		LLRect rect;
-
-		rect.setLeftTopAndSize(mName->getRect().mLeft, mName->getRect().mTop, mName->getRect().getWidth() + 30, mName->getRect().getHeight());
-		mName->setRect(rect);
-
-		if(mLocator)
-		{
-			rect.setLeftTopAndSize(mLocator->getRect().mLeft + 30, mLocator->getRect().mTop, mLocator->getRect().getWidth(), mLocator->getRect().getHeight());
-			mLocator->setRect(rect);
-		}
+	return TRUE;
+}
 
-		if(mInfo)
-		{
-			rect.setLeftTopAndSize(mInfo->getRect().mLeft + 30, mInfo->getRect().mTop, mInfo->getRect().getWidth(), mInfo->getRect().getHeight());
-			mInfo->setRect(rect);
-		}
+S32 LLAvatarListItem::notifyParent(const LLSD& info)
+{
+	if (info.has("visibility_changed"))
+	{
+		updateChildren();
 	}
-*/
-	return TRUE;
+	return 0;
 }
 
 void LLAvatarListItem::onMouseEnter(S32 x, S32 y, MASK mask)
@@ -137,6 +119,8 @@ void LLAvatarListItem::onMouseEnter(S32 x, S32 y, MASK mask)
 	mProfileBtn->setVisible(mShowProfileBtn);
 
 	LLPanel::onMouseEnter(x, y, mask);
+
+	updateChildren();
 }
 
 void LLAvatarListItem::onMouseLeave(S32 x, S32 y, MASK mask)
@@ -146,6 +130,8 @@ void LLAvatarListItem::onMouseLeave(S32 x, S32 y, MASK mask)
 	mProfileBtn->setVisible(false);
 
 	LLPanel::onMouseLeave(x, y, mask);
+
+	updateChildren();
 }
 
 // virtual, called by LLAvatarTracker
@@ -215,12 +201,8 @@ void LLAvatarListItem::showLastInteractionTime(bool show)
 	if (show)
 		return;
 
-	LLRect	name_rect	= mAvatarName->getRect();
-	LLRect	time_rect	= mLastInteractionTime->getRect();
-
 	mLastInteractionTime->setVisible(false);
-	name_rect.mRight += (time_rect.mRight - name_rect.mRight);
-	mAvatarName->setRect(name_rect);
+	updateChildren();
 }
 
 void LLAvatarListItem::setLastInteractionTime(U32 secs_since)
@@ -234,12 +216,6 @@ void LLAvatarListItem::setShowInfoBtn(bool show)
 	if(mShowInfoBtn == show)
 		return;
 	mShowInfoBtn = show;
-	S32 width_delta = show ? - sInfoBtnWidth : sInfoBtnWidth;
-
-	//Translating speaking indicator
-	mSpeakingIndicator->translate(width_delta, 0);
-	//Reshaping avatar name
-	mAvatarName->reshape(mAvatarName->getRect().getWidth() + width_delta, mAvatarName->getRect().getHeight());
 }
 
 void LLAvatarListItem::setShowProfileBtn(bool show)
@@ -248,24 +224,17 @@ void LLAvatarListItem::setShowProfileBtn(bool show)
 	if(mShowProfileBtn == show)
 			return;
 	mShowProfileBtn = show;
-	S32 width_delta = show ? - sProfileBtnWidth : sProfileBtnWidth;
-
-	//Translating speaking indicator
-	mSpeakingIndicator->translate(width_delta, 0);
-	//Reshaping avatar name
-	mAvatarName->reshape(mAvatarName->getRect().getWidth() + width_delta, mAvatarName->getRect().getHeight());
 }
 
-void LLAvatarListItem::setSpeakingIndicatorVisible(bool visible)
+void LLAvatarListItem::showSpeakingIndicator(bool visible)
 {
 	// Already done? Then do nothing.
 	if (mSpeakingIndicator->getVisible() == (BOOL)visible)
 		return;
-	mSpeakingIndicator->setVisible(visible);
-	S32 width_delta = visible ? - sSpeakingIndicatorWidth : sSpeakingIndicatorWidth;
-
-	//Reshaping avatar name
-	mAvatarName->reshape(mAvatarName->getRect().getWidth() + width_delta, mAvatarName->getRect().getHeight());
+// Disabled to not contradict with SpeakingIndicatorManager functionality. EXT-3976
+// probably this method should be totally removed.
+//	mSpeakingIndicator->setVisible(visible);
+//	updateChildren();
 }
 
 void LLAvatarListItem::setAvatarIconVisible(bool visible)
@@ -276,36 +245,12 @@ void LLAvatarListItem::setAvatarIconVisible(bool visible)
 
 	// Show/hide avatar icon.
 	mAvatarIcon->setVisible(visible);
-
-	// Move the avatar name horizontally by icon size + its distance from the avatar name.
-	LLRect name_rect = mAvatarName->getRect();
-	name_rect.mLeft += visible ? sIconWidth : -sIconWidth;
-	mAvatarName->setRect(name_rect);
+	updateChildren();
 }
 
 void LLAvatarListItem::onInfoBtnClick()
 {
 	LLFloaterReg::showInstance("inspect_avatar", LLSD().with("avatar_id", mAvatarId));
-
-	/* TODO fix positioning of inspector
-	localPointToScreen(mXPos, mYPos, &mXPos, &mYPos);
-	
-	
-	LLRect rect;
-
-	// *TODO Vadim: rewrite this. "+= -" looks weird.
-	S32 delta = mYPos - inspector->getRect().getHeight();
-	if(delta < 0)
-	{
-		mYPos += -delta;
-	}
-	
-	rect.setLeftTopAndSize(mXPos, mYPos,
-	inspector->getRect().getWidth(), inspector->getRect().getHeight()); 
-	inspector->setRect(rect);
-	inspector->setFrontmost(true);
-	inspector->setVisible(true);
-	*/
 }
 
 void LLAvatarListItem::onProfileBtnClick()
@@ -313,6 +258,21 @@ void LLAvatarListItem::onProfileBtnClick()
 	LLAvatarActions::showProfile(mAvatarId);
 }
 
+BOOL LLAvatarListItem::handleDoubleClick(S32 x, S32 y, MASK mask)
+{
+	if(mInfoBtn->getRect().pointInRect(x, y))
+	{
+		onInfoBtnClick();
+		return TRUE;
+	}
+	if(mProfileBtn->getRect().pointInRect(x, y))
+	{
+		onProfileBtnClick();
+		return TRUE;
+	}
+	return LLPanel::handleDoubleClick(x, y, mask);
+}
+
 void LLAvatarListItem::setValue( const LLSD& value )
 {
 	if (!value.isMap()) return;;
@@ -344,21 +304,6 @@ void LLAvatarListItem::onNameCache(const std::string& first_name, const std::str
 	setName(name);
 }
 
-void LLAvatarListItem::reshapeAvatarName()
-{
-	S32 width_delta = 0;
-	width_delta += mShowProfileBtn ? sProfileBtnWidth : 0;
-	width_delta += mSpeakingIndicator->getVisible() ? sSpeakingIndicatorWidth : 0;
-	width_delta += mAvatarIcon->getVisible() ? sIconWidth : 0;
-	width_delta += mShowInfoBtn ? sInfoBtnWidth : 0;
-	width_delta += mLastInteractionTime->getVisible() ? mLastInteractionTime->getRect().getWidth() : 0;
-
-	S32 height = mAvatarName->getRect().getHeight();
-	S32 width  = getRect().getWidth() - width_delta;
-
-	mAvatarName->reshape(width, height);
-}
-
 // Convert given number of seconds to a string like "23 minutes", "15 hours" or "3 years",
 // taking i18n into account. The format string to use is taken from the panel XML.
 std::string LLAvatarListItem::formatSeconds(U32 secs)
@@ -492,4 +437,133 @@ LLAvatarListItem::icon_color_map_t& LLAvatarListItem::getItemIconColorMap()
 	return item_icon_color_map;
 }
 
+// static
+void LLAvatarListItem::initChildrenWidths(LLAvatarListItem* avatar_item)
+{
+	//profile btn width + padding
+	S32 profile_btn_width = avatar_item->getRect().getWidth() - avatar_item->mProfileBtn->getRect().mLeft;
+
+	//info btn width + padding
+	S32 info_btn_width = avatar_item->mProfileBtn->getRect().mLeft - avatar_item->mInfoBtn->getRect().mLeft;
+
+	//speaking indicator width + padding
+	S32 speaking_indicator_width = avatar_item->mInfoBtn->getRect().mLeft - avatar_item->mSpeakingIndicator->getRect().mLeft;
+
+	// last interaction time textbox width + padding
+	S32 last_interaction_time_width = avatar_item->mSpeakingIndicator->getRect().mLeft - avatar_item->mLastInteractionTime->getRect().mLeft;
+
+	// icon width + padding
+	S32 icon_width = avatar_item->mAvatarName->getRect().mLeft - avatar_item->mAvatarIcon->getRect().mLeft;
+
+	sLeftPadding = avatar_item->mAvatarIcon->getRect().mLeft;
+	sRightNamePadding = avatar_item->mLastInteractionTime->getRect().mLeft - avatar_item->mAvatarName->getRect().mRight;
+
+	S32 index = ALIC_COUNT;
+	sChildrenWidths[--index] = icon_width;
+	sChildrenWidths[--index] = 0; // for avatar name we don't need its width, it will be calculated as "left available space"
+	sChildrenWidths[--index] = last_interaction_time_width;
+	sChildrenWidths[--index] = speaking_indicator_width;
+	sChildrenWidths[--index] = info_btn_width;
+	sChildrenWidths[--index] = profile_btn_width;
+}
+
+void LLAvatarListItem::updateChildren()
+{
+	LL_DEBUGS("AvatarItemReshape") << LL_ENDL;
+	LL_DEBUGS("AvatarItemReshape") << "Updating for: " << getAvatarName() << LL_ENDL;
+
+	S32 name_new_width = getRect().getWidth();
+	S32 ctrl_new_left = name_new_width;
+	S32 name_new_left = sLeftPadding;
+
+	// iterate through all children and set them into correct position depend on each child visibility
+	// assume that child indexes are in back order: the first in Enum is the last (right) in the item
+	// iterate & set child views starting from right to left
+	for (S32 i = 0; i < ALIC_COUNT; ++i)
+	{
+		// skip "name" textbox, it will be processed out of loop later
+		if (ALIC_NAME == i) continue;
+
+		LLView* control = getItemChildView((EAvatarListItemChildIndex)i);
+
+		LL_DEBUGS("AvatarItemReshape") << "Processing control: " << control->getName() << LL_ENDL;
+		// skip invisible views
+		if (!control->getVisible()) continue;
+
+		S32 ctrl_width = sChildrenWidths[i]; // including space between current & left controls
+
+		// decrease available for 
+		name_new_width -= ctrl_width;
+		LL_DEBUGS("AvatarItemReshape") << "width: " << ctrl_width << ", name_new_width: " << name_new_width << LL_ENDL;
+
+		LLRect control_rect = control->getRect();
+		LL_DEBUGS("AvatarItemReshape") << "rect before: " << control_rect << LL_ENDL;
+
+		if (ALIC_ICON == i)
+		{
+			// assume that this is the last iteration,
+			// so it is not necessary to save "ctrl_new_left" value calculated on previous iterations
+			ctrl_new_left = sLeftPadding;
+			name_new_left = ctrl_new_left + ctrl_width;
+		}
+		else
+		{
+			ctrl_new_left -= ctrl_width;
+		}
+
+		LL_DEBUGS("AvatarItemReshape") << "ctrl_new_left: " << ctrl_new_left << LL_ENDL;
+
+		control_rect.setLeftTopAndSize(
+			ctrl_new_left,
+			control_rect.mTop,
+			control_rect.getWidth(),
+			control_rect.getHeight());
+
+		LL_DEBUGS("AvatarItemReshape") << "rect after: " << control_rect << LL_ENDL;
+		control->setShape(control_rect);
+	}
+
+	// set size and position of the "name" child
+	LLView* name_view = getItemChildView(ALIC_NAME);
+	LLRect name_view_rect = name_view->getRect();
+	LL_DEBUGS("AvatarItemReshape") << "name rect before: " << name_view_rect << LL_ENDL;
+
+	// apply paddings
+	name_new_width -= sLeftPadding;
+	name_new_width -= sRightNamePadding;
+
+	name_view_rect.setLeftTopAndSize(
+		name_new_left,
+		name_view_rect.mTop,
+		name_new_width,
+		name_view_rect.getHeight());
+
+	name_view->setShape(name_view_rect);
+
+	LL_DEBUGS("AvatarItemReshape") << "name rect after: " << name_view_rect << LL_ENDL;
+}
+
+LLView* LLAvatarListItem::getItemChildView(EAvatarListItemChildIndex child_view_index)
+{
+	LLView* child_view = mAvatarName;
+	if (child_view_index < 0 || ALIC_COUNT <= child_view_index)
+	{
+		LL_WARNS("AvatarItemReshape") << "Child view index is out of range: " << child_view_index << LL_ENDL;
+		return child_view;
+	}
+	switch (child_view_index)
+	{
+	case ALIC_ICON:					child_view = mAvatarIcon; break;
+	case ALIC_NAME:					child_view = mAvatarName; break;
+	case ALIC_INTERACTION_TIME:		child_view = mLastInteractionTime; break;
+	case ALIC_SPEAKER_INDICATOR:	child_view = mSpeakingIndicator; break;
+	case ALIC_INFO_BUTTON:			child_view = mInfoBtn; break;
+	case ALIC_PROFILE_BUTTON:		child_view = mProfileBtn; break;
+	default:
+		LL_WARNS("AvatarItemReshape") << "Unexpected child view index is passed: " << child_view_index << LL_ENDL;
+	}
+	
+	return child_view;
+}
+
 // EOF
diff --git a/indra/newview/llavatarlistitem.h b/indra/newview/llavatarlistitem.h
index 96097bc9b52..479a4833cb9 100644
--- a/indra/newview/llavatarlistitem.h
+++ b/indra/newview/llavatarlistitem.h
@@ -74,6 +74,11 @@ class LLAvatarListItem : public LLPanel, public LLFriendObserver
 	virtual ~LLAvatarListItem();
 
 	virtual BOOL postBuild();
+
+	/**
+	 * Processes notification from speaker indicator to update children when indicator's visibility is changed.
+	 */
+	virtual S32	notifyParent(const LLSD& info);
 	virtual void onMouseLeave(S32 x, S32 y, MASK mask);
 	virtual void onMouseEnter(S32 x, S32 y, MASK mask);
 	virtual void setValue(const LLSD& value);
@@ -88,7 +93,8 @@ class LLAvatarListItem : public LLPanel, public LLFriendObserver
 	//Show/hide profile/info btn, translating speaker indicator and avatar name coordinates accordingly
 	void setShowProfileBtn(bool show);
 	void setShowInfoBtn(bool show);
-	void setSpeakingIndicatorVisible(bool visible);
+	void showSpeakingIndicator(bool show);
+	void showLastInteractionTime(bool show);
 	void setAvatarIconVisible(bool visible);
 	
 	const LLUUID& getAvatarId() const;
@@ -97,16 +103,7 @@ class LLAvatarListItem : public LLPanel, public LLFriendObserver
 	void onInfoBtnClick();
 	void onProfileBtnClick();
 
-	void showSpeakingIndicator(bool show) { mSpeakingIndicator->setVisible(show); }
-	void showInfoBtn(bool show_info_btn) {mInfoBtn->setVisible(show_info_btn); }
-	void showLastInteractionTime(bool show);
-
-	/**
-	 * This method was added to fix EXT-2364 (Items in group/ad-hoc IM participant list (avatar names) should be reshaped when adding/removing the "(Moderator)" label)
-	 * But this is a *HACK. The real reason of it was in incorrect logic while hiding profile/info/speaker buttons
-	 * *TODO: new reshape method should be provided in lieu of this one to be called when visibility if those buttons is changed
-	 */
-	void reshapeAvatarName();
+	/*virtual*/ BOOL handleDoubleClick(S32 x, S32 y, MASK mask);
 
 protected:
 	/**
@@ -124,6 +121,23 @@ class LLAvatarListItem : public LLPanel, public LLFriendObserver
 		E_UNKNOWN,
 	} EOnlineStatus;
 
+	/**
+	 * Enumeration of item elements in order from right to left.
+	 * 
+	 * updateChildren() assumes that indexes are in the such order to process avatar icon easier.
+	 *
+	 * @see updateChildren()
+	 */
+	typedef enum e_avatar_item_child {
+		ALIC_PROFILE_BUTTON,
+		ALIC_INFO_BUTTON,
+		ALIC_SPEAKER_INDICATOR,
+		ALIC_INTERACTION_TIME,
+		ALIC_NAME,
+		ALIC_ICON,
+		ALIC_COUNT,
+	} EAvatarListItemChildIndex;
+
 	void setNameInternal(const std::string& name, const std::string& highlight);
 	void onNameCache(const std::string& first_name, const std::string& last_name);
 
@@ -135,6 +149,26 @@ class LLAvatarListItem : public LLPanel, public LLFriendObserver
 	typedef std::map<EItemState, LLColor4> icon_color_map_t;
 	static icon_color_map_t& getItemIconColorMap();
 
+	/**
+	 * Initializes widths of all children to use them while changing visibility of any of them.
+	 *
+	 * @see updateChildren()
+	 */
+	static void initChildrenWidths(LLAvatarListItem* self);
+
+	/**
+	 * Updates position and rectangle of visible children to fit all available item's width.
+	 */
+	void updateChildren();
+
+	/**
+	 * Gets child view specified by index.
+	 *
+	 * This method implemented via switch by all EAvatarListItemChildIndex values.
+	 * It is used to not store children in array or vector to avoid of increasing memory usage.
+	 */
+	LLView* getItemChildView(EAvatarListItemChildIndex child_index);
+
 	LLTextBox* mAvatarName;
 	LLTextBox* mLastInteractionTime;
 	LLStyle::Params mAvatarNameStyle;
@@ -151,10 +185,17 @@ class LLAvatarListItem : public LLPanel, public LLFriendObserver
 	bool mShowProfileBtn;
 
 	static bool	sStaticInitialized; // this variable is introduced to improve code readability
-	static S32	sIconWidth; // icon width + padding
-	static S32  sInfoBtnWidth; //info btn width + padding
-	static S32  sProfileBtnWidth; //profile btn width + padding
-	static S32  sSpeakingIndicatorWidth; //speaking indicator width + padding
+	static S32  sLeftPadding; // padding to first left visible child (icon or name)
+	static S32  sRightNamePadding; // right padding from name to next visible child
+
+	/**
+	 * Contains widths of each child specified by EAvatarListItemChildIndex
+	 * including padding to the next right one.
+	 *
+	 * @see initChildrenWidths()
+	 */
+	static S32 sChildrenWidths[ALIC_COUNT];
+
 };
 
 #endif //LL_LLAVATARLISTITEM_H
diff --git a/indra/newview/llbottomtray.cpp b/indra/newview/llbottomtray.cpp
index 976b3125093..bd68d528680 100644
--- a/indra/newview/llbottomtray.cpp
+++ b/indra/newview/llbottomtray.cpp
@@ -48,10 +48,20 @@
 #include "llsyswellwindow.h"
 #include "llfloatercamera.h"
 #include "lltexteditor.h"
+#include "llnotifications.h"
 
 // Build time optimization, generate extern template once in .cpp file
 template class LLBottomTray* LLSingleton<class LLBottomTray>::getInstance();
 
+namespace
+{
+	const std::string& PANEL_CHICLET_NAME	= "chiclet_list_panel";
+	const std::string& PANEL_CHATBAR_NAME	= "chat_bar";
+	const std::string& PANEL_MOVEMENT_NAME	= "movement_panel";
+	const std::string& PANEL_CAMERA_NAME	= "cam_panel";
+	const std::string& PANEL_GESTURE_NAME	= "gesture_panel";
+}
+
 LLBottomTray::LLBottomTray(const LLSD&)
 :	mChicletPanel(NULL),
 	mSpeakPanel(NULL),
@@ -161,6 +171,9 @@ void LLBottomTray::sessionAdded(const LLUUID& session_id, const std::string& nam
 	{
 		chiclet->setIMSessionName(name);
 		chiclet->setOtherParticipantId(other_participant_id);
+		
+		LLIMFloater::onIMChicletCreated(session_id);
+
 	}
 	else
 	{
@@ -233,6 +246,61 @@ void LLBottomTray::onFocusLost()
 	}
 }
 
+void LLBottomTray::savePanelsShape()
+{
+	mSavedShapeList.clear();
+	for (child_list_const_iter_t
+			 child_it = mToolbarStack->beginChild(),
+			 child_it_end = mToolbarStack->endChild();
+		 child_it != child_it_end; ++child_it)
+	{
+		mSavedShapeList.push_back( (*child_it)->getRect() );
+	}
+}
+
+void LLBottomTray::restorePanelsShape()
+{
+	if (mSavedShapeList.size() != mToolbarStack->getChildCount())
+		return;
+	int i = 0;
+	for (child_list_const_iter_t
+			 child_it = mToolbarStack->beginChild(),
+			 child_it_end = mToolbarStack->endChild();
+		 child_it != child_it_end; ++child_it)
+	{
+		(*child_it)->setShape(mSavedShapeList[i++]);
+	}
+}
+
+void LLBottomTray::onMouselookModeOut()
+{
+	// Apply the saved settings when we are not in mouselook mode, see EXT-3988.
+	{
+		setTrayButtonVisibleIfPossible (RS_BUTTON_GESTURES, gSavedSettings.getBOOL("ShowGestureButton"), false);
+		setTrayButtonVisibleIfPossible (RS_BUTTON_MOVEMENT, gSavedSettings.getBOOL("ShowMoveButton"),    false);
+		setTrayButtonVisibleIfPossible (RS_BUTTON_CAMERA,   gSavedSettings.getBOOL("ShowCameraButton"),  false);
+		setTrayButtonVisibleIfPossible (RS_BUTTON_SNAPSHOT, gSavedSettings.getBOOL("ShowSnapshotButton"),false);
+	}
+	// HACK: To avoid usage the LLLayoutStack logic of resizing, we force the updateLayout
+	// and then restore children saved shapes. See EXT-4309.
+	BOOL saved_anim = mToolbarStack->getAnimate();
+	mToolbarStack->updatePanelAutoResize(PANEL_CHATBAR_NAME, FALSE);
+	// Disable animation to prevent layout updating in several frames.
+	mToolbarStack->setAnimate(FALSE);
+	// Force the updating of layout to reset panels collapse factor.
+	mToolbarStack->updateLayout();
+	// Restore animate state.
+	mToolbarStack->setAnimate(saved_anim);
+	// Restore saved shapes.
+	restorePanelsShape();
+}
+
+void LLBottomTray::onMouselookModeIn()
+{
+	savePanelsShape();
+	mToolbarStack->updatePanelAutoResize(PANEL_CHATBAR_NAME, TRUE);
+}
+
 //virtual
 // setVisible used instead of onVisibilityChange, since LLAgent calls it on entering/leaving mouselook mode.
 // If bottom tray is already visible in mouselook mode, then onVisibilityChange will not be called from setVisible(true),
@@ -251,8 +319,10 @@ void LLBottomTray::setVisible(BOOL visible)
 		{
 			LLView* viewp = *child_it;
 			std::string name = viewp->getName();
-			
-			if ("chat_bar" == name || "movement_panel" == name || "cam_panel" == name || "snapshot_panel" == name || "gesture_panel" == name)
+
+			// Chat bar and gesture button are shown even in mouselook mode.
+			// But the move, camera and snapshot buttons shouldn't be displayed. See EXT-3988.
+			if ("chat_bar" == name || "gesture_panel" == name || (visibility && ("movement_panel" == name || "cam_panel" == name || "snapshot_panel" == name)))
 				continue;
 			else 
 			{
@@ -260,6 +330,11 @@ void LLBottomTray::setVisible(BOOL visible)
 			}
 		}
 	}
+
+	if(visible)
+		gFloaterView->setSnapOffsetBottom(getRect().getHeight());
+	else
+		gFloaterView->setSnapOffsetBottom(0);
 }
 
 void LLBottomTray::showBottomTrayContextMenu(S32 x, S32 y, MASK mask)
@@ -324,15 +399,6 @@ void LLBottomTray::showSnapshotButton(BOOL visible)
 	setTrayButtonVisibleIfPossible(RS_BUTTON_SNAPSHOT, visible);
 }
 
-namespace
-{
-	const std::string& PANEL_CHICLET_NAME	= "chiclet_list_panel";
-	const std::string& PANEL_CHATBAR_NAME	= "chat_bar";
-	const std::string& PANEL_MOVEMENT_NAME	= "movement_panel";
-	const std::string& PANEL_CAMERA_NAME	= "cam_panel";
-	const std::string& PANEL_GESTURE_NAME	= "gesture_panel";
-}
-
 BOOL LLBottomTray::postBuild()
 {
 
@@ -1005,7 +1071,7 @@ void LLBottomTray::setTrayButtonVisible(EResizeState shown_object_type, bool vis
 	panel->setVisible(visible);
 }
 
-void LLBottomTray::setTrayButtonVisibleIfPossible(EResizeState shown_object_type, bool visible)
+void LLBottomTray::setTrayButtonVisibleIfPossible(EResizeState shown_object_type, bool visible, bool raise_notification)
 {
 	bool can_be_set = true;
 
@@ -1045,7 +1111,11 @@ void LLBottomTray::setTrayButtonVisibleIfPossible(EResizeState shown_object_type
 	{
 		// mark this button to show it while future bottom tray extending
 		mResizeState |= shown_object_type;
-		LLNotificationsUtil::add("BottomTrayButtonCanNotBeShown");
+		if ( raise_notification )
+			LLNotificationsUtil::add("BottomTrayButtonCanNotBeShown",
+									 LLSD(),
+									 LLSD(),
+									 LLNotificationFunctorRegistry::instance().DONOTHING);
 	}
 }
 
diff --git a/indra/newview/llbottomtray.h b/indra/newview/llbottomtray.h
index 9be0e5810f0..562ee569125 100644
--- a/indra/newview/llbottomtray.h
+++ b/indra/newview/llbottomtray.h
@@ -92,7 +92,10 @@ class LLBottomTray
 	void showMoveButton(BOOL visible);
 	void showCameraButton(BOOL visible);
 	void showSnapshotButton(BOOL visible);
-	
+
+	void onMouselookModeIn();
+	void onMouselookModeOut();
+
 	/**
 	 * Creates IM Chiclet based on session type (IM chat or Group chat)
 	 */
@@ -167,7 +170,14 @@ class LLBottomTray
 	 *  - if hidden via context menu button should be shown but there is no enough room for now
 	 *    it will be shown while extending.
 	 */
-	void setTrayButtonVisibleIfPossible(EResizeState shown_object_type, bool visible);
+	void setTrayButtonVisibleIfPossible(EResizeState shown_object_type, bool visible, bool raise_notification = true);
+
+	/**
+	 * Save and restore children shapes.
+	 * Used to avoid the LLLayoutStack resizing logic between mouse look mode switching.
+	 */
+	void savePanelsShape();
+	void restorePanelsShape();
 
 	MASK mResizeState;
 
@@ -177,6 +187,9 @@ class LLBottomTray
 	typedef std::map<EResizeState, S32> state_object_width_map_t;
 	state_object_width_map_t mObjectDefaultWidthMap;
 
+	typedef std::vector<LLRect> shape_list_t;
+	shape_list_t mSavedShapeList;
+
 protected:
 
 	LLBottomTray(const LLSD& key = LLSD());
diff --git a/indra/newview/llcallfloater.cpp b/indra/newview/llcallfloater.cpp
index a402f59fa11..f346a4b8c2b 100644
--- a/indra/newview/llcallfloater.cpp
+++ b/indra/newview/llcallfloater.cpp
@@ -47,11 +47,13 @@
 #include "llfloaterreg.h"
 #include "llparticipantlist.h"
 #include "llspeakers.h"
+#include "lltextutil.h"
 #include "lltransientfloatermgr.h"
 #include "llviewerwindow.h"
 #include "llvoicechannel.h"
 
 static void get_voice_participants_uuids(std::vector<LLUUID>& speakers_uuids);
+void reshape_floater(LLCallFloater* floater, S32 delta_height);
 
 class LLNonAvatarCaller : public LLAvatarListItem
 {
@@ -76,6 +78,12 @@ class LLNonAvatarCaller : public LLAvatarListItem
 		return rv;
 	}
 
+	void setName(const std::string& name)
+	{
+		const std::string& formatted_phone = LLTextUtil::formatPhoneNumber(name);
+		LLAvatarListItem::setName(formatted_phone);
+	}
+
 	void setSpeakerId(const LLUUID& id) { mSpeakingIndicator->setSpeakerId(id); }
 };
 
@@ -217,16 +225,6 @@ void LLCallFloater::onChange()
 	}
 }
 
-S32 LLCallFloater::notifyParent(const LLSD& info)
-{
-	if("size_changes" == info["action"])
-	{
-		reshapeToFitContent();
-		return 1;
-	}
-	return LLDockableFloater::notifyParent(info);
-}
-
 //////////////////////////////////////////////////////////////////////////
 /// PRIVATE SECTION
 //////////////////////////////////////////////////////////////////////////
@@ -270,6 +268,11 @@ void LLCallFloater::updateSession()
 		case IM_NOTHING_SPECIAL:
 		case IM_SESSION_P2P_INVITE:
 			mVoiceType = VC_PEER_TO_PEER;
+
+			if (!im_session->mOtherParticipantIsAvatar)
+			{
+				mVoiceType = VC_PEER_TO_PEER_AVALINE;
+			}
 			break;
 		case IM_SESSION_CONFERENCE_START:
 		case IM_SESSION_GROUP_START:
@@ -302,8 +305,8 @@ void LLCallFloater::updateSession()
 	
 	//hide "Leave Call" button for nearby chat
 	bool is_local_chat = mVoiceType == VC_LOCAL_CHAT;
-	childSetVisible("leave_call_btn", !is_local_chat);
-	
+	childSetVisible("leave_call_btn_panel", !is_local_chat);
+
 	refreshParticipantList();
 	updateAgentModeratorState();
 
@@ -321,16 +324,13 @@ void LLCallFloater::updateSession()
 
 void LLCallFloater::refreshParticipantList()
 {
-	bool non_avatar_caller = false;
-	if (VC_PEER_TO_PEER == mVoiceType)
+	bool non_avatar_caller = VC_PEER_TO_PEER_AVALINE == mVoiceType;
+
+	if (non_avatar_caller)
 	{
 		LLIMModel::LLIMSession* session = LLIMModel::instance().findIMSession(mSpeakerManager->getSessionID());
-		non_avatar_caller = !session->mOtherParticipantIsAvatar;
-		if (non_avatar_caller)
-		{
-			mNonAvatarCaller->setSpeakerId(session->mOtherParticipantID);
-			mNonAvatarCaller->setName(session->mName);
-		}
+		mNonAvatarCaller->setSpeakerId(session->mOtherParticipantID);
+		mNonAvatarCaller->setName(session->mName);
 	}
 
 	mNonAvatarCaller->setVisible(non_avatar_caller);
@@ -390,9 +390,17 @@ void LLCallFloater::updateTitle()
 		title = getString("title_nearby");
 		break;
 	case VC_PEER_TO_PEER:
+	case VC_PEER_TO_PEER_AVALINE:
 		{
+			title = voice_channel->getSessionName();
+
+			if (VC_PEER_TO_PEER_AVALINE == mVoiceType)
+			{
+				title = LLTextUtil::formatPhoneNumber(title);
+			}
+
 			LLStringUtil::format_map_t args;
-			args["[NAME]"] = voice_channel->getSessionName();
+			args["[NAME]"] = title;
 			title = getString("title_peer_2_peer", args);
 		}
 		break;
@@ -706,13 +714,28 @@ void LLCallFloater::removeVoiceRemoveTimer(const LLUUID& voice_speaker_id)
 
 bool LLCallFloater::validateSpeaker(const LLUUID& speaker_id)
 {
-	if (mVoiceType != VC_LOCAL_CHAT)
-		return true;
+	bool is_valid = true;
+	switch (mVoiceType)
+	{
+	case  VC_LOCAL_CHAT:
+		{
+			// A nearby chat speaker is considered valid it it's known to LLVoiceClient (i.e. has enabled voice).
+			std::vector<LLUUID> speakers;
+			get_voice_participants_uuids(speakers);
+			is_valid = std::find(speakers.begin(), speakers.end(), speaker_id) != speakers.end();
+		}
+		break;
+	case VC_GROUP_CHAT:
+		// if participant had left this call before do not allow add her again. See EXT-4216.
+		// but if she Join she will be added into the list from the LLCallFloater::onChange()
+		is_valid = STATE_LEFT != getState(speaker_id);
+		break;
+	default:
+		// do nothing. required for Linux build
+		break;
+	}
 
-	// A nearby chat speaker is considered valid it it's known to LLVoiceClient (i.e. has enabled voice).
-	std::vector<LLUUID> speakers;
-	get_voice_participants_uuids(speakers);
-	return std::find(speakers.begin(), speakers.end(), speaker_id) != speakers.end();
+	return is_valid;
 }
 
 void LLCallFloater::connectToChannel(LLVoiceChannel* channel)
@@ -765,91 +788,4 @@ void LLCallFloater::reset()
 	mSpeakerManager = NULL;
 }
 
-void reshape_floater(LLCallFloater* floater, S32 delta_height)
-{
-	// Try to update floater top side if it is docked(to bottom bar).
-	// Try to update floater bottom side or top side if it is un-docked.
-	// If world rect is too small, floater will not be reshaped at all.
-
-	LLRect floater_rect = floater->getRect();
-	LLRect world_rect = gViewerWindow->getWorldViewRectScaled();
-
-	// floater is docked to bottom bar
-	if(floater->isDocked())
-	{
-		// can update floater top side
-		if(floater_rect.mTop + delta_height < world_rect.mTop)
-		{
-			floater_rect.set(floater_rect.mLeft, floater_rect.mTop + delta_height, 
-				floater_rect.mRight, floater_rect.mBottom);
-		}
-	}
-	// floater is un-docked
-	else
-	{
-		// can update floater bottom side
-		if( floater_rect.mBottom - delta_height >= world_rect.mBottom )
-		{
-			floater_rect.set(floater_rect.mLeft, floater_rect.mTop, 
-				floater_rect.mRight, floater_rect.mBottom - delta_height);
-		}
-		// could not update floater bottom side, check if we can update floater top side
-		else if( floater_rect.mTop + delta_height < world_rect.mTop )
-		{
-			floater_rect.set(floater_rect.mLeft, floater_rect.mTop + delta_height, 
-				floater_rect.mRight, floater_rect.mBottom);
-		}
-	}
-
-	floater->reshape(floater_rect.getWidth(), floater_rect.getHeight());
-	floater->setRect(floater_rect);
-}
-
-void LLCallFloater::reshapeToFitContent()
-{
-	const S32 ITEM_HEIGHT = getParticipantItemHeight();
-	static const S32 MAX_VISIBLE_ITEMS = getMaxVisibleItems();
-
-	static S32 items_pad = mAvatarList->getItemsPad();
-	S32 list_height = mAvatarList->getRect().getHeight();
-	S32 items_height = mAvatarList->getItemsRect().getHeight();
-	if(items_height <= 0)
-	{
-		// make "no one near" text visible
-		items_height = ITEM_HEIGHT + items_pad;
-	}
-	S32 max_list_height = MAX_VISIBLE_ITEMS * ITEM_HEIGHT + items_pad * (MAX_VISIBLE_ITEMS - 1);
-	max_list_height += 2* mAvatarList->getBorderWidth();
-
-	S32 delta = items_height - list_height;	
-	// too many items, don't reshape floater anymore, let scroll bar appear.
-	if(items_height >  max_list_height)
-	{
-		delta = max_list_height - list_height;
-	}
-
-	reshape_floater(this, delta);
-}
-
-S32 LLCallFloater::getParticipantItemHeight()
-{
-	std::vector<LLPanel*> items;
-	mAvatarList->getItems(items);
-	if(items.size() > 0)
-	{
-		return items[0]->getRect().getHeight();
-	}
-	else
-	{
-		return getChild<LLPanel>("non_avatar_caller")->getRect().getHeight();
-	}
-}
-
-S32 LLCallFloater::getMaxVisibleItems()
-{
-	S32 value = 5; // default value, in case convertToS32() fails.
-	LLStringUtil::convertToS32(getString("max_visible_items"), value);
-	return value;
-}
-
 //EOF
diff --git a/indra/newview/llcallfloater.h b/indra/newview/llcallfloater.h
index 8aba93fc43b..096594aaa20 100644
--- a/indra/newview/llcallfloater.h
+++ b/indra/newview/llcallfloater.h
@@ -75,11 +75,6 @@ class LLCallFloater : public LLTransientDockableFloater, LLVoiceClientParticipan
 	 */
 	/*virtual*/ void onChange();
 
-	/**
-	* Will reshape floater when participant list size changes
-	*/
-	/*virtual*/ S32 notifyParent(const LLSD& info);
-
 	static void sOnCurrentChannelChanged(const LLUUID& session_id);
 
 private:
@@ -88,7 +83,8 @@ class LLCallFloater : public LLTransientDockableFloater, LLVoiceClientParticipan
 		VC_LOCAL_CHAT,
 		VC_GROUP_CHAT,
 		VC_AD_HOC_CHAT,
-		VC_PEER_TO_PEER
+		VC_PEER_TO_PEER,
+		VC_PEER_TO_PEER_AVALINE
 	}EVoiceControls;
 
 	typedef enum e_speaker_state
@@ -220,21 +216,6 @@ class LLCallFloater : public LLTransientDockableFloater, LLVoiceClientParticipan
 	 */
 	void reset();
 
-	/**
-	* Reshapes floater to fit participant list height
-	*/
-	void reshapeToFitContent();
-
-	/**
-	* Returns height of participant list item
-	*/
-	S32 getParticipantItemHeight();
-
-	/**
-	* Returns predefined max visible participants.
-	*/
-	S32 getMaxVisibleItems();
-
 private:
 	speaker_state_map_t mSpeakerStateMap;
 	LLSpeakerMgr* mSpeakerManager;
diff --git a/indra/newview/llchatbar.cpp b/indra/newview/llchatbar.cpp
index 442dc660cdb..b32a9550384 100644
--- a/indra/newview/llchatbar.cpp
+++ b/indra/newview/llchatbar.cpp
@@ -48,7 +48,6 @@
 #include "llcombobox.h"
 #include "llcommandhandler.h"	// secondlife:///app/chat/ support
 #include "llviewercontrol.h"
-#include "llfloaterchat.h"
 #include "llgesturemgr.h"
 #include "llkeyboard.h"
 #include "lllineeditor.h"
@@ -548,7 +547,7 @@ void LLChatBar::onInputEditorFocusLost()
 // static
 void LLChatBar::onInputEditorGainFocus()
 {
-	LLFloaterChat::setHistoryCursorAndScrollToEnd();
+	//LLFloaterChat::setHistoryCursorAndScrollToEnd();
 }
 
 void LLChatBar::onClickSay( LLUICtrl* ctrl )
diff --git a/indra/newview/llchathistory.cpp b/indra/newview/llchathistory.cpp
index 21cadda6e3e..a46cd84b608 100644
--- a/indra/newview/llchathistory.cpp
+++ b/indra/newview/llchathistory.cpp
@@ -499,7 +499,24 @@ void LLChatHistory::appendMessage(const LLChat& chat, const bool use_plain_text_
 	style_params.font.name(font_name);
 	style_params.font.size(font_size);	
 	style_params.font.style(input_append_params.font.style);
-	
+
+	std::string prefix = chat.mText.substr(0, 4);
+
+	//IRC styled /me messages.
+	bool irc_me = prefix == "/me " || prefix == "/me'";
+
+	// Delimiter after a name in header copy/past and in plain text mode
+	std::string delimiter = (chat.mChatType != CHAT_TYPE_SHOUT && chat.mChatType != CHAT_TYPE_WHISPER)
+		? ": "
+		: " ";
+
+	// Don't add any delimiter after name in irc styled messages
+	if (irc_me || chat.mChatStyle == CHAT_STYLE_IRC)
+	{
+		delimiter = LLStringUtil::null;
+		style_params.font.style = "ITALIC";
+	}
+
 	if (use_plain_text_chat_history)
 	{
 		mEditor->appendText("[" + chat.mTimeStr + "] ", mEditor->getText().size() != 0, style_params);
@@ -512,11 +529,11 @@ void LLChatHistory::appendMessage(const LLChat& chat, const bool use_plain_text_
 				LLStyle::Params link_params(style_params);
 				link_params.fillFrom(LLStyleMap::instance().lookupAgent(chat.mFromID));
 				// Convert the name to a hotlink and add to message.
-				mEditor->appendText(chat.mFromName + ": ", false, link_params);
+				mEditor->appendText(chat.mFromName + delimiter, false, link_params);
 			}
 			else
 			{
-				mEditor->appendText(chat.mFromName + ": ", false, style_params);
+				mEditor->appendText(chat.mFromName + delimiter, false, style_params);
 			}
 		}
 	}
@@ -560,39 +577,25 @@ void LLChatHistory::appendMessage(const LLChat& chat, const bool use_plain_text_
 		view->reshape(target_rect.getWidth(), view->getRect().getHeight());
 		view->setOrigin(target_rect.mLeft, view->getRect().mBottom);
 
-		std::string header_text = "[" + chat.mTimeStr + "] ";
+		std::string widget_associated_text = "\n[" + chat.mTimeStr + "] ";
 		if (utf8str_trim(chat.mFromName).size() != 0 && chat.mFromName != SYSTEM_FROM)
-			header_text += chat.mFromName + ": ";
+			widget_associated_text += chat.mFromName + delimiter;
 
-		mEditor->appendWidget(p, header_text, false);
+		mEditor->appendWidget(p, widget_associated_text, false);
 		mLastFromName = chat.mFromName;
 		mLastFromID = chat.mFromID;
 		mLastMessageTime = new_message_time;
 	}
-	//Handle IRC styled /me messages.
-	std::string prefix = chat.mText.substr(0, 4);
-	if (prefix == "/me " || prefix == "/me'")
-	{
-		style_params.font.style = "ITALIC";
 
-		if (chat.mFromName.size() > 0)
-			mEditor->appendText(chat.mFromName + " ", TRUE, style_params);
-		// Ensure that message ends with NewLine, to avoid losing of new lines
-		// while copy/paste from text chat. See EXT-3263.
-		mEditor->appendText(chat.mText.substr(4) + NEW_LINE, FALSE, style_params);
-	}
-	else
+	std::string message = irc_me ? chat.mText.substr(3) : chat.mText;
+	mEditor->appendText(message, FALSE, style_params);
+	mEditor->blockUndo();
+
+	// automatically scroll to end when receiving chat from myself
+	if (chat.mFromID == gAgentID)
 	{
-		std::string message(chat.mText);
-		if ( message.size() > 0 && !LLStringOps::isSpace(message[message.size() - 1]) )
-		{
-			// Ensure that message ends with NewLine, to avoid losing of new lines
-			// while copy/paste from text chat. See EXT-3263.
-			message += NEW_LINE;
-		}
-		mEditor->appendText(message, FALSE, style_params);
+		mEditor->setCursorAndScrollToEnd();
 	}
-	mEditor->blockUndo();
 }
 
 void LLChatHistory::draw()
@@ -606,3 +609,11 @@ void LLChatHistory::draw()
 	LLUICtrl::draw();
 }
 
+void LLChatHistory::reshape(S32 width, S32 height, BOOL called_from_parent)
+{
+	bool is_scrolled_to_end = mEditor->scrolledToEnd();
+	LLUICtrl::reshape( width, height, called_from_parent );
+	// update scroll
+	if (is_scrolled_to_end)
+		mEditor->setCursorAndScrollToEnd();
+}
diff --git a/indra/newview/llchathistory.h b/indra/newview/llchathistory.h
index 260015e2dc8..f2d403f6393 100644
--- a/indra/newview/llchathistory.h
+++ b/indra/newview/llchathistory.h
@@ -119,6 +119,7 @@ class LLChatHistory : public LLUICtrl
 		 */
 		void appendMessage(const LLChat& chat, const bool use_plain_text_chat_history = false, const LLStyle::Params& input_append_params = LLStyle::Params());
 		/*virtual*/ void clear();
+		/*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE);
 
 	private:
 		std::string mLastFromName;
diff --git a/indra/newview/llchatitemscontainerctrl.cpp b/indra/newview/llchatitemscontainerctrl.cpp
index 92df2813073..f7f7ee83afd 100644
--- a/indra/newview/llchatitemscontainerctrl.cpp
+++ b/indra/newview/llchatitemscontainerctrl.cpp
@@ -168,30 +168,30 @@ void LLNearbyChatToastPanel::init(LLSD& notification)
 
 	msg_text->setText(std::string(""));
 
-	std::string str_sender;
-	
-	if(gAgentID != mFromID)
+	if ( notification["chat_style"].asInteger() != CHAT_STYLE_IRC )
+	{
+		std::string str_sender;
+
 		str_sender = fromName;
-	else
-		str_sender = LLTrans::getString("You");
 
-	str_sender+=" ";
+		str_sender+=" ";
 
-	//append user name
-	{
-		LLStyle::Params style_params_name;
+		//append user name
+		{
+			LLStyle::Params style_params_name;
 
-		LLColor4 userNameColor = LLUIColorTable::instance().getColor("ChatToastAgentNameColor");
+			LLColor4 userNameColor = LLUIColorTable::instance().getColor("ChatToastAgentNameColor");
 
-		style_params_name.color(userNameColor);
-		
-		std::string font_name = LLFontGL::nameFromFont(messageFont);
-		std::string font_style_size = LLFontGL::sizeFromFont(messageFont);
-		style_params_name.font.name(font_name);
-		style_params_name.font.size(font_style_size);
-		
-		msg_text->appendText(str_sender, FALSE, style_params_name);
-		
+			style_params_name.color(userNameColor);
+
+			std::string font_name = LLFontGL::nameFromFont(messageFont);
+			std::string font_style_size = LLFontGL::sizeFromFont(messageFont);
+			style_params_name.font.name(font_name);
+			style_params_name.font.size(font_style_size);
+
+			msg_text->appendText(str_sender, FALSE, style_params_name);
+
+		}
 	}
 
 	//append text
@@ -252,11 +252,33 @@ void LLNearbyChatToastPanel::onMouseEnter				(S32 x, S32 y, MASK mask)
 }
 
 BOOL	LLNearbyChatToastPanel::handleMouseDown	(S32 x, S32 y, MASK mask)
+{
+	return LLPanel::handleMouseDown(x,y,mask);
+}
+
+BOOL	LLNearbyChatToastPanel::handleMouseUp	(S32 x, S32 y, MASK mask)
 {
 	if(mSourceType != CHAT_SOURCE_AGENT)
-		return LLPanel::handleMouseDown(x,y,mask);
+		return LLPanel::handleMouseUp(x,y,mask);
+
+	LLChatMsgBox* text_box = getChild<LLChatMsgBox>("msg_text", false);
+	S32 local_x = x - text_box->getRect().mLeft;
+	S32 local_y = y - text_box->getRect().mBottom;
+	
+	//if text_box process mouse up (ussually this is click on url) - we didn't show nearby_chat.
+	if (text_box->pointInView(local_x, local_y) )
+	{
+		if (text_box->handleMouseUp(local_x,local_y,mask) == TRUE)
+			return TRUE;
+		else
+		{
+			LLFloaterReg::showInstance("nearby_chat",LLSD());
+			return FALSE;
+		}
+	}
+
 	LLFloaterReg::showInstance("nearby_chat",LLSD());
-	return LLPanel::handleMouseDown(x,y,mask);
+	return LLPanel::handleMouseUp(x,y,mask);
 }
 
 void	LLNearbyChatToastPanel::setHeaderVisibility(EShowItemHeader e)
diff --git a/indra/newview/llchatitemscontainerctrl.h b/indra/newview/llchatitemscontainerctrl.h
index 0a85c524015..f4b86550541 100644
--- a/indra/newview/llchatitemscontainerctrl.h
+++ b/indra/newview/llchatitemscontainerctrl.h
@@ -68,6 +68,7 @@ class LLNearbyChatToastPanel: public LLToastPanelBase
 	void	onMouseLeave	(S32 x, S32 y, MASK mask);
 	void	onMouseEnter	(S32 x, S32 y, MASK mask);
 	BOOL	handleMouseDown	(S32 x, S32 y, MASK mask);
+	BOOL	handleMouseUp	(S32 x, S32 y, MASK mask);
 
 	virtual BOOL postBuild();
 
diff --git a/indra/newview/llchiclet.cpp b/indra/newview/llchiclet.cpp
index dc2e22f8992..8da207f887f 100644
--- a/indra/newview/llchiclet.cpp
+++ b/indra/newview/llchiclet.cpp
@@ -47,6 +47,7 @@
 #include "llnotificationsutil.h"
 #include "lloutputmonitorctrl.h"
 #include "llscriptfloater.h"
+#include "llspeakers.h"
 #include "lltextbox.h"
 #include "llvoiceclient.h"
 #include "llgroupmgr.h"
@@ -453,6 +454,7 @@ LLIMChiclet::LLIMChiclet(const LLIMChiclet::Params& p)
 , mNewMessagesIcon(NULL)
 , mSpeakerCtrl(NULL)
 , mCounterCtrl(NULL)
+, mChicletButton(NULL)
 {
 	enableCounterControl(p.enable_counter);
 }
@@ -540,6 +542,11 @@ void LLIMChiclet::toggleSpeakerControl()
 
 void LLIMChiclet::setCounter(S32 counter)
 {
+	if (mCounterCtrl->getCounter() == counter)
+	{
+		return;
+	}
+
 	mCounterCtrl->setCounter(counter);
 	setShowCounter(counter);
 	setShowNewMessagesIcon(counter);
@@ -571,6 +578,11 @@ void LLIMChiclet::onMouseDown()
 	setCounter(0);
 }
 
+void LLIMChiclet::setToggleState(bool toggle)
+{
+	mChicletButton->setToggleState(toggle);
+}
+
 BOOL LLIMChiclet::handleMouseDown(S32 x, S32 y, MASK mask)
 {
 	onMouseDown();
@@ -629,6 +641,7 @@ LLIMChiclet::EType LLIMChiclet::getIMSessionType(const LLUUID& session_id)
 
 LLIMP2PChiclet::Params::Params()
 : avatar_icon("avatar_icon")
+, chiclet_button("chiclet_button")
 , unread_notifications("unread_notifications")
 , speaker("speaker")
 , new_message_icon("new_message_icon")
@@ -641,6 +654,10 @@ LLIMP2PChiclet::LLIMP2PChiclet(const Params& p)
 , mChicletIconCtrl(NULL)
 , mPopupMenu(NULL)
 {
+	LLButton::Params button_params = p.chiclet_button;
+	mChicletButton = LLUICtrlFactory::create<LLButton>(button_params);
+	addChild(mChicletButton);
+
 	LLIconCtrl::Params new_msg_params = p.new_message_icon;
 	mNewMessagesIcon = LLUICtrlFactory::create<LLIconCtrl>(new_msg_params);
 	addChild(mNewMessagesIcon);
@@ -755,6 +772,7 @@ void LLIMP2PChiclet::onMenuItemClicked(const LLSD& user_data)
 
 LLAdHocChiclet::Params::Params()
 : avatar_icon("avatar_icon")
+, chiclet_button("chiclet_button")
 , unread_notifications("unread_notifications")
 , speaker("speaker")
 , new_message_icon("new_message_icon")
@@ -768,6 +786,10 @@ LLAdHocChiclet::LLAdHocChiclet(const Params& p)
 , mChicletIconCtrl(NULL)
 , mPopupMenu(NULL)
 {
+	LLButton::Params button_params = p.chiclet_button;
+	mChicletButton = LLUICtrlFactory::create<LLButton>(button_params);
+	addChild(mChicletButton);
+
 	LLIconCtrl::Params new_msg_params = p.new_message_icon;
 	mNewMessagesIcon = LLUICtrlFactory::create<LLIconCtrl>(new_msg_params);
 	addChild(mNewMessagesIcon);
@@ -882,6 +904,7 @@ BOOL LLAdHocChiclet::handleRightMouseDown(S32 x, S32 y, MASK mask)
 
 LLIMGroupChiclet::Params::Params()
 : group_icon("group_icon")
+, chiclet_button("chiclet_button")
 , unread_notifications("unread_notifications")
 , speaker("speaker")
 , new_message_icon("new_message_icon")
@@ -895,6 +918,10 @@ LLIMGroupChiclet::LLIMGroupChiclet(const Params& p)
 , mChicletIconCtrl(NULL)
 , mPopupMenu(NULL)
 {
+	LLButton::Params button_params = p.chiclet_button;
+	mChicletButton = LLUICtrlFactory::create<LLButton>(button_params);
+	addChild(mChicletButton);
+
 	LLIconCtrl::Params new_msg_params = p.new_message_icon;
 	mNewMessagesIcon = LLUICtrlFactory::create<LLIconCtrl>(new_msg_params);
 	addChild(mNewMessagesIcon);
@@ -1267,10 +1294,12 @@ void LLChicletPanel::onChicletClick(LLUICtrl*ctrl,const LLSD&param)
 
 void LLChicletPanel::removeChiclet(chiclet_list_t::iterator it)
 {
-	mScrollArea->removeChild(*it);
+	LLChiclet* chiclet = *it;
+	mScrollArea->removeChild(chiclet);
 	mChicletList.erase(it);
 	
 	arrange();
+	chiclet->die();
 }
 
 void LLChicletPanel::removeChiclet(S32 index)
@@ -1409,6 +1438,32 @@ S32	LLChicletPanel::notifyParent(const LLSD& info)
 	return LLPanel::notifyParent(info);
 }
 
+void LLChicletPanel::setChicletToggleState(const LLUUID& session_id, bool toggle)
+{
+	if(session_id.isNull())
+	{
+		llwarns << "Null Session ID" << llendl;
+	}
+
+	// toggle off all chiclets, except specified
+	S32 size = getChicletCount();
+	for(int n = 0; n < size; ++n)
+	{
+		LLIMChiclet* chiclet = getChiclet<LLIMChiclet>(n);
+		if(chiclet && chiclet->getSessionId() != session_id)
+		{
+			chiclet->setToggleState(false);
+		}
+	}
+
+	// toggle specified chiclet
+	LLIMChiclet* chiclet = findChiclet<LLIMChiclet>(session_id);
+	if(chiclet)
+	{
+		chiclet->setToggleState(toggle);
+	}
+}
+
 void LLChicletPanel::arrange()
 {
 	if(mChicletList.empty())
@@ -1801,6 +1856,7 @@ LLChicletSpeakerCtrl::LLChicletSpeakerCtrl(const Params&p)
 
 LLScriptChiclet::Params::Params()
  : icon("icon")
+ , chiclet_button("chiclet_button")
  , new_message_icon("new_message_icon")
 {
 }
@@ -1809,6 +1865,10 @@ LLScriptChiclet::LLScriptChiclet(const Params&p)
  : LLIMChiclet(p)
  , mChicletIconCtrl(NULL)
 {
+	LLButton::Params button_params = p.chiclet_button;
+	mChicletButton = LLUICtrlFactory::create<LLButton>(button_params);
+	addChild(mChicletButton);
+
 	LLIconCtrl::Params new_msg_params = p.new_message_icon;
 	mNewMessagesIcon = LLUICtrlFactory::create<LLIconCtrl>(new_msg_params);
 	addChild(mNewMessagesIcon);
@@ -1857,6 +1917,7 @@ static const std::string INVENTORY_USER_OFFER	("UserGiveItem");
 
 LLInvOfferChiclet::Params::Params()
  : icon("icon")
+ , chiclet_button("chiclet_button")
  , new_message_icon("new_message_icon")
 {
 }
@@ -1865,6 +1926,10 @@ LLInvOfferChiclet::LLInvOfferChiclet(const Params&p)
  : LLIMChiclet(p)
  , mChicletIconCtrl(NULL)
 {
+	LLButton::Params button_params = p.chiclet_button;
+	mChicletButton = LLUICtrlFactory::create<LLButton>(button_params);
+	addChild(mChicletButton);
+
 	LLIconCtrl::Params new_msg_params = p.new_message_icon;
 	mNewMessagesIcon = LLUICtrlFactory::create<LLIconCtrl>(new_msg_params);
 	addChild(mNewMessagesIcon);
diff --git a/indra/newview/llchiclet.h b/indra/newview/llchiclet.h
index 3665e4d0933..bb4846aa575 100644
--- a/indra/newview/llchiclet.h
+++ b/indra/newview/llchiclet.h
@@ -325,7 +325,7 @@ class LLIMChiclet : public LLChiclet
 	};
 
 	
-	/*virtual*/ ~LLIMChiclet() {};
+	virtual ~LLIMChiclet() {};
 
 	/**
 	 * Sets IM session name. This name will be displayed in chiclet tooltip.
@@ -422,6 +422,8 @@ class LLIMChiclet : public LLChiclet
 	 */
 	virtual void onMouseDown();
 
+	virtual void setToggleState(bool toggle);
+
 protected:
 
 	LLIMChiclet(const LLIMChiclet::Params& p);
@@ -438,7 +440,7 @@ class LLIMChiclet : public LLChiclet
 	LLIconCtrl* mNewMessagesIcon;
 	LLChicletNotificationCounterCtrl* mCounterCtrl;
 	LLChicletSpeakerCtrl* mSpeakerCtrl;
-
+	LLButton* mChicletButton;
 
 	/** the id of another participant, either an avatar id or a group id*/
 	LLUUID mOtherParticipantId;
@@ -473,6 +475,8 @@ class LLIMP2PChiclet : public LLIMChiclet
 public:
 	struct Params : public LLInitParam::Block<Params, LLIMChiclet::Params>
 	{
+		Optional<LLButton::Params> chiclet_button;
+
 		Optional<LLChicletAvatarIconCtrl::Params> avatar_icon;
 
 		Optional<LLChicletNotificationCounterCtrl::Params> unread_notifications;
@@ -538,6 +542,8 @@ class LLAdHocChiclet : public LLIMChiclet
 public:
 	struct Params : public LLInitParam::Block<Params, LLIMChiclet::Params>
 	{
+		Optional<LLButton::Params> chiclet_button;
+
 		Optional<LLChicletAvatarIconCtrl::Params> avatar_icon;
 
 		Optional<LLChicletNotificationCounterCtrl::Params> unread_notifications;
@@ -614,6 +620,8 @@ class LLScriptChiclet : public LLIMChiclet
 
 	struct Params : public LLInitParam::Block<Params, LLIMChiclet::Params>
 	{
+		Optional<LLButton::Params> chiclet_button;
+
 		Optional<LLIconCtrl::Params> icon;
 
 		Optional<LLIconCtrl::Params> new_message_icon;
@@ -656,6 +664,8 @@ class LLInvOfferChiclet: public LLIMChiclet
 
 	struct Params : public LLInitParam::Block<Params, LLIMChiclet::Params>
 	{
+		Optional<LLButton::Params> chiclet_button;
+
 		Optional<LLChicletInvOfferIconCtrl::Params> icon;
 
 		Optional<LLIconCtrl::Params> new_message_icon;
@@ -697,6 +707,8 @@ class LLIMGroupChiclet : public LLIMChiclet, public LLGroupMgrObserver
 
 	struct Params : public LLInitParam::Block<Params, LLIMChiclet::Params>
 	{
+		Optional<LLButton::Params> chiclet_button;
+
 		Optional<LLChicletGroupIconCtrl::Params> group_icon;
 
 		Optional<LLChicletNotificationCounterCtrl::Params> unread_notifications;
@@ -1040,6 +1052,11 @@ class LLChicletPanel : public LLPanel
 
 	S32	notifyParent(const LLSD& info);
 
+	/**
+	 * Toggle chiclet by session id ON and toggle OFF all other chiclets.
+	 */
+	void setChicletToggleState(const LLUUID& session_id, bool toggle);
+
 protected:
 	LLChicletPanel(const Params&p);
 	friend class LLUICtrlFactory;
diff --git a/indra/newview/llcompilequeue.cpp b/indra/newview/llcompilequeue.cpp
index eb9a2fec2fa..47f1b7c9f54 100644
--- a/indra/newview/llcompilequeue.cpp
+++ b/indra/newview/llcompilequeue.cpp
@@ -59,7 +59,6 @@
 
 #include "llbutton.h"
 #include "lldir.h"
-#include "llfloaterchat.h"
 #include "llnotificationsutil.h"
 #include "llviewerstats.h"
 #include "llvfile.h"
@@ -447,14 +446,20 @@ void LLFloaterCompileQueue::scriptArrived(LLVFS *vfs, const LLUUID& asset_id,
 
 		if( LL_ERR_ASSET_REQUEST_NOT_IN_DATABASE == status )
 		{
-			LLChat chat(LLTrans::getString("CompileQueueScriptNotFound"));
-			LLFloaterChat::addChat(chat);
+			//TODO* CHAT: how to show this?
+			//LLSD args;
+			//args["MESSAGE"] = LLTrans::getString("CompileQueueScriptNotFound);
+			//LLNotificationsUtil::add("SystemMessage", args);
+			
 			buffer = LLTrans::getString("CompileQueueProblemDownloading") + (": ") + data->mScriptName;
 		}
 		else if (LL_ERR_INSUFFICIENT_PERMISSIONS == status)
 		{
-			LLChat chat(LLTrans::getString("CompileQueueInsufficientPermDownload"));
-			LLFloaterChat::addChat(chat);
+			//TODO* CHAT: how to show this?
+			//LLSD args;
+			//args["MESSAGE"] = LLTrans::getString("CompileQueueScriptNotFound);
+			//LLNotificationsUtil::add("SystemMessage", args);
+
 			buffer = LLTrans::getString("CompileQueueInsufficientPermFor") + (": ") + data->mScriptName;
 		}
 		else
diff --git a/indra/newview/lldateutil.cpp b/indra/newview/lldateutil.cpp
index 10b7935caf0..abb2fdeb9a0 100644
--- a/indra/newview/lldateutil.cpp
+++ b/indra/newview/lldateutil.cpp
@@ -44,15 +44,18 @@ static S32 DAYS_PER_MONTH_LEAP[] =
 
 static S32 days_from_month(S32 year, S32 month)
 {
+	llassert_always(1 <= month);
+	llassert_always(month <= 12);
+
 	if (year % 4 == 0 
 		&& year % 100 != 0)
 	{
 		// leap year
-		return DAYS_PER_MONTH_LEAP[month];
+		return DAYS_PER_MONTH_LEAP[month - 1];
 	}
 	else
 	{
-		return DAYS_PER_MONTH_NOLEAP[month];
+		return DAYS_PER_MONTH_NOLEAP[month - 1];
 	}
 }
 
diff --git a/indra/newview/lldrawpoolbump.cpp b/indra/newview/lldrawpoolbump.cpp
index 5f845c3721d..03a8b108e29 100644
--- a/indra/newview/lldrawpoolbump.cpp
+++ b/indra/newview/lldrawpoolbump.cpp
@@ -1149,14 +1149,14 @@ void LLBumpImageList::onSourceLoaded( BOOL success, LLViewerTexture *src_vi, LLI
 			if (!LLPipeline::sRenderDeferred)
 			{
 				bump->setExplicitFormat(GL_ALPHA8, GL_ALPHA);
-				bump->createGLTexture(bump->getDiscardLevel(), dst_image);
+				bump->createGLTexture(0, dst_image);
 			}
 			else
 			{
 				LLPointer<LLImageRaw> nrm_image = new LLImageRaw(src->getWidth(), src->getHeight(), 4);
 				generateNormalMapFromAlpha(src, nrm_image);
 				bump->setExplicitFormat(GL_RGBA, GL_RGBA);
-				bump->createGLTexture(bump->getDiscardLevel(), nrm_image);
+				bump->createGLTexture(0, nrm_image);
 			}
 
 			
diff --git a/indra/newview/lldrawpoolwlsky.cpp b/indra/newview/lldrawpoolwlsky.cpp
index c14ca2473bb..c7cd77cb65e 100644
--- a/indra/newview/lldrawpoolwlsky.cpp
+++ b/indra/newview/lldrawpoolwlsky.cpp
@@ -159,15 +159,10 @@ void LLDrawPoolWLSky::renderStars(void) const
 	// *NOTE: have to have bound the cloud noise texture already since register
 	// combiners blending below requires something to be bound
 	// and we might as well only bind once.
-	//gGL.getTexUnit(0)->enable(LLTexUnit::TT_TEXTURE);
+	gGL.getTexUnit(0)->enable(LLTexUnit::TT_TEXTURE);
 	
 	gPipeline.disableLights();
-
-	if (!LLPipeline::sReflectionRender)
-	{
-		glPointSize(2.f);
-	}
-
+	
 	// *NOTE: we divide by two here and GL_ALPHA_SCALE by two below to avoid
 	// clamping and allow the star_alpha param to brighten the stars.
 	bool error;
@@ -175,16 +170,20 @@ void LLDrawPoolWLSky::renderStars(void) const
 	star_alpha.mV[3] = LLWLParamManager::instance()->mCurParams.getFloat("star_brightness", error) / 2.f;
 	llassert_always(!error);
 
+	gGL.getTexUnit(0)->bind(gSky.mVOSkyp->getBloomTex());
+
+	gGL.pushMatrix();
+	glRotatef(gFrameTimeSeconds*0.01f, 0.f, 0.f, 1.f);
 	// gl_FragColor.rgb = gl_Color.rgb;
 	// gl_FragColor.a = gl_Color.a * star_alpha.a;
-	gGL.getTexUnit(0)->setTextureColorBlend(LLTexUnit::TBO_REPLACE, LLTexUnit::TBS_PREV_COLOR);
-	gGL.getTexUnit(0)->setTextureAlphaBlend(LLTexUnit::TBO_MULT_X2, LLTexUnit::TBS_PREV_ALPHA, LLTexUnit::TBS_CONST_ALPHA);
+	gGL.getTexUnit(0)->setTextureColorBlend(LLTexUnit::TBO_MULT, LLTexUnit::TBS_TEX_COLOR, LLTexUnit::TBS_VERT_COLOR);
+	gGL.getTexUnit(0)->setTextureAlphaBlend(LLTexUnit::TBO_MULT_X2, LLTexUnit::TBS_CONST_ALPHA, LLTexUnit::TBS_TEX_ALPHA);
 	glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, star_alpha.mV);
 
 	gSky.mVOWLSkyp->drawStars();
 
-	glPointSize(1.f);
-
+	gGL.popMatrix();
+	
 	// and disable the combiner states
 	gGL.getTexUnit(0)->setTextureBlendType(LLTexUnit::TB_MULT);
 }
diff --git a/indra/newview/lldrawpoolwlsky.h b/indra/newview/lldrawpoolwlsky.h
index 7ff760ac395..9059f6382f1 100644
--- a/indra/newview/lldrawpoolwlsky.h
+++ b/indra/newview/lldrawpoolwlsky.h
@@ -43,7 +43,7 @@ class LLDrawPoolWLSky : public LLDrawPool {
 	static const U32 SKY_VERTEX_DATA_MASK =	LLVertexBuffer::MAP_VERTEX |
 							LLVertexBuffer::MAP_TEXCOORD0;
 	static const U32 STAR_VERTEX_DATA_MASK =	LLVertexBuffer::MAP_VERTEX |
-							LLVertexBuffer::MAP_COLOR;
+		LLVertexBuffer::MAP_COLOR | LLVertexBuffer::MAP_TEXCOORD0;
 
 	LLDrawPoolWLSky(void);
 	/*virtual*/ ~LLDrawPoolWLSky();
diff --git a/indra/newview/llfasttimerview.cpp b/indra/newview/llfasttimerview.cpp
index effa57b1efb..4fa97e789b3 100644
--- a/indra/newview/llfasttimerview.cpp
+++ b/indra/newview/llfasttimerview.cpp
@@ -314,7 +314,7 @@ void LLFastTimerView::draw()
 	S32 left, top, right, bottom;
 	S32 x, y, barw, barh, dx, dy;
 	S32 texth, textw;
-	LLPointer<LLUIImage> box_imagep = LLUI::getUIImage("rounded_square.tga");
+	LLPointer<LLUIImage> box_imagep = LLUI::getUIImage("Rounded_Square");
 
 	// Draw the window background
 	gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
@@ -323,7 +323,9 @@ void LLFastTimerView::draw()
 	S32 xleft = margin;
 	S32 ytop = margin;
 	
-	mAverageCyclesPerTimer = llround(lerp((F32)mAverageCyclesPerTimer, (F32)(LLFastTimer::sTimerCycles / (U64)LLFastTimer::sTimerCalls), 0.1f));
+	mAverageCyclesPerTimer = LLFastTimer::sTimerCalls == 0 
+		? 0 
+		: llround(lerp((F32)mAverageCyclesPerTimer, (F32)(LLFastTimer::sTimerCycles / (U64)LLFastTimer::sTimerCalls), 0.1f));
 	LLFastTimer::sTimerCycles = 0;
 	LLFastTimer::sTimerCalls = 0;
 
diff --git a/indra/newview/llfavoritesbar.cpp b/indra/newview/llfavoritesbar.cpp
index 6ae6b4877a2..fb94657278e 100644
--- a/indra/newview/llfavoritesbar.cpp
+++ b/indra/newview/llfavoritesbar.cpp
@@ -483,6 +483,10 @@ BOOL LLFavoritesBarCtrl::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
 
 				if (drop)
 				{
+					if (mItems.empty())
+					{
+						setLandingTab(NULL);
+					}
 					handleNewFavoriteDragAndDrop(item, favorites_id, x, y);
 					showDragMarker(FALSE);
 				}
@@ -508,14 +512,14 @@ void LLFavoritesBarCtrl::handleExistingFavoriteDragAndDrop(S32 x, S32 y)
 
 	if (dest)
 	{
-		updateItemsOrder(mItems, mDragItemId, dest->getLandmarkId());
+		LLInventoryModel::updateItemsOrder(mItems, mDragItemId, dest->getLandmarkId());
 	}
 	else
 	{
 		mItems.push_back(gInventory.getItem(mDragItemId));
 	}
 
-	saveItemsOrder(mItems);
+	gInventory.saveItemsOrder(mItems);
 
 	LLToggleableMenu* menu = (LLToggleableMenu*) mPopupMenuHandle.get();
 
@@ -644,7 +648,7 @@ LLXMLNodePtr LLFavoritesBarCtrl::getButtonXMLNode()
 	bool success = LLUICtrlFactory::getLayeredXMLNode("favorites_bar_button.xml", buttonXMLNode);
 	if (!success)
 	{
-		llwarns << "Unable to read xml file with button for Favorites Bar: favorites_bar_button.xml" << llendl;
+		llwarns << "Failed to create Favorites Bar button from favorites_bar_button.xml" << llendl;
 		buttonXMLNode = NULL;
 	}
 	return buttonXMLNode;
@@ -1193,25 +1197,6 @@ BOOL LLFavoritesBarCtrl::needToSaveItemsOrder(const LLInventoryModel::item_array
 	return result;
 }
 
-void LLFavoritesBarCtrl::saveItemsOrder(LLInventoryModel::item_array_t& items)
-{
-	int sortField = 0;
-
-	// current order is saved by setting incremental values (1, 2, 3, ...) for the sort field
-	for (LLInventoryModel::item_array_t::iterator i = items.begin(); i != items.end(); ++i)
-	{
-		LLViewerInventoryItem* item = *i;
-
-		item->setSortField(++sortField);
-		item->setComplete(TRUE);
-		item->updateServer(FALSE);
-
-		gInventory.updateItem(item);
-	}
-
-	gInventory.notifyObservers();
-}
-
 LLInventoryModel::item_array_t::iterator LLFavoritesBarCtrl::findItemByUUID(LLInventoryModel::item_array_t& items, const LLUUID& id)
 {
 	LLInventoryModel::item_array_t::iterator result = items.end();
@@ -1228,15 +1213,6 @@ LLInventoryModel::item_array_t::iterator LLFavoritesBarCtrl::findItemByUUID(LLIn
 	return result;
 }
 
-void LLFavoritesBarCtrl::updateItemsOrder(LLInventoryModel::item_array_t& items, const LLUUID& srcItemId, const LLUUID& destItemId)
-{
-	LLViewerInventoryItem* srcItem = gInventory.getItem(srcItemId);
-	LLViewerInventoryItem* destItem = gInventory.getItem(destItemId);
-
-	items.erase(findItemByUUID(items, srcItem->getUUID()));
-	items.insert(findItemByUUID(items, destItem->getUUID()), srcItem);
-}
-
 void LLFavoritesBarCtrl::insertBeforeItem(LLInventoryModel::item_array_t& items, const LLUUID& beforeItemId, LLViewerInventoryItem* insertedItem)
 {
 	LLViewerInventoryItem* beforeItem = gInventory.getItem(beforeItemId);
diff --git a/indra/newview/llfavoritesbar.h b/indra/newview/llfavoritesbar.h
index 9ac734baffd..40dd551eefc 100644
--- a/indra/newview/llfavoritesbar.h
+++ b/indra/newview/llfavoritesbar.h
@@ -126,16 +126,7 @@ class LLFavoritesBarCtrl : public LLUICtrl, public LLInventoryObserver
 	// checks if the current order of the favorites items must be saved
 	BOOL needToSaveItemsOrder(const LLInventoryModel::item_array_t& items);
 
-	// saves current order of the favorites items
-	void saveItemsOrder(LLInventoryModel::item_array_t& items);
-
-	/*
-	 * changes favorites items order by insertion of the item identified by srcItemId
-	 * BEFORE the item identified by destItemId. both items must exist in items array.
-	 */
-	void updateItemsOrder(LLInventoryModel::item_array_t& items, const LLUUID& srcItemId, const LLUUID& destItemId);
-
-	/*
+	/**
 	 * inserts an item identified by insertedItemId BEFORE an item identified by beforeItemId.
 	 * this function assumes that an item identified by insertedItemId doesn't exist in items array.
 	 */
diff --git a/indra/newview/llfirstuse.cpp b/indra/newview/llfirstuse.cpp
index 7fd0e070bef..b3fdf60b11a 100644
--- a/indra/newview/llfirstuse.cpp
+++ b/indra/newview/llfirstuse.cpp
@@ -45,6 +45,7 @@
 #include "llappviewer.h"
 #include "lltracker.h"
 
+/*
 // static
 std::set<std::string> LLFirstUse::sConfigVariables;
 
@@ -75,7 +76,8 @@ void LLFirstUse::resetFirstUse()
 		gWarningSettings.setBOOL(*iter, TRUE);
 	}
 }
-
+*/
+/*
 
 // Called whenever the viewer detects that your balance went up
 void LLFirstUse::useBalanceIncrease(S32 delta)
@@ -145,6 +147,8 @@ void LLFirstUse::useBuild()
 		LLNotificationsUtil::add("FirstBuild");
 	}
 }
+ 
+ */
 /*
 // static
 void LLFirstUse::useLeftClickNoHit()
@@ -157,6 +161,7 @@ void LLFirstUse::useLeftClickNoHit()
 	}
 }
 */
+/*
 // static
 void LLFirstUse::useTeleport()
 {
@@ -171,7 +176,7 @@ void LLFirstUse::useTeleport()
 		}
 	}
 }
-
+*/
 // static
 void LLFirstUse::useOverrideKeys()
 {
@@ -187,7 +192,7 @@ void LLFirstUse::useOverrideKeys()
 		}
 	}
 }
-
+/*
 // static
 void LLFirstUse::useAttach()
 {
@@ -216,6 +221,7 @@ void LLFirstUse::useInventory()
 	}
 }
 
+*/
 
 // static
 void LLFirstUse::useSandbox()
@@ -230,7 +236,7 @@ void LLFirstUse::useSandbox()
 		LLNotificationsUtil::add("FirstSandbox", args);
 	}
 }
-
+/*
 // static
 void LLFirstUse::useFlexible()
 {
@@ -277,3 +283,4 @@ void LLFirstUse::useMedia()
 		//LLNotificationsUtil::add("FirstMedia");
 	}
 }
+*/
diff --git a/indra/newview/llfirstuse.h b/indra/newview/llfirstuse.h
index 7b4f9f516fd..3c7551f6cbb 100644
--- a/indra/newview/llfirstuse.h
+++ b/indra/newview/llfirstuse.h
@@ -79,6 +79,7 @@ object or from inventory.
 class LLFirstUse
 {
 public:
+/*	
 	// Add a config variable to be reset on resetFirstUse()
 	static void addConfigVariable(const std::string& var);
 	
@@ -97,11 +98,16 @@ class LLFirstUse
 	static void useBuild();
 //	static void useLeftClickNoHit();
 	static void useTeleport();
+*/ 
 	static void useOverrideKeys();
+/*	
 	static void useAttach();
 	static void useAppearance();
 	static void useInventory();
+ */
 	static void useSandbox();
+	
+/*
 	static void useFlexible();
 	static void useDebugMenus();
 	static void useSculptedPrim();
@@ -109,6 +115,7 @@ class LLFirstUse
 	
 protected:
 	static std::set<std::string> sConfigVariables;
+*/
 };
 
 #endif
diff --git a/indra/newview/llfloaterabout.cpp b/indra/newview/llfloaterabout.cpp
index e80499688eb..ef69f39ad2d 100644
--- a/indra/newview/llfloaterabout.cpp
+++ b/indra/newview/llfloaterabout.cpp
@@ -167,20 +167,21 @@ BOOL LLFloaterAbout::postBuild()
 
 	// Now build the various pieces
 	support << getString("AboutHeader", args);
-	if (info.has("COMPILER"))
-	{
-		support << "\n\n" << getString("AboutCompiler", args);
-	}
 	if (info.has("REGION"))
 	{
 		support << "\n\n" << getString("AboutPosition", args);
 	}
 	support << "\n\n" << getString("AboutSystem", args);
+	support << "\n";
 	if (info.has("GRAPHICS_DRIVER_VERSION"))
 	{
-		support << "\n\n" << getString("AboutDriver", args);
+		support << "\n" << getString("AboutDriver", args);
+	}
+	support << "\n" << getString("AboutLibs", args);
+	if (info.has("COMPILER"))
+	{
+		support << "\n" << getString("AboutCompiler", args);
 	}
-	support << "\n\n" << getString("AboutLibs", args);
 	if (info.has("PACKETS_IN"))
 	{
 		support << '\n' << getString("AboutTraffic", args);
@@ -193,11 +194,11 @@ BOOL LLFloaterAbout::postBuild()
 	support_widget->blockUndo();
 
 	// Fix views
-	support_widget->setCursorPos(0);
 	support_widget->setEnabled(FALSE);
+	support_widget->startOfDoc();
 
-	credits_widget->setCursorPos(0);
 	credits_widget->setEnabled(FALSE);
+	credits_widget->startOfDoc();
 
 	return TRUE;
 }
@@ -268,7 +269,7 @@ LLSD LLFloaterAbout::getInfo()
 	info["VIVOX_VERSION"] = gVoiceClient ? gVoiceClient->getAPIVersion() : LLTrans::getString("NotConnected");
 
 	// TODO: Implement media plugin version query
-	info["QT_WEBKIT_VERSION"] = "4.5.2 (version number hard-coded)";
+	info["QT_WEBKIT_VERSION"] = "4.6 (version number hard-coded)";
 
 	if (gPacketsIn > 0)
 	{
diff --git a/indra/newview/llfloaterbulkpermission.cpp b/indra/newview/llfloaterbulkpermission.cpp
index 538b44c0565..5c3a54e34bb 100644
--- a/indra/newview/llfloaterbulkpermission.cpp
+++ b/indra/newview/llfloaterbulkpermission.cpp
@@ -48,7 +48,6 @@
 #include "llresmgr.h"
 #include "llbutton.h"
 #include "lldir.h"
-#include "llfloaterchat.h"
 #include "llviewerstats.h"
 #include "lluictrlfactory.h"
 #include "llselectmgr.h"
diff --git a/indra/newview/llfloatercamera.cpp b/indra/newview/llfloatercamera.cpp
index 764aff68c91..9496e947803 100644
--- a/indra/newview/llfloatercamera.cpp
+++ b/indra/newview/llfloatercamera.cpp
@@ -144,6 +144,11 @@ void  LLPanelCameraZoom::onSliderValueChanged()
 	mSavedSliderVal = val;
 }
 
+void activate_camera_tool()
+{
+	LLToolMgr::getInstance()->setTransientTool(LLToolCamera::getInstance());
+};
+
 //
 // Member functions
 //
@@ -151,7 +156,7 @@ void  LLPanelCameraZoom::onSliderValueChanged()
 /*static*/ bool LLFloaterCamera::inFreeCameraMode()
 {
 	LLFloaterCamera* floater_camera = LLFloaterCamera::findInstance();
-	if (floater_camera && floater_camera->mCurrMode == CAMERA_CTRL_MODE_FREE_CAMERA)
+	if (floater_camera && floater_camera->mCurrMode == CAMERA_CTRL_MODE_FREE_CAMERA && gAgent.getCameraMode() != CAMERA_MODE_MOUSELOOK)
 	{
 		return true;
 	}
@@ -177,27 +182,17 @@ void LLFloaterCamera::update()
 }
 
 
-/*static*/ void LLFloaterCamera::updateIfNotInAvatarViewMode()
-{
-	LLFloaterCamera* floater_camera = LLFloaterCamera::findInstance();
-	if (floater_camera && !floater_camera->inAvatarViewMode()) 
-	{
-		floater_camera->update();
-	}
-}
-
-
 void LLFloaterCamera::toPrevMode()
 {
 	switchMode(mPrevMode);
 }
 
-/*static*/ void LLFloaterCamera::toPrevModeIfInAvatarViewMode()
+/*static*/ void LLFloaterCamera::onLeavingMouseLook()
 {
 	LLFloaterCamera* floater_camera = LLFloaterCamera::findInstance();
-	if (floater_camera && floater_camera->inAvatarViewMode())
+	if (floater_camera && floater_camera->inFreeCameraMode())
 	{
-		floater_camera->toPrevMode();
+		activate_camera_tool();
 	}
 }
 
@@ -325,7 +320,7 @@ void LLFloaterCamera::switchMode(ECameraControlMode mode)
 		break;
 
 	case CAMERA_CTRL_MODE_FREE_CAMERA:
-		LLToolMgr::getInstance()->setTransientTool(LLToolCamera::getInstance());
+		activate_camera_tool();
 		break;
 
 	case CAMERA_CTRL_MODE_AVATAR_VIEW:
diff --git a/indra/newview/llfloatercamera.h b/indra/newview/llfloatercamera.h
index 5d44b4944d0..45d5e9a845a 100644
--- a/indra/newview/llfloatercamera.h
+++ b/indra/newview/llfloatercamera.h
@@ -61,7 +61,7 @@ class LLFloaterCamera
 	/* callback for camera presets changing */
 	static void onClickCameraPresets(const LLSD& param);
 
-	static void toPrevModeIfInAvatarViewMode();
+	static void onLeavingMouseLook();
 
 	/** resets current camera mode to orbit mode */
 	static void resetCameraMode();
@@ -69,8 +69,6 @@ class LLFloaterCamera
 	/* determines actual mode and updates ui */
 	void update();
 	
-	static void updateIfNotInAvatarViewMode();
-
 	virtual void onOpen(const LLSD& key);
 	virtual void onClose(bool app_quitting);
 
diff --git a/indra/newview/llfloaterchat.cpp b/indra/newview/llfloaterchat.cpp
index b9e0f928f14..cdb9b8edb86 100644
--- a/indra/newview/llfloaterchat.cpp
+++ b/indra/newview/llfloaterchat.cpp
@@ -37,8 +37,6 @@
 
 #include "llviewerprecompiledheaders.h"
 
-#include "llfloaterchat.h"
-
 // project include
 #include "llagent.h"
 #include "llappviewer.h"
@@ -190,7 +188,14 @@ void LLFloaterChat::addChatHistory(const LLChat& chat, bool log_to_file)
 {	
 	if (log_to_file && (gSavedPerAccountSettings.getBOOL("LogChat"))) 
 	{
-		LLLogChat::saveHistory("chat", chat.mFromName, chat.mFromID, chat.mText);
+		if (chat.mChatType != CHAT_TYPE_WHISPER && chat.mChatType != CHAT_TYPE_SHOUT)
+		{
+			LLLogChat::saveHistory("chat", chat.mFromName, chat.mFromID, chat.mText);
+		}
+		else
+		{
+			LLLogChat::saveHistory("chat", "", chat.mFromID, chat.mFromName + " " + chat.mText);
+		}
 	}
 	
 	LLColor4 color = get_text_color(chat);
@@ -306,27 +311,17 @@ void LLFloaterChat::onClickToggleShowMute(LLUICtrl* caller, void *data)
 }
 
 // Put a line of chat in all the right places
-void LLFloaterChat::addChat(const LLChat& chat, BOOL from_instant_message, BOOL local_agent)
+void LLFloaterChat::addChat(const LLChat& chat, BOOL local_agent)
 {
 	triggerAlerts(chat.mText);
 
 	// Add the sender to the list of people with which we've recently interacted.
-	if(chat.mSourceType == CHAT_SOURCE_AGENT && chat.mFromID.notNull())
-		LLRecentPeople::instance().add(chat.mFromID);
+	// this is not the best place to add _all_ messages to recent list
+	// comment this for now, may remove later on code cleanup
+	//if(chat.mSourceType == CHAT_SOURCE_AGENT && chat.mFromID.notNull())
+	//	LLRecentPeople::instance().add(chat.mFromID);
 	
-	bool add_chat = true;
-	bool log_chat = true;
-	if(from_instant_message)
-	{
-		if (!gSavedSettings.getBOOL("IMInChat"))
-			add_chat = false;
-		//log_chat = false;
-}
-	
-	if (add_chat)
-	{
-		addChatHistory(chat, log_chat);
-	}
+	addChatHistory(chat, true);
 }
 
 // Moved from lltextparser.cpp to break llui/llaudio library dependency.
diff --git a/indra/newview/llfloaterchat.h b/indra/newview/llfloaterchat.h
index 84fc199bfa9..4437a0a5c2d 100644
--- a/indra/newview/llfloaterchat.h
+++ b/indra/newview/llfloaterchat.h
@@ -61,7 +61,7 @@ class LLFloaterChat : public LLFloater
 	//  *TODO:Skinning - move these to LLChat (or LLViewerChat?)
 	// Add chat to console and history list.
 	// Color based on source, type, distance.
-	static void addChat(const LLChat& chat, BOOL from_im = FALSE, BOOL local_agent = FALSE);
+	static void addChat(const LLChat& chat, BOOL local_agent = FALSE);
 	// Add chat to history alone.
 	static void addChatHistory(const LLChat& chat, bool log_to_file = true);
 	
diff --git a/indra/newview/llfloaterchatterbox.cpp b/indra/newview/llfloaterchatterbox.cpp
index 9108cfb72bd..84b423399e2 100644
--- a/indra/newview/llfloaterchatterbox.cpp
+++ b/indra/newview/llfloaterchatterbox.cpp
@@ -38,7 +38,6 @@
 #include "llfloaterreg.h"
 #include "llfloaterchatterbox.h"
 #include "lluictrlfactory.h"
-#include "llfloaterchat.h"
 #include "llfloaterfriends.h"
 #include "llfloatergroups.h"
 #include "llviewercontrol.h"
@@ -134,22 +133,6 @@ BOOL LLFloaterChatterBox::postBuild()
 		addFloater(LLFloaterMyFriends::getInstance(), TRUE);
 	}
 
-	if (gSavedSettings.getBOOL("ChatHistoryTornOff"))
-	{
-		LLFloaterChat* floater_chat = LLFloaterChat::getInstance();
-		if(floater_chat)
-		{
-			// add then remove to set up relationship for re-attach
-			addFloater(floater_chat, FALSE);
-			removeFloater(floater_chat);
-			// reparent to floater view
-			gFloaterView->addChild(floater_chat);
-		}
-	}
-	else
-	{
-		addFloater(LLFloaterChat::getInstance(), FALSE);
-	}
 	mTabContainer->lockTabs();
 	return TRUE;
 }
@@ -230,8 +213,6 @@ void LLFloaterChatterBox::onOpen(const LLSD& key)
 	//*TODO:Skinning show the session id associated with key
 	if (key.asString() == "local")
 	{
-		LLFloaterChat* chat = LLFloaterReg::findTypedInstance<LLFloaterChat>("chat");
-		chat->openFloater();
 	}
 	else if (key.isDefined())
 	{
@@ -245,12 +226,6 @@ void LLFloaterChatterBox::onOpen(const LLSD& key)
 
 void LLFloaterChatterBox::onVisibilityChange ( const LLSD& new_visibility )
 {
-	// HACK: potentially need to toggle console
-	LLFloaterChat* instance = LLFloaterChat::getInstance();
-	if(instance)
-	{
-		instance->updateConsoleVisibility();
-	}
 }
 
 void LLFloaterChatterBox::removeFloater(LLFloater* floaterp)
@@ -349,8 +324,7 @@ LLFloater* LLFloaterChatterBox::getCurrentVoiceFloater()
 	}
 	if (LLVoiceChannelProximal::getInstance() == LLVoiceChannel::getCurrentVoiceChannel())
 	{
-		// show near me tab if in proximal channel
-		return LLFloaterChat::getInstance();
+		return NULL;
 	}
 	else
 	{
diff --git a/indra/newview/llfloatergesture.cpp b/indra/newview/llfloatergesture.cpp
index 5072bc8c820..de65c6f876c 100644
--- a/indra/newview/llfloatergesture.cpp
+++ b/indra/newview/llfloatergesture.cpp
@@ -110,7 +110,7 @@ LLFloaterGesture::LLFloaterGesture(const LLSD& key)
 
 	mCommitCallbackRegistrar.add("Gesture.Action.ToogleActiveState", boost::bind(&LLFloaterGesture::onActivateBtnClick, this));
 	mCommitCallbackRegistrar.add("Gesture.Action.ShowPreview", boost::bind(&LLFloaterGesture::onClickEdit, this));
-	mCommitCallbackRegistrar.add("Gesture.Action.CopyPast", boost::bind(&LLFloaterGesture::onCopyPastAction, this, _2));
+	mCommitCallbackRegistrar.add("Gesture.Action.CopyPaste", boost::bind(&LLFloaterGesture::onCopyPasteAction, this, _2));
 	mCommitCallbackRegistrar.add("Gesture.Action.SaveToCOF", boost::bind(&LLFloaterGesture::addToCurrentOutFit, this));
 
 	mEnableCallbackRegistrar.add("Gesture.EnableAction", boost::bind(&LLFloaterGesture::isActionEnabled, this, _2));
@@ -245,6 +245,7 @@ void LLFloaterGesture::refreshAll()
 
 void LLFloaterGesture::buildGestureList()
 {
+	S32 scroll_pos = mGestureList->getScrollPos();
 	std::vector<LLUUID> selected_items;
 	getSelectedIds(selected_items);
 	LL_DEBUGS("Gesture")<< "Rebuilding gesture list "<< LL_ENDL;
@@ -274,13 +275,14 @@ void LLFloaterGesture::buildGestureList()
 			}
 		}
 	}
+
 	// attempt to preserve scroll position through re-builds
-	// since we do re-build any time anything dirties
+	// since we do re-build whenever something gets dirty
 	for(std::vector<LLUUID>::iterator it = selected_items.begin(); it != selected_items.end(); it++)
 	{
 		mGestureList->selectByID(*it);
 	}
-	mGestureList->scrollToShowSelected();
+	mGestureList->setScrollPos(scroll_pos);
 }
 
 void LLFloaterGesture::addGesture(const LLUUID& item_id , LLMultiGesture* gesture,LLCtrlListInterface * list )
@@ -415,7 +417,7 @@ void LLFloaterGesture::onClickPlay()
 	LL_DEBUGS("Gesture")<<" Trying to play gesture id: "<< item_id <<LL_ENDL;
 	if(!LLGestureManager::instance().isGestureActive(item_id))
 	{
-		// we need to inform server about gesture activating to be consistent with LLPreviewGesture and  LLGestureComboBox.
+		// we need to inform server about gesture activating to be consistent with LLPreviewGesture and  LLGestureComboList.
 		BOOL inform_server = TRUE;
 		BOOL deactivate_similar = FALSE;
 		LLGestureManager::instance().setGestureLoadedCallback(item_id, boost::bind(&LLFloaterGesture::playGesture, this, item_id));
@@ -475,7 +477,7 @@ void LLFloaterGesture::onActivateBtnClick()
 	}
 }
 
-void LLFloaterGesture::onCopyPastAction(const LLSD& command)
+void LLFloaterGesture::onCopyPasteAction(const LLSD& command)
 {
 	std::string command_name  = command.asString();
 	// since we select this comman inventory item had  already arrived .
diff --git a/indra/newview/llfloatergesture.h b/indra/newview/llfloatergesture.h
index 14e132900df..629d77b949d 100644
--- a/indra/newview/llfloatergesture.h
+++ b/indra/newview/llfloatergesture.h
@@ -99,7 +99,7 @@ class LLFloaterGesture
 	void onClickPlay();
 	void onClickNew();
 	void onCommitList();
-	void onCopyPastAction(const LLSD& command);
+	void onCopyPasteAction(const LLSD& command);
 	void onDeleteSelected();
 
 	LLUUID mSelectedID;
diff --git a/indra/newview/llfloatergroups.cpp b/indra/newview/llfloatergroups.cpp
index 7cb925bc0b0..29f415bd439 100644
--- a/indra/newview/llfloatergroups.cpp
+++ b/indra/newview/llfloatergroups.cpp
@@ -247,14 +247,7 @@ void LLPanelGroups::enableButtons()
 		childDisable("IM");
 		childDisable("Leave");
 	}
-	if(gAgent.mGroups.count() < MAX_AGENT_GROUPS)
-	{
-		childEnable("Create");
-	}
-	else
-	{
-		childDisable("Create");
-	}
+	childSetEnabled("Create", gAgent.canJoinGroups());
 }
 
 
diff --git a/indra/newview/llfloaterinventory.cpp b/indra/newview/llfloaterinventory.cpp
index 76c0a7637c0..e62e2c99a7a 100644
--- a/indra/newview/llfloaterinventory.cpp
+++ b/indra/newview/llfloaterinventory.cpp
@@ -35,7 +35,7 @@
 #include "llfloaterinventory.h"
 
 #include "llagent.h"
-#include "llfirstuse.h"
+//#include "llfirstuse.h"
 #include "llfloaterreg.h"
 #include "llinventorymodel.h"
 #include "llpanelmaininventory.h"
@@ -135,5 +135,5 @@ void LLFloaterInventory::cleanup()
 
 void LLFloaterInventory::onOpen(const LLSD& key)
 {
-	LLFirstUse::useInventory();
+	//LLFirstUse::useInventory();
 }
diff --git a/indra/newview/llfloaterland.cpp b/indra/newview/llfloaterland.cpp
index 598a13de158..42c961a956b 100644
--- a/indra/newview/llfloaterland.cpp
+++ b/indra/newview/llfloaterland.cpp
@@ -276,6 +276,7 @@ void LLFloaterLand::refresh()
 	mPanelAudio->refresh();
 	mPanelMedia->refresh();
 	mPanelAccess->refresh();
+	mPanelCovenant->refresh();
 }
 
 
@@ -2795,12 +2796,6 @@ LLPanelLandCovenant::~LLPanelLandCovenant()
 {
 }
 
-BOOL LLPanelLandCovenant::postBuild()
-{
-	refresh();
-	return TRUE;
-}
-
 // virtual
 void LLPanelLandCovenant::refresh()
 {
diff --git a/indra/newview/llfloaterland.h b/indra/newview/llfloaterland.h
index d7d02ba1a37..a4785e8f5b0 100644
--- a/indra/newview/llfloaterland.h
+++ b/indra/newview/llfloaterland.h
@@ -391,7 +391,6 @@ class LLPanelLandCovenant
 public:
 	LLPanelLandCovenant(LLSafeHandle<LLParcelSelection>& parcelp);
 	virtual ~LLPanelLandCovenant();
-	virtual BOOL postBuild();
 	void refresh();
 	static void updateCovenantText(const std::string& string);
 	static void updateEstateName(const std::string& name);
diff --git a/indra/newview/llfloatermediasettings.cpp b/indra/newview/llfloatermediasettings.cpp
index 5cfd56193e3..976af121aed 100644
--- a/indra/newview/llfloatermediasettings.cpp
+++ b/indra/newview/llfloatermediasettings.cpp
@@ -192,6 +192,9 @@ void LLFloaterMediaSettings::initValues( const LLSD& media_settings, bool editab
 	sInstance->mPanelMediaSettingsGeneral->getValues( sInstance->mInitialValues );
 	sInstance->mPanelMediaSettingsSecurity->getValues( sInstance->mInitialValues );
 	sInstance->mPanelMediaSettingsPermissions->getValues( sInstance->mInitialValues );
+	
+	sInstance->mApplyBtn->setEnabled(editable);
+	sInstance->mOKBtn->setEnabled(editable);
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -266,8 +269,11 @@ const std::string LLFloaterMediaSettings::getHomeUrl()
 // virtual 
 void LLFloaterMediaSettings::draw()
 {
-	// Set the enabled state of the "Apply" button if values changed
-	childSetEnabled( "Apply", haveValuesChanged() );
+	if (NULL != mApplyBtn)
+	{
+		// Set the enabled state of the "Apply" button if values changed
+		mApplyBtn->setEnabled( haveValuesChanged() );
+	}
 	
 	LLFloater::draw();
 }
diff --git a/indra/newview/llfloaterpreference.cpp b/indra/newview/llfloaterpreference.cpp
index 11dd48056cc..fc036cb3548 100644
--- a/indra/newview/llfloaterpreference.cpp
+++ b/indra/newview/llfloaterpreference.cpp
@@ -51,7 +51,7 @@
 #include "lldirpicker.h"
 #include "llfeaturemanager.h"
 #include "llfocusmgr.h"
-#include "llfirstuse.h"
+//#include "llfirstuse.h"
 #include "llfloaterreg.h"
 #include "llfloaterabout.h"
 #include "llfloaterhardwaresettings.h"
@@ -185,8 +185,8 @@ void handleNameTagOptionChanged(const LLSD& newvalue);
 viewer_media_t get_web_media();
 bool callback_clear_browser_cache(const LLSD& notification, const LLSD& response);
 
-bool callback_skip_dialogs(const LLSD& notification, const LLSD& response, LLFloaterPreference* floater);
-bool callback_reset_dialogs(const LLSD& notification, const LLSD& response, LLFloaterPreference* floater);
+//bool callback_skip_dialogs(const LLSD& notification, const LLSD& response, LLFloaterPreference* floater);
+//bool callback_reset_dialogs(const LLSD& notification, const LLSD& response, LLFloaterPreference* floater);
 
 void fractionFromDecimal(F32 decimal_val, S32& numerator, S32& denominator);
 
@@ -236,7 +236,7 @@ void handleNameTagOptionChanged(const LLSD& newvalue)
 	}
 }
 
-bool callback_skip_dialogs(const LLSD& notification, const LLSD& response, LLFloaterPreference* floater)
+/*bool callback_skip_dialogs(const LLSD& notification, const LLSD& response, LLFloaterPreference* floater)
 {
 	S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
 	if (0 == option && floater )
@@ -244,7 +244,7 @@ bool callback_skip_dialogs(const LLSD& notification, const LLSD& response, LLFlo
 		if ( floater )
 		{
 			floater->setAllIgnored();
-			LLFirstUse::disableFirstUse();
+		//	LLFirstUse::disableFirstUse();
 			floater->buildPopupLists();
 		}
 	}
@@ -259,13 +259,13 @@ bool callback_reset_dialogs(const LLSD& notification, const LLSD& response, LLFl
 		if ( floater )
 		{
 			floater->resetAllIgnored();
-			LLFirstUse::resetFirstUse();
+			//LLFirstUse::resetFirstUse();
 			floater->buildPopupLists();
 		}
 	}
 	return false;
 }
-
+*/
 
 void fractionFromDecimal(F32 decimal_val, S32& numerator, S32& denominator)
 {
@@ -313,8 +313,8 @@ LLFloaterPreference::LLFloaterPreference(const LLSD& key)
 	mCommitCallbackRegistrar.add("Pref.SelectSkin",				boost::bind(&LLFloaterPreference::onSelectSkin, this));
 	mCommitCallbackRegistrar.add("Pref.VoiceSetKey",			boost::bind(&LLFloaterPreference::onClickSetKey, this));
 	mCommitCallbackRegistrar.add("Pref.VoiceSetMiddleMouse",	boost::bind(&LLFloaterPreference::onClickSetMiddleMouse, this));
-	mCommitCallbackRegistrar.add("Pref.ClickSkipDialogs",		boost::bind(&LLFloaterPreference::onClickSkipDialogs, this));
-	mCommitCallbackRegistrar.add("Pref.ClickResetDialogs",		boost::bind(&LLFloaterPreference::onClickResetDialogs, this));
+//	mCommitCallbackRegistrar.add("Pref.ClickSkipDialogs",		boost::bind(&LLFloaterPreference::onClickSkipDialogs, this));
+//	mCommitCallbackRegistrar.add("Pref.ClickResetDialogs",		boost::bind(&LLFloaterPreference::onClickResetDialogs, this));
 	mCommitCallbackRegistrar.add("Pref.ClickEnablePopup",		boost::bind(&LLFloaterPreference::onClickEnablePopup, this));
 	mCommitCallbackRegistrar.add("Pref.ClickDisablePopup",		boost::bind(&LLFloaterPreference::onClickDisablePopup, this));	
 	mCommitCallbackRegistrar.add("Pref.LogPath",				boost::bind(&LLFloaterPreference::onClickLogPath, this));
@@ -325,6 +325,8 @@ LLFloaterPreference::LLFloaterPreference(const LLSD& key)
 	mCommitCallbackRegistrar.add("Pref.WindowedMod",            boost::bind(&LLFloaterPreference::onCommitWindowedMode, this));	
 	mCommitCallbackRegistrar.add("Pref.UpdateSliderText",       boost::bind(&LLFloaterPreference::onUpdateSliderText,this, _1,_2));	
 	mCommitCallbackRegistrar.add("Pref.AutoDetectAspect",       boost::bind(&LLFloaterPreference::onCommitAutoDetectAspect, this));	
+	mCommitCallbackRegistrar.add("Pref.ParcelMediaAutoPlayEnable",       boost::bind(&LLFloaterPreference::onCommitParcelMediaAutoPlayEnable, this));	
+	mCommitCallbackRegistrar.add("Pref.MediaEnabled",           boost::bind(&LLFloaterPreference::onCommitMediaEnabled, this));	
 	mCommitCallbackRegistrar.add("Pref.onSelectAspectRatio",    boost::bind(&LLFloaterPreference::onKeystrokeAspectRatio, this));	
 	mCommitCallbackRegistrar.add("Pref.QualityPerformance",     boost::bind(&LLFloaterPreference::onChangeQuality, this, _2));	
 	mCommitCallbackRegistrar.add("Pref.applyUIColor",			boost::bind(&LLFloaterPreference::applyUIColor, this ,_1, _2));
@@ -601,8 +603,8 @@ void LLFloaterPreference::onBtnOK()
 		apply();
 		closeFloater(false);
 
-		gSavedSettings.saveToFile( gSavedSettings.getString("ClientSettingsFile"), TRUE );
 		LLUIColorTable::instance().saveUserSettings();
+		gSavedSettings.saveToFile( gSavedSettings.getString("ClientSettingsFile"), TRUE );
 		std::string crash_settings_filename = gDirUtilp->getExpandedFilename(LL_PATH_USER_SETTINGS, CRASH_SETTINGS_FILE);
 		// save all settings, even if equals defaults
 		gCrashSettings.saveToFile(crash_settings_filename, FALSE);
@@ -986,6 +988,27 @@ void LLFloaterPreference::onCommitAutoDetectAspect()
 	}
 }
 
+void LLFloaterPreference::onCommitParcelMediaAutoPlayEnable()
+{
+	BOOL autoplay = getChild<LLCheckBoxCtrl>("autoplay_enabled")->get();
+		
+	gSavedSettings.setBOOL(LLViewerMedia::AUTO_PLAY_MEDIA_SETTING, autoplay);
+
+	lldebugs << "autoplay now = " << int(autoplay) << llendl;
+}
+
+void LLFloaterPreference::onCommitMediaEnabled()
+{
+	LLCheckBoxCtrl *media_enabled_ctrl = getChild<LLCheckBoxCtrl>("media_enabled");
+	bool enabled = media_enabled_ctrl->get();
+	gSavedSettings.setBOOL("AudioStreamingVideo", enabled);
+	gSavedSettings.setBOOL("AudioStreamingMusic", enabled);
+	gSavedSettings.setBOOL("AudioStreamingMedia", enabled);
+	media_enabled_ctrl->setTentative(false);
+	// Update enabled state of the "autoplay" checkbox
+	getChild<LLCheckBoxCtrl>("autoplay_enabled")->setEnabled(enabled);
+}
+
 void LLFloaterPreference::refresh()
 {
 	LLPanel::refresh();
@@ -1050,7 +1073,7 @@ void LLFloaterPreference::onClickSetMiddleMouse()
 	// update the control right away since we no longer wait for apply
 	getChild<LLUICtrl>("modifier_combo")->onCommit();
 }
-
+/*
 void LLFloaterPreference::onClickSkipDialogs()
 {
 	LLNotificationsUtil::add("SkipShowNextTimeDialogs", LLSD(), LLSD(), boost::bind(&callback_skip_dialogs, _1, _2, this));
@@ -1060,6 +1083,7 @@ void LLFloaterPreference::onClickResetDialogs()
 {
 	LLNotificationsUtil::add("ResetShowNextTimeDialogs", LLSD(), LLSD(), boost::bind(&callback_reset_dialogs, _1, _2, this));
 }
+ */
 
 void LLFloaterPreference::onClickEnablePopup()
 {	
@@ -1399,6 +1423,20 @@ BOOL LLPanelPreference::postBuild()
 		refresh();
 	}
 	
+	//////////////////////PanelPrivacy ///////////////////
+	if(hasChild("media_enabled"))
+	{
+		bool video_enabled = gSavedSettings.getBOOL("AudioStreamingVideo");
+		bool music_enabled = gSavedSettings.getBOOL("AudioStreamingMusic");
+		bool media_enabled = gSavedSettings.getBOOL("AudioStreamingMedia");
+		bool enabled = video_enabled || music_enabled || media_enabled;
+		
+		LLCheckBoxCtrl *media_enabled_ctrl = getChild<LLCheckBoxCtrl>("media_enabled");	
+		media_enabled_ctrl->set(enabled);
+		media_enabled_ctrl->setTentative(!(video_enabled == music_enabled == media_enabled));
+		getChild<LLCheckBoxCtrl>("autoplay_enabled")->setEnabled(enabled);
+	}
+	
 	apply();
 	return true;
 }
diff --git a/indra/newview/llfloaterpreference.h b/indra/newview/llfloaterpreference.h
index 74a53d673c4..6f382620ee0 100644
--- a/indra/newview/llfloaterpreference.h
+++ b/indra/newview/llfloaterpreference.h
@@ -110,8 +110,8 @@ class LLFloaterPreference : public LLFloater
 	void onClickSetKey();
 	void setKey(KEY key);
 	void onClickSetMiddleMouse();
-	void onClickSkipDialogs();
-	void onClickResetDialogs();
+//	void onClickSkipDialogs();
+//	void onClickResetDialogs();
 	void onClickEnablePopup();
 	void onClickDisablePopup();	
 	void resetAllIgnored();
@@ -132,6 +132,8 @@ class LLFloaterPreference : public LLFloater
 //	void fractionFromDecimal(F32 decimal_val, S32& numerator, S32& denominator);
 
 	void onCommitAutoDetectAspect();
+	void onCommitParcelMediaAutoPlayEnable();
+	void onCommitMediaEnabled();
 	void applyResolution();
 	void applyUIColor(LLUICtrl* ctrl, const LLSD& param);
 	void getUIColor(LLUICtrl* ctrl, const LLSD& param);	
diff --git a/indra/newview/llfloaterregioninfo.cpp b/indra/newview/llfloaterregioninfo.cpp
index c4b87c1b2dc..03ff2cc3706 100644
--- a/indra/newview/llfloaterregioninfo.cpp
+++ b/indra/newview/llfloaterregioninfo.cpp
@@ -406,6 +406,11 @@ LLPanelEstateCovenant* LLFloaterRegionInfo::getPanelCovenant()
 
 void LLFloaterRegionInfo::refreshFromRegion(LLViewerRegion* region)
 {
+	if (!region)
+	{
+		return; 
+	}
+
 	// call refresh from region on all panels
 	std::for_each(
 		mInfoPanels.begin(),
@@ -1598,7 +1603,7 @@ std::string all_estates_text()
 	}
 	else if (region && region->getOwner() == gAgent.getID())
 	{
-		return LLTrans::getString("AllEstatesYouOwn");
+		return LLTrans::getString("RegionInfoAllEstatesYouOwn");
 	}
 	else if (region && region->isEstateManager())
 	{
diff --git a/indra/newview/llfloaterscriptlimits.cpp b/indra/newview/llfloaterscriptlimits.cpp
index 3042fbc6ec1..0964ad7f917 100644
--- a/indra/newview/llfloaterscriptlimits.cpp
+++ b/indra/newview/llfloaterscriptlimits.cpp
@@ -64,6 +64,8 @@
 // summary which only shows available & correct information
 #define USE_SIMPLE_SUMMARY
 
+const S32 SIZE_OF_ONE_KB = 1024;
+
 LLFloaterScriptLimits::LLFloaterScriptLimits(const LLSD& seed)
 	: LLFloater(seed)
 {
@@ -130,7 +132,6 @@ void LLFloaterScriptLimits::refresh()
 	}
 }
 
-
 ///----------------------------------------------------------------------------
 // Base class for panels
 ///----------------------------------------------------------------------------
@@ -331,6 +332,57 @@ void LLPanelScriptLimitsRegionMemory::setErrorStatus(U32 status, const std::stri
 	llerrs << "Can't handle remote parcel request."<< " Http Status: "<< status << ". Reason : "<< reason<<llendl;
 }
 
+// callback from the name cache with an owner name to add to the list
+void LLPanelScriptLimitsRegionMemory::onNameCache(
+						 const LLUUID& id,
+						 const std::string& first_name,
+						 const std::string& last_name)
+{
+	std::string name = first_name + " " + last_name;
+
+	LLScrollListCtrl *list = getChild<LLScrollListCtrl>("scripts_list");	
+	std::vector<LLSD>::iterator id_itor;
+	for (id_itor = mObjectListItems.begin(); id_itor != mObjectListItems.end(); ++id_itor)
+	{
+		LLSD element = *id_itor;
+		if(element["owner_id"].asUUID() == id)
+		{
+			LLScrollListItem* item = list->getItem(element["id"].asUUID());
+
+			if(item)
+			{
+				item->getColumn(2)->setValue(LLSD(name));
+				element["columns"][2]["value"] = name;
+			}
+		}
+	}
+
+	// fill in the url's tab if needed, all urls must have memory so we can do it all here
+	LLFloaterScriptLimits* instance = LLFloaterReg::getTypedInstance<LLFloaterScriptLimits>("script_limits");
+	if(instance)
+	{
+		LLTabContainer* tab = instance->getChild<LLTabContainer>("scriptlimits_panels");
+		LLPanelScriptLimitsRegionMemory* panel = (LLPanelScriptLimitsRegionMemory*)tab->getChild<LLPanel>("script_limits_region_urls_panel");
+
+		LLScrollListCtrl *list = panel->getChild<LLScrollListCtrl>("scripts_list");	
+		std::vector<LLSD>::iterator id_itor;
+		for (id_itor = mObjectListItems.begin(); id_itor != mObjectListItems.end(); ++id_itor)
+		{
+			LLSD element = *id_itor;
+			if(element["owner_id"].asUUID() == id)
+			{
+				LLScrollListItem* item = list->getItem(element["id"].asUUID());
+
+				if(item)
+				{
+					item->getColumn(2)->setValue(LLSD(name));
+					element["columns"][2]["value"] = name;
+				}
+			}
+		}
+	}
+}
+
 void LLPanelScriptLimitsRegionMemory::setRegionDetails(LLSD content)
 {
 	LLScrollListCtrl *list = getChild<LLScrollListCtrl>("scripts_list");
@@ -345,22 +397,40 @@ void LLPanelScriptLimitsRegionMemory::setRegionDetails(LLSD content)
 	S32 total_objects = 0;
 	S32 total_size = 0;
 
+	std::vector<LLUUID> names_requested;
+
 	for(S32 i = 0; i < number_parcels; i++)
 	{
 		std::string parcel_name = content["parcels"][i]["name"].asString();
-		
+		LLUUID parcel_id = content["parcels"][i]["id"].asUUID();
 		S32 number_objects = content["parcels"][i]["objects"].size();
 		for(S32 j = 0; j < number_objects; j++)
 		{
-			S32 size = content["parcels"][i]["objects"][j]["resources"]["memory"].asInteger() / 1024;
+			S32 size = content["parcels"][i]["objects"][j]["resources"]["memory"].asInteger() / SIZE_OF_ONE_KB;
 			total_size += size;
 			
 			std::string name_buf = content["parcels"][i]["objects"][j]["name"].asString();
 			LLUUID task_id = content["parcels"][i]["objects"][j]["id"].asUUID();
+			LLUUID owner_id = content["parcels"][i]["objects"][j]["owner_id"].asUUID();
+			
+			std::string owner_buf;
+			
+			BOOL name_is_cached = gCacheName->getFullName(owner_id, owner_buf);
+			if(!name_is_cached)
+			{
+				if(std::find(names_requested.begin(), names_requested.end(), owner_id) == names_requested.end())
+				{
+					names_requested.push_back(owner_id);
+					gCacheName->get(owner_id, TRUE,
+					boost::bind(&LLPanelScriptLimitsRegionMemory::onNameCache,
+						this, _1, _2, _3));
+				}
+			}
 
 			LLSD element;
 
 			element["id"] = task_id;
+			element["owner_id"] = owner_id;
 			element["columns"][0]["column"] = "size";
 			element["columns"][0]["value"] = llformat("%d", size);
 			element["columns"][0]["font"] = "SANSSERIF";
@@ -368,18 +438,18 @@ void LLPanelScriptLimitsRegionMemory::setRegionDetails(LLSD content)
 			element["columns"][1]["value"] = name_buf;
 			element["columns"][1]["font"] = "SANSSERIF";
 			element["columns"][2]["column"] = "owner";
-			element["columns"][2]["value"] = "";
+			element["columns"][2]["value"] = owner_buf;
 			element["columns"][2]["font"] = "SANSSERIF";
 			element["columns"][3]["column"] = "location";
 			element["columns"][3]["value"] = parcel_name;
 			element["columns"][3]["font"] = "SANSSERIF";
 
-			list->addElement(element);
-			mObjectListIDs.push_back(task_id);
+			list->addElement(element, ADD_SORTED);
+			mObjectListItems.push_back(element);
 			total_objects++;
 		}
 	}
-	
+
 	mParcelMemoryUsed =total_size;
 	mGotParcelMemoryUsed = TRUE;
 	populateParcelMemoryText();
@@ -556,7 +626,7 @@ void LLPanelScriptLimitsRegionMemory::clearList()
 	childSetValue("memory_used", LLSD(msg_empty_string));
 	childSetValue("parcels_listed", LLSD(msg_empty_string));
 
-	mObjectListIDs.clear();
+	mObjectListItems.clear();
 }
 
 // static
@@ -728,7 +798,7 @@ void LLPanelScriptLimitsRegionURLs::setRegionDetails(LLSD content)
 
 	S32 total_objects = 0;
 	S32 total_size = 0;
-
+	
 	for(S32 i = 0; i < number_parcels; i++)
 	{
 		std::string parcel_name = content["parcels"][i]["name"].asString();
@@ -744,6 +814,10 @@ void LLPanelScriptLimitsRegionURLs::setRegionDetails(LLSD content)
 				
 				std::string name_buf = content["parcels"][i]["objects"][j]["name"].asString();
 				LLUUID task_id = content["parcels"][i]["objects"][j]["id"].asUUID();
+				LLUUID owner_id = content["parcels"][i]["objects"][j]["owner_id"].asUUID();
+
+				std::string owner_buf;
+				gCacheName->getFullName(owner_id, owner_buf); //dont care if this fails as the memory tab will request and fill the field
 
 				LLSD element;
 
@@ -755,14 +829,14 @@ void LLPanelScriptLimitsRegionURLs::setRegionDetails(LLSD content)
 				element["columns"][1]["value"] = name_buf;
 				element["columns"][1]["font"] = "SANSSERIF";
 				element["columns"][2]["column"] = "owner";
-				element["columns"][2]["value"] = "";
+				element["columns"][2]["value"] = owner_buf;
 				element["columns"][2]["font"] = "SANSSERIF";
 				element["columns"][3]["column"] = "location";
 				element["columns"][3]["value"] = parcel_name;
 				element["columns"][3]["font"] = "SANSSERIF";
 
 				list->addElement(element);
-				mObjectListIDs.push_back(task_id);
+				mObjectListItems.push_back(element);
 				total_objects++;
 			}
 		}
@@ -868,7 +942,7 @@ void LLPanelScriptLimitsRegionURLs::clearList()
 	childSetValue("urls_used", LLSD(msg_empty_string));
 	childSetValue("parcels_listed", LLSD(msg_empty_string));
 
-	mObjectListIDs.clear();
+	mObjectListItems.clear();
 }
 
 // static
@@ -982,7 +1056,7 @@ void LLPanelScriptLimitsAttachment::setAttachmentDetails(LLSD content)
 			S32 size = 0;
 			if(content["attachments"][i]["objects"][j]["resources"].has("memory"))
 			{
-				size = content["attachments"][i]["objects"][j]["resources"]["memory"].asInteger();
+				size = content["attachments"][i]["objects"][j]["resources"]["memory"].asInteger() / SIZE_OF_ONE_KB;
 			}
 			S32 urls = 0;
 			if(content["attachments"][i]["objects"][j]["resources"].has("urls"))
@@ -1059,3 +1133,4 @@ void LLPanelScriptLimitsAttachment::onClickRefresh(void* userdata)
 		return;
 	}
 }
+
diff --git a/indra/newview/llfloaterscriptlimits.h b/indra/newview/llfloaterscriptlimits.h
index 88239136e37..7e2b536eb6b 100644
--- a/indra/newview/llfloaterscriptlimits.h
+++ b/indra/newview/llfloaterscriptlimits.h
@@ -54,12 +54,12 @@ class LLFloaterScriptLimits : public LLFloater
 
 	// from LLPanel
 	virtual void refresh();
-	
+
 private:
-	
+
 	LLFloaterScriptLimits(const LLSD& seed);
 	~LLFloaterScriptLimits();
-	
+
 protected:
 
 	LLTabContainer* mTab;
@@ -167,13 +167,17 @@ class LLPanelScriptLimitsRegionMemory : public LLPanelScriptLimitsInfo, LLRemote
 
 private:
 
+	void onNameCache(	 const LLUUID& id,
+						 const std::string& first_name,
+						 const std::string& last_name);
+
 	LLUUID mParcelId;
 	BOOL mGotParcelMemoryUsed;
 	BOOL mGotParcelMemoryMax;
 	S32 mParcelMemoryMax;
 	S32 mParcelMemoryUsed;
 	
-	std::vector<LLUUID> mObjectListIDs;
+	std::vector<LLSD> mObjectListItems;
 		
 protected:
 
@@ -218,7 +222,7 @@ class LLPanelScriptLimitsRegionURLs : public LLPanelScriptLimitsInfo
 	S32 mParcelURLsMax;
 	S32 mParcelURLsUsed;
 	
-	std::vector<LLUUID> mObjectListIDs;
+	std::vector<LLSD> mObjectListItems;
 		
 protected:
 	
diff --git a/indra/newview/llfloatersearch.cpp b/indra/newview/llfloatersearch.cpp
index c6d9fee6305..a7401fdb6f2 100644
--- a/indra/newview/llfloatersearch.cpp
+++ b/indra/newview/llfloatersearch.cpp
@@ -32,6 +32,9 @@
  */
 
 #include "llviewerprecompiledheaders.h"
+
+#include "llcommandhandler.h"
+#include "llfloaterreg.h"
 #include "llfloatersearch.h"
 #include "llmediactrl.h"
 #include "lllogininstance.h"
@@ -41,6 +44,42 @@
 #include "llviewercontrol.h"
 #include "llweb.h"
 
+// support secondlife:///app/search/{CATEGORY}/{QUERY} SLapps
+class LLSearchHandler : public LLCommandHandler
+{
+public:
+	// requires trusted browser to trigger
+	LLSearchHandler() : LLCommandHandler("search", UNTRUSTED_THROTTLE) { }
+	bool handle(const LLSD& tokens, const LLSD& query_map, LLMediaCtrl* web)
+	{
+		const size_t parts = tokens.size();
+
+		// get the (optional) category for the search
+		std::string category;
+		if (parts > 0)
+		{
+			category = tokens[0].asString();
+		}
+
+		// get the (optional) search string
+		std::string search_text;
+		if (parts > 1)
+		{
+			search_text = tokens[1].asString();
+		}
+
+		// create the LLSD arguments for the search floater
+		LLSD args;
+		args["category"] = category;
+		args["id"] = LLURI::unescape(search_text);
+
+		// open the search floater and perform the requested search
+		LLFloaterReg::showInstance("search", args);
+		return true;
+	}
+};
+LLSearchHandler gSearchHandler;
+
 LLFloaterSearch::LLFloaterSearch(const LLSD& key) :
 	LLFloater(key),
 	LLViewerMediaObserver(),
diff --git a/indra/newview/llfloatersettingsdebug.cpp b/indra/newview/llfloatersettingsdebug.cpp
index 8979575ef79..a6ffa5ec09d 100644
--- a/indra/newview/llfloatersettingsdebug.cpp
+++ b/indra/newview/llfloatersettingsdebug.cpp
@@ -34,7 +34,7 @@
 #include "llfloatersettingsdebug.h"
 #include "llfloater.h"
 #include "lluictrlfactory.h"
-#include "llfirstuse.h"
+//#include "llfirstuse.h"
 #include "llcombobox.h"
 #include "llspinctrl.h"
 #include "llcolorswatch.h"
diff --git a/indra/newview/llfloatersnapshot.cpp b/indra/newview/llfloatersnapshot.cpp
index f53b62e4903..afb58c94074 100644
--- a/indra/newview/llfloatersnapshot.cpp
+++ b/indra/newview/llfloatersnapshot.cpp
@@ -2078,8 +2078,10 @@ void LLFloaterSnapshot::draw()
 	{		
 		if(previewp->getThumbnailImage())
 		{
+			LLRect thumbnail_rect = getChild<LLUICtrl>("thumbnail_placeholder")->getRect();
+
 			S32 offset_x = (getRect().getWidth() - previewp->getThumbnailWidth()) / 2 ;
-			S32 offset_y = getRect().getHeight() - 205 + (90 - previewp->getThumbnailHeight()) / 2 ;
+			S32 offset_y = thumbnail_rect.mBottom + (thumbnail_rect.getHeight() - previewp->getThumbnailHeight()) / 2 ;
 
 			glMatrixMode(GL_MODELVIEW);
 			gl_draw_scaled_image(offset_x, offset_y, 
diff --git a/indra/newview/llfloatertools.cpp b/indra/newview/llfloatertools.cpp
index babef5b63df..241497aeafd 100644
--- a/indra/newview/llfloatertools.cpp
+++ b/indra/newview/llfloatertools.cpp
@@ -1134,7 +1134,8 @@ void LLFloaterTools::getMediaState()
 				}
 				// XXX DISABLE this for now, because when the fetch finally 
 				// does come in, the state of this floater doesn't properly
-				// update.  This needs more thought.
+				// update.  Re-selecting fixes the problem, but there is 
+				// contention as to whether this is a sufficient solution.
 //				if (object->isMediaDataBeingFetched())
 //				{
 //					LL_INFOS("LLFloaterTools: media")
@@ -1221,10 +1222,10 @@ void LLFloaterTools::getMediaState()
 			mNeedMediaTitle = false;
 		}
 		
-		childSetEnabled("media_tex",  bool_has_media & editable);
-		childSetEnabled( "edit_media", bool_has_media & editable );
-		childSetEnabled( "delete_media", bool_has_media & editable );
-		childSetEnabled( "add_media", ( ! bool_has_media ) & editable );
+		childSetEnabled("media_tex",  bool_has_media && editable);
+		childSetEnabled( "edit_media", bool_has_media && LLFloaterMediaSettings::getInstance()->mIdenticalHasMediaInfo && editable );
+		childSetEnabled( "delete_media", bool_has_media && editable );
+		childSetEnabled( "add_media", ( ! bool_has_media ) && editable );
 			// TODO: display a list of all media on the face - use 'identical' flag
 	}
 	else // not all face has media but at least one does.
@@ -1252,7 +1253,7 @@ void LLFloaterTools::getMediaState()
 		}
 		
 		childSetEnabled("media_tex",  TRUE);
-		childSetEnabled( "edit_media", TRUE);
+		childSetEnabled( "edit_media", LLFloaterMediaSettings::getInstance()->mIdenticalHasMediaInfo);
 		childSetEnabled( "delete_media", TRUE);
 		childSetEnabled( "add_media", FALSE );
 	}
@@ -1269,18 +1270,15 @@ void LLFloaterTools::getMediaState()
 // called when a user wants to add media to a prim or prim face
 void LLFloaterTools::onClickBtnAddMedia()
 {
-	// check for the edit tool and now many faces are selected
-	LLTool *tool = LLToolMgr::getInstance()->getCurrentTool();
-	if((tool != LLToolFace::getInstance()) || LLSelectMgr::getInstance()->getSelection()->isMultipleTESelected())
+	// check if multiple faces are selected
+	if(LLSelectMgr::getInstance()->getSelection()->isMultipleTESelected())
 	{
-		LLNotificationsUtil::add("MultipleFacesSelected",LLSD(), LLSD(), multipleFacesSelectedConfirm);
-		
+		LLNotificationsUtil::add("MultipleFacesSelected", LLSD(), LLSD(), multipleFacesSelectedConfirm);
 	}
 	else
 	{
 		onClickBtnEditMedia();
 	}
-
 }
 
 // static
@@ -1423,7 +1421,7 @@ void LLFloaterTools::updateMediaSettings()
             return mMediaEntry.getControls();
         };
 		
-		const LLMediaEntry & mMediaEntry;
+		const LLMediaEntry &mMediaEntry;
 		
     } func_controls(default_media_data);
     identical = selected_objects->getSelectedTEValue( &func_controls, value_u8 );
@@ -1446,7 +1444,7 @@ void LLFloaterTools::updateMediaSettings()
             return mMediaEntry.getFirstClickInteract();
         };
 		
-		const LLMediaEntry & mMediaEntry;
+		const LLMediaEntry &mMediaEntry;
 		
     } func_first_click(default_media_data);
     identical = selected_objects->getSelectedTEValue( &func_first_click, value_bool );
@@ -1469,7 +1467,7 @@ void LLFloaterTools::updateMediaSettings()
             return mMediaEntry.getHomeURL();
         };
 		
-		const LLMediaEntry &  mMediaEntry;
+		const LLMediaEntry &mMediaEntry;
 		
     } func_home_url(default_media_data);
     identical = selected_objects->getSelectedTEValue( &func_home_url, value_str );
@@ -1492,7 +1490,7 @@ void LLFloaterTools::updateMediaSettings()
             return mMediaEntry.getCurrentURL();
         };
 		
-		const LLMediaEntry &  mMediaEntry;
+		const LLMediaEntry &mMediaEntry;
 		
     } func_current_url(default_media_data);
     identical = selected_objects->getSelectedTEValue( &func_current_url, value_str );
@@ -1516,7 +1514,7 @@ void LLFloaterTools::updateMediaSettings()
             return mMediaEntry.getAutoZoom();
         };
 		
-		const LLMediaEntry &  mMediaEntry;
+		const LLMediaEntry &mMediaEntry;
 		
     } func_auto_zoom(default_media_data);
     identical = selected_objects->getSelectedTEValue( &func_auto_zoom, value_bool );
@@ -1539,7 +1537,7 @@ void LLFloaterTools::updateMediaSettings()
             return mMediaEntry.getAutoPlay();
         };
 		
-		const LLMediaEntry &  mMediaEntry;
+		const LLMediaEntry &mMediaEntry;
 		
     } func_auto_play(default_media_data);
     identical = selected_objects->getSelectedTEValue( &func_auto_play, value_bool );
@@ -1563,7 +1561,7 @@ void LLFloaterTools::updateMediaSettings()
             return mMediaEntry.getAutoScale();;
         };
 		
-		const LLMediaEntry &  mMediaEntry;
+		const LLMediaEntry &mMediaEntry;
 		
     } func_auto_scale(default_media_data);
     identical = selected_objects->getSelectedTEValue( &func_auto_scale, value_bool );
@@ -1586,7 +1584,7 @@ void LLFloaterTools::updateMediaSettings()
             return mMediaEntry.getAutoLoop();
         };
 		
-		const LLMediaEntry &  mMediaEntry;
+		const LLMediaEntry &mMediaEntry;
 		
     } func_auto_loop(default_media_data);
     identical = selected_objects->getSelectedTEValue( &func_auto_loop, value_bool );
@@ -1609,7 +1607,7 @@ void LLFloaterTools::updateMediaSettings()
             return mMediaEntry.getWidthPixels();
         };
 		
-		const LLMediaEntry &  mMediaEntry;
+		const LLMediaEntry &mMediaEntry;
 		
     } func_width_pixels(default_media_data);
     identical = selected_objects->getSelectedTEValue( &func_width_pixels, value_int );
@@ -1632,7 +1630,7 @@ void LLFloaterTools::updateMediaSettings()
             return mMediaEntry.getHeightPixels();
         };
 		
-		const LLMediaEntry &  mMediaEntry;
+		const LLMediaEntry &mMediaEntry;
 		
     } func_height_pixels(default_media_data);
     identical = selected_objects->getSelectedTEValue( &func_height_pixels, value_int );
@@ -1655,7 +1653,7 @@ void LLFloaterTools::updateMediaSettings()
             return mMediaEntry.getAltImageEnable();
         };
 		
-		const LLMediaEntry &  mMediaEntry;
+		const LLMediaEntry &mMediaEntry;
 		
     } func_enable_alt_image(default_media_data);
     identical = selected_objects->getSelectedTEValue( &func_enable_alt_image, value_bool );
@@ -1678,7 +1676,7 @@ void LLFloaterTools::updateMediaSettings()
             return 0 != ( mMediaEntry.getPermsInteract() & LLMediaEntry::PERM_OWNER );
         };
 		
-		const LLMediaEntry &  mMediaEntry;
+		const LLMediaEntry &mMediaEntry;
 		
     } func_perms_owner_interact(default_media_data);
     identical = selected_objects->getSelectedTEValue( &func_perms_owner_interact, value_bool );
@@ -1701,7 +1699,7 @@ void LLFloaterTools::updateMediaSettings()
             return 0 != ( mMediaEntry.getPermsControl() & LLMediaEntry::PERM_OWNER );
         };
 		
-		const LLMediaEntry &  mMediaEntry;
+		const LLMediaEntry &mMediaEntry;
 		
     } func_perms_owner_control(default_media_data);
     identical = selected_objects ->getSelectedTEValue( &func_perms_owner_control, value_bool );
@@ -1724,7 +1722,7 @@ void LLFloaterTools::updateMediaSettings()
             return 0 != ( mMediaEntry.getPermsInteract() & LLMediaEntry::PERM_GROUP );
         };
 		
-		const LLMediaEntry &  mMediaEntry;
+		const LLMediaEntry &mMediaEntry;
 		
     } func_perms_group_interact(default_media_data);
     identical = selected_objects->getSelectedTEValue( &func_perms_group_interact, value_bool );
@@ -1747,7 +1745,7 @@ void LLFloaterTools::updateMediaSettings()
             return 0 != ( mMediaEntry.getPermsControl() & LLMediaEntry::PERM_GROUP );
         };
 		
-		const LLMediaEntry &  mMediaEntry;
+		const LLMediaEntry &mMediaEntry;
 		
     } func_perms_group_control(default_media_data);
     identical = selected_objects->getSelectedTEValue( &func_perms_group_control, value_bool );
@@ -1770,7 +1768,7 @@ void LLFloaterTools::updateMediaSettings()
             return 0 != ( mMediaEntry.getPermsInteract() & LLMediaEntry::PERM_ANYONE );
         };
 		
-		const LLMediaEntry &  mMediaEntry;
+		const LLMediaEntry &mMediaEntry;
 		
     } func_perms_anyone_interact(default_media_data);
     identical = LLSelectMgr::getInstance()->getSelection()->getSelectedTEValue( &func_perms_anyone_interact, value_bool );
@@ -1793,7 +1791,7 @@ void LLFloaterTools::updateMediaSettings()
             return 0 != ( mMediaEntry.getPermsControl() & LLMediaEntry::PERM_ANYONE );
         };
 		
-		const LLMediaEntry &  mMediaEntry;
+		const LLMediaEntry &mMediaEntry;
 		
     } func_perms_anyone_control(default_media_data);
     identical = selected_objects->getSelectedTEValue( &func_perms_anyone_control, value_bool );
@@ -1816,7 +1814,7 @@ void LLFloaterTools::updateMediaSettings()
             return mMediaEntry.getWhiteListEnable();
         };
 		
-		const LLMediaEntry &  mMediaEntry;
+		const LLMediaEntry &mMediaEntry;
 		
     } func_whitelist_enable(default_media_data);
     identical = selected_objects->getSelectedTEValue( &func_whitelist_enable, value_bool );
@@ -1839,7 +1837,7 @@ void LLFloaterTools::updateMediaSettings()
             return mMediaEntry.getWhiteList();
         };
 		
-		const LLMediaEntry &  mMediaEntry;
+		const LLMediaEntry &mMediaEntry;
 		
     } func_whitelist_urls(default_media_data);
     identical = selected_objects->getSelectedTEValue( &func_whitelist_urls, value_vector_str );
diff --git a/indra/newview/llfloatervoicedevicesettings.cpp b/indra/newview/llfloatervoicedevicesettings.cpp
index 43024a4bd03..638c9f1b8c8 100644
--- a/indra/newview/llfloatervoicedevicesettings.cpp
+++ b/indra/newview/llfloatervoicedevicesettings.cpp
@@ -110,32 +110,33 @@ void LLPanelVoiceDeviceSettings::draw()
 
 	LLPanel::draw();
 
-	F32 voice_power = gVoiceClient->tuningGetEnergy();
-	S32 discrete_power = 0;
-
-	if (!is_in_tuning_mode)
-	{
-		discrete_power = 0;
-	}
-	else
-	{
-		discrete_power = llmin(4, llfloor((voice_power / LLVoiceClient::OVERDRIVEN_POWER_LEVEL) * 4.f));
-	}
-	
 	if (is_in_tuning_mode)
 	{
-		for(S32 power_bar_idx = 0; power_bar_idx < 5; power_bar_idx++)
+		const S32 num_bars = 5;
+		F32 voice_power = gVoiceClient->tuningGetEnergy() / LLVoiceClient::OVERDRIVEN_POWER_LEVEL;
+		S32 discrete_power = llmin(num_bars, llfloor(voice_power * (F32)num_bars + 0.1f));
+
+		for(S32 power_bar_idx = 0; power_bar_idx < num_bars; power_bar_idx++)
 		{
 			std::string view_name = llformat("%s%d", "bar", power_bar_idx);
 			LLView* bar_view = getChild<LLView>(view_name);
 			if (bar_view)
 			{
+				gl_rect_2d(bar_view->getRect(), LLColor4::grey, TRUE);
+
+				LLColor4 color;
 				if (power_bar_idx < discrete_power)
 				{
-					LLColor4 color = (power_bar_idx >= 3) ? LLUIColorTable::instance().getColor("OverdrivenColor") : LLUIColorTable::instance().getColor("SpeakingColor");
-					gl_rect_2d(bar_view->getRect(), color, TRUE);
+					color = (power_bar_idx >= 3) ? LLUIColorTable::instance().getColor("OverdrivenColor") : LLUIColorTable::instance().getColor("SpeakingColor");
+				}
+				else
+				{
+					color = LLUIColorTable::instance().getColor("PanelFocusBackgroundColor");
 				}
-				gl_rect_2d(bar_view->getRect(), LLColor4::grey, FALSE);
+
+				LLRect color_rect = bar_view->getRect();
+				color_rect.stretch(-1);
+				gl_rect_2d(color_rect, color, TRUE);
 			}
 		}
 	}
@@ -276,7 +277,10 @@ void LLPanelVoiceDeviceSettings::initialize()
 
 void LLPanelVoiceDeviceSettings::cleanup()
 {
-	gVoiceClient->tuningStop();
+	if (gVoiceClient)
+	{
+		gVoiceClient->tuningStop();
+	}
 	LLVoiceChannel::resume();
 }
 
diff --git a/indra/newview/llfloaterworldmap.cpp b/indra/newview/llfloaterworldmap.cpp
index 98f9171237a..f4d4ea3553e 100644
--- a/indra/newview/llfloaterworldmap.cpp
+++ b/indra/newview/llfloaterworldmap.cpp
@@ -47,7 +47,7 @@
 #include "llviewercontrol.h"
 #include "llcommandhandler.h"
 #include "lldraghandle.h"
-#include "llfirstuse.h"
+//#include "llfirstuse.h"
 #include "llfloaterreg.h"		// getTypedInstance()
 #include "llfocusmgr.h"
 #include "llinventorymodel.h"
@@ -100,8 +100,6 @@ enum EPanDirection
 // Values in pixels per region
 static const F32 ZOOM_MAX = 128.f;
 
-static const F32 SIM_COORD_DEFAULT = 128.f;
-
 //---------------------------------------------------------------------------
 // Globals
 //---------------------------------------------------------------------------
@@ -118,9 +116,12 @@ class LLWorldMapHandler : public LLCommandHandler
 	{
 		if (params.size() == 0)
 		{
-			return false;
+			// support the secondlife:///app/worldmap SLapp
+			LLFloaterReg::showInstance("world_map", "center");
+			return true;
 		}
 
+		// support the secondlife:///app/worldmap/{LOCATION}/{COORDS} SLapp
 		const std::string region_name = params[0].asString();
 		S32 x = (params.size() > 1) ? params[1].asInteger() : 128;
 		S32 y = (params.size() > 2) ? params[2].asInteger() : 128;
@@ -189,7 +190,8 @@ LLFloaterWorldMap::LLFloaterWorldMap(const LLSD& key)
 	mInventory(NULL),
 	mInventoryObserver(NULL),
 	mFriendObserver(NULL),
-	mCompletingRegionName(""),
+	mCompletingRegionName(),
+	mCompletingRegionPos(),
 	mWaitingForTracker(FALSE),
 	mIsClosing(FALSE),
 	mSetToUserPosition(TRUE),
@@ -205,7 +207,6 @@ LLFloaterWorldMap::LLFloaterWorldMap(const LLSD& key)
 	mCommitCallbackRegistrar.add("WMap.AvatarCombo",	boost::bind(&LLFloaterWorldMap::onAvatarComboCommit, this));
 	mCommitCallbackRegistrar.add("WMap.Landmark",		boost::bind(&LLFloaterWorldMap::onLandmarkComboCommit, this));
 	mCommitCallbackRegistrar.add("WMap.SearchResult",	boost::bind(&LLFloaterWorldMap::onCommitSearchResult, this));
-	mCommitCallbackRegistrar.add("WMap.CommitLocation",	boost::bind(&LLFloaterWorldMap::onCommitLocation, this));
 	mCommitCallbackRegistrar.add("WMap.GoHome",			boost::bind(&LLFloaterWorldMap::onGoHome, this));	
 	mCommitCallbackRegistrar.add("WMap.Teleport",		boost::bind(&LLFloaterWorldMap::onClickTeleportBtn, this));	
 	mCommitCallbackRegistrar.add("WMap.ShowTarget",		boost::bind(&LLFloaterWorldMap::onShowTargetBtn, this));	
@@ -316,7 +317,7 @@ void LLFloaterWorldMap::onOpen(const LLSD& key)
 		adjustZoomSliderBounds();
 
 		// Could be first show
-		LLFirstUse::useMap();
+		//LLFirstUse::useMap();
 
 		// Start speculative download of landmarks
 		const LLUUID landmark_folder_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_LANDMARK);
@@ -664,10 +665,6 @@ void LLFloaterWorldMap::updateLocation()
 				S32 agent_y = llround( (F32)fmod( agentPos.mdV[VY], (F64)REGION_WIDTH_METERS ) );
 				S32 agent_z = llround( (F32)agentPos.mdV[VZ] );
 
-				childSetValue("spin x", LLSD(agent_x) );
-				childSetValue("spin y", LLSD(agent_y) );
-				childSetValue("spin z", LLSD(agent_z) );
-
 				// Set the current SLURL
 				mSLURL = LLSLURL::buildSLURL(agent_sim_name, agent_x, agent_y, agent_z);
 			}
@@ -699,9 +696,6 @@ void LLFloaterWorldMap::updateLocation()
 		
 		F32 region_x = (F32)fmod( pos_global.mdV[VX], (F64)REGION_WIDTH_METERS );
 		F32 region_y = (F32)fmod( pos_global.mdV[VY], (F64)REGION_WIDTH_METERS );
-		childSetValue("spin x", LLSD(region_x) );
-		childSetValue("spin y", LLSD(region_y) );
-		childSetValue("spin z", LLSD((F32)pos_global.mdV[VZ]) );
 
 		// simNameFromPosGlobal can fail, so don't give the user an invalid SLURL
 		if ( gotSimName )
@@ -733,9 +727,11 @@ void LLFloaterWorldMap::trackURL(const std::string& region_name, S32 x_coord, S3
 	{
 		// fill in UI based on URL
 		gFloaterWorldMap->childSetValue("location", region_name);
-		childSetValue("spin x", LLSD((F32)x_coord));
-		childSetValue("spin y", LLSD((F32)y_coord));
-		childSetValue("spin z", LLSD((F32)z_coord));
+
+		// Save local coords to highlight position after region global
+		// position is returned.
+		gFloaterWorldMap->mCompletingRegionPos.set(
+			(F32)x_coord, (F32)y_coord, (F32)z_coord);
 
 		// pass sim name to combo box
 		gFloaterWorldMap->mCompletingRegionName = region_name;
@@ -899,18 +895,6 @@ void LLFloaterWorldMap::clearLocationSelection(BOOL clear_ui)
 	{
 		list->operateOnAll(LLCtrlListInterface::OP_DELETE);
 	}
-	if (!childHasKeyboardFocus("spin x"))
-	{
-		childSetValue("spin x", SIM_COORD_DEFAULT);
-	}
-	if (!childHasKeyboardFocus("spin y"))
-	{
-		childSetValue("spin y", SIM_COORD_DEFAULT);
-	}
-	if (!childHasKeyboardFocus("spin z"))
-	{
-		childSetValue("spin z", 0);
-	}
 	LLWorldMap::getInstance()->cancelTracking();
 	mCompletingRegionName = "";
 }
@@ -1466,21 +1450,6 @@ void LLFloaterWorldMap::updateSims(bool found_null_sim)
 	}
 }
 
-void LLFloaterWorldMap::onCommitLocation()
-{
-	LLTracker::ETrackingStatus tracking_status = LLTracker::getTrackingStatus();
-	if ( LLTracker::TRACKING_LOCATION == tracking_status)
-	{
-		LLVector3d pos_global = LLTracker::getTrackedPositionGlobal();
-		F64 local_x = childGetValue("spin x");
-		F64 local_y = childGetValue("spin y");
-		F64 local_z = childGetValue("spin z");
-		pos_global.mdV[VX] += -fmod(pos_global.mdV[VX], 256.0) + local_x;
-		pos_global.mdV[VY] += -fmod(pos_global.mdV[VY], 256.0) + local_y;
-		pos_global.mdV[VZ] = local_z;
-		trackLocation(pos_global);
-	}
-}
 
 void LLFloaterWorldMap::onCommitSearchResult()
 {
@@ -1503,12 +1472,19 @@ void LLFloaterWorldMap::onCommitSearchResult()
 		if (info->isName(sim_name))
 		{
 			LLVector3d pos_global = info->getGlobalOrigin();
-			F64 local_x = childGetValue("spin x");
-			F64 local_y = childGetValue("spin y");
-			F64 local_z = childGetValue("spin z");
-			pos_global.mdV[VX] += local_x;
-			pos_global.mdV[VY] += local_y;
-			pos_global.mdV[VZ] = local_z;
+
+			const F64 SIM_COORD_DEFAULT = 128.0;
+			LLVector3 pos_local(SIM_COORD_DEFAULT, SIM_COORD_DEFAULT, 0.0f);
+
+			// Did this value come from a trackURL() request?
+			if (!mCompletingRegionPos.isExactlyZero())
+			{
+				pos_local = mCompletingRegionPos;
+				mCompletingRegionPos.clear();
+			}
+			pos_global.mdV[VX] += (F64)pos_local.mV[VX];
+			pos_global.mdV[VY] += (F64)pos_local.mV[VY];
+			pos_global.mdV[VZ] = (F64)pos_local.mV[VZ];
 
 			childSetValue("location", sim_name);
 			trackLocation(pos_global);
diff --git a/indra/newview/llfloaterworldmap.h b/indra/newview/llfloaterworldmap.h
index 7feebb583d8..00f5e788fb8 100644
--- a/indra/newview/llfloaterworldmap.h
+++ b/indra/newview/llfloaterworldmap.h
@@ -148,7 +148,6 @@ class LLFloaterWorldMap : public LLFloater
 	void			updateSearchEnabled();
 	void			onLocationFocusChanged( LLFocusableElement* ctrl );
 	void		    onLocationCommit();
-	void			onCommitLocation();
 	void		    onCommitSearchResult();
 
 	void			cacheLandmarkPosition();
@@ -170,6 +169,10 @@ class LLFloaterWorldMap : public LLFloater
 	LLFriendObserver* mFriendObserver;
 
 	std::string				mCompletingRegionName;
+	// Local position from trackURL() request, used to select final
+	// position once region lookup complete.
+	LLVector3				mCompletingRegionPos;
+
 	std::string				mLastRegionName;
 	BOOL					mWaitingForTracker;
 
diff --git a/indra/newview/llfolderview.cpp b/indra/newview/llfolderview.cpp
index 112b23d2df0..a63fb730320 100644
--- a/indra/newview/llfolderview.cpp
+++ b/indra/newview/llfolderview.cpp
@@ -78,7 +78,7 @@
 ///----------------------------------------------------------------------------
 
 const S32 RENAME_WIDTH_PAD = 4;
-const S32 RENAME_HEIGHT_PAD = 2;
+const S32 RENAME_HEIGHT_PAD = 1;
 const S32 AUTO_OPEN_STACK_DEPTH = 16;
 const S32 MIN_ITEM_WIDTH_VISIBLE = LLFolderViewItem::ICON_WIDTH
 			+ LLFolderViewItem::ICON_PAD 
@@ -206,7 +206,9 @@ LLFolderView::LLFolderView(const Params& p)
 	mAutoOpenCandidate = NULL;
 	mAutoOpenTimer.stop();
 	mKeyboardSelection = FALSE;
-    static LLUICachedControl<S32> indentation("FolderIndentation", 0);
+	const LLFolderViewItem::Params& item_params =
+		LLUICtrlFactory::getDefaultParams<LLFolderViewItem>();
+	S32 indentation = item_params.folder_indentation();
 	mIndentation = -indentation; // children start at indentation 0
 	gIdleCallbacks.addFunction(idle, this);
 
@@ -395,7 +397,7 @@ S32 LLFolderView::arrange( S32* unused_width, S32* unused_height, S32 filter_gen
 		getRoot()->getFilter()->getShowFolderState();
 
 	S32 total_width = LEFT_PAD;
-	S32 running_height = mDebugFilters ? llceil(sSmallFont->getLineHeight()) : 0;
+	S32 running_height = mDebugFilters ? llceil(LLFontGL::getFontMonospace()->getLineHeight()) : 0;
 	S32 target_height = running_height;
 	S32 parent_item_height = getRect().getHeight();
 
@@ -569,6 +571,8 @@ LLFolderViewItem* LLFolderView::getCurSelectedItem( void )
 BOOL LLFolderView::setSelection(LLFolderViewItem* selection, BOOL openitem,
 								BOOL take_keyboard_focus)
 {
+	mSignalSelectCallback = take_keyboard_focus ? SIGNAL_KEYBOARD_FOCUS : SIGNAL_NO_KEYBOARD_FOCUS;
+
 	if( selection == this )
 	{
 		return FALSE;
@@ -596,8 +600,6 @@ BOOL LLFolderView::setSelection(LLFolderViewItem* selection, BOOL openitem,
 
 	llassert(mSelectedItems.size() <= 1);
 
-	mSignalSelectCallback = take_keyboard_focus ? SIGNAL_KEYBOARD_FOCUS : SIGNAL_NO_KEYBOARD_FOCUS;
-
 	return rv;
 }
 
@@ -820,10 +822,11 @@ void LLFolderView::clearSelection()
 	mSelectThisID.setNull();
 }
 
-BOOL LLFolderView::getSelectionList(std::set<LLUUID> &selection)
+BOOL LLFolderView::getSelectionList(std::set<LLUUID> &selection) const
 {
-	selected_items_t::iterator item_it;
-	for (item_it = mSelectedItems.begin(); item_it != mSelectedItems.end(); ++item_it)
+	for (selected_items_t::const_iterator item_it = mSelectedItems.begin(); 
+		 item_it != mSelectedItems.end(); 
+		 ++item_it)
 	{
 		selection.insert((*item_it)->getListener()->getUUID());
 	}
@@ -866,8 +869,8 @@ void LLFolderView::draw()
 	{
 		std::string current_filter_string = llformat("Current Filter: %d, Least Filter: %d, Auto-accept Filter: %d",
 										mFilter->getCurrentGeneration(), mFilter->getMinRequiredGeneration(), mFilter->getMustPassGeneration());
-		sSmallFont->renderUTF8(current_filter_string, 0, 2, 
-			getRect().getHeight() - sSmallFont->getLineHeight(), LLColor4(0.5f, 0.5f, 0.8f, 1.f), 
+		LLFontGL::getFontMonospace()->renderUTF8(current_filter_string, 0, 2, 
+			getRect().getHeight() - LLFontGL::getFontMonospace()->getLineHeight(), LLColor4(0.5f, 0.5f, 0.8f, 1.f), 
 			LLFontGL::LEFT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, S32_MAX, S32_MAX, NULL, FALSE );
 	}
 
@@ -1882,8 +1885,8 @@ void LLFolderView::scrollToShowItem(LLFolderViewItem* item, const LLRect& constr
 		
 		S32 icon_height = mIcon.isNull() ? 0 : mIcon->getHeight(); 
 		S32 label_height = llround(getLabelFontForStyle(mLabelStyle)->getLineHeight()); 
-		// when navigating with keyboard, only move top of folders on screen, otherwise show whole folder
-		S32 max_height_to_show = mScrollContainer->hasFocus() ? (llmax( icon_height, label_height ) + ICON_PAD) : local_rect.getHeight(); 
+		// when navigating with keyboard, only move top of opened folder on screen, otherwise show whole folder
+		S32 max_height_to_show = item->isOpen() && mScrollContainer->hasFocus() ? (llmax( icon_height, label_height ) + ICON_PAD) : local_rect.getHeight(); 
 		
 		// get portion of item that we want to see...
 		LLRect item_local_rect = LLRect(item->getIndentation(), 
@@ -2218,10 +2221,9 @@ void LLFolderView::updateRenamerPosition()
 {
 	if(mRenameItem)
 	{
-		LLFontGL* font = getLabelFontForStyle(mLabelStyle);
-
-		S32 x = ARROW_SIZE + TEXT_PAD + ICON_WIDTH + ICON_PAD - 1 + mRenameItem->getIndentation();
-		S32 y = llfloor(mRenameItem->getRect().getHeight() - font->getLineHeight()-2);
+		// See also LLFolderViewItem::draw()
+		S32 x = ARROW_SIZE + TEXT_PAD + ICON_WIDTH + ICON_PAD + mRenameItem->getIndentation();
+		S32 y = mRenameItem->getRect().getHeight() - mRenameItem->getItemHeight() - RENAME_HEIGHT_PAD;
 		mRenameItem->localPointToScreen( x, y, &x, &y );
 		screenPointToLocal( x, y, &x, &y );
 		mRenamer->setOrigin( x, y );
@@ -2233,7 +2235,7 @@ void LLFolderView::updateRenamerPosition()
 		}
 
 		S32 width = llmax(llmin(mRenameItem->getRect().getWidth() - x, scroller_rect.getWidth() - x - getRect().mLeft), MINIMUM_RENAMER_WIDTH);
-		S32 height = llfloor(font->getLineHeight() + RENAME_HEIGHT_PAD);
+		S32 height = mRenameItem->getItemHeight() - RENAME_HEIGHT_PAD;
 		mRenamer->reshape( width, height, TRUE );
 	}
 }
diff --git a/indra/newview/llfolderview.h b/indra/newview/llfolderview.h
index 2598af4df4b..89e1865e353 100644
--- a/indra/newview/llfolderview.h
+++ b/indra/newview/llfolderview.h
@@ -162,7 +162,7 @@ class LLFolderView : public LLFolderViewFolder, public LLEditMenuHandler
 
 	virtual S32 extendSelection(LLFolderViewItem* selection, LLFolderViewItem* last_selected, LLDynamicArray<LLFolderViewItem*>& items);
 
-	virtual BOOL getSelectionList(std::set<LLUUID> &selection);
+	virtual BOOL getSelectionList(std::set<LLUUID> &selection) const;
 
 	// make sure if ancestor is selected, descendents are not
 	void sanitizeSelection();
diff --git a/indra/newview/llfoldervieweventlistener.h b/indra/newview/llfoldervieweventlistener.h
index 473d0be912b..d6c4459e6fa 100644
--- a/indra/newview/llfoldervieweventlistener.h
+++ b/indra/newview/llfoldervieweventlistener.h
@@ -62,6 +62,7 @@ class LLFolderViewEventListener
 	virtual PermissionMask getPermissionMask() const = 0;
 	virtual LLFolderType::EType getPreferredType() const = 0;
 	virtual LLPointer<LLUIImage> getIcon() const = 0;
+	virtual LLPointer<LLUIImage> getOpenIcon() const { return getIcon(); }
 	virtual LLFontGL::StyleFlags getLabelStyle() const = 0;
 	virtual std::string getLabelSuffix() const = 0;
 	virtual void openItem( void ) = 0;
diff --git a/indra/newview/llfolderviewitem.cpp b/indra/newview/llfolderviewitem.cpp
index 9d54aafd675..4b48626b22a 100644
--- a/indra/newview/llfolderviewitem.cpp
+++ b/indra/newview/llfolderviewitem.cpp
@@ -51,11 +51,10 @@
 /// Class LLFolderViewItem
 ///----------------------------------------------------------------------------
 
+static LLDefaultChildRegistry::Register<LLFolderViewItem> r("folder_view_item");
+
 // statics 
 std::map<U8, LLFontGL*> LLFolderViewItem::sFonts; // map of styles to fonts
-const LLFontGL* LLFolderViewItem::sSmallFont = NULL;
-LLUIImagePtr LLFolderViewItem::sArrowImage;
-LLUIImagePtr LLFolderViewItem::sBoxImage;
 
 // only integers can be initialized in header
 const F32 LLFolderViewItem::FOLDER_CLOSE_TIME_CONSTANT = 0.02f;
@@ -84,33 +83,34 @@ LLFontGL* LLFolderViewItem::getLabelFontForStyle(U8 style)
 //static
 void LLFolderViewItem::initClass()
 {
-	sSmallFont = LLFontGL::getFontMonospace();
-	sArrowImage = LLUI::getUIImage("folder_arrow.tga"); 
-	sBoxImage = LLUI::getUIImage("rounded_square.tga");
 }
 
 //static
 void LLFolderViewItem::cleanupClass()
 {
 	sFonts.clear();
-	sArrowImage = NULL;
-	sBoxImage = NULL;
 }
 
 
 // NOTE: Optimize this, we call it a *lot* when opening a large inventory
 LLFolderViewItem::Params::Params()
-:	icon("icon"),
-	folder_arrow_image("folder_arrow_image", LLUI::getUIImage("folder_arrow.tga")),
-	selection_image("selection_image", LLUI::getUIImage("rounded_square.tga"))
+:	icon(),
+	icon_open(),
+	root(),
+	listener(),
+	folder_arrow_image("folder_arrow_image"),
+	folder_indentation("folder_indentation"),
+	selection_image("selection_image"),
+	item_height("item_height"),
+	item_top_pad("item_top_pad"),
+	creation_date()
 {
 	mouse_opaque(true);
 	follows.flags(FOLLOWS_LEFT|FOLLOWS_TOP|FOLLOWS_RIGHT);
-	// JAMESDEBUG tab_stop(false);
 }
 
 // Default constructor
-LLFolderViewItem::LLFolderViewItem(LLFolderViewItem::Params p)
+LLFolderViewItem::LLFolderViewItem(const LLFolderViewItem::Params& p)
 :	LLView(p),
 	mLabelWidth(0),
 	mLabelWidthDirty(false),
@@ -121,6 +121,7 @@ LLFolderViewItem::LLFolderViewItem(LLFolderViewItem::Params p)
 	mLabelStyle( LLFontGL::NORMAL ),
 	mHasVisibleChildren(FALSE),
 	mIndentation(0),
+	mItemHeight(p.item_height),
 	mNumDescendantsSelected(0),
 	mPassedFilter(FALSE),
 	mLastFilterGeneration(-1),
@@ -134,8 +135,6 @@ LLFolderViewItem::LLFolderViewItem(LLFolderViewItem::Params p)
 	mIcon(p.icon),
 	mIconOpen(p.icon_open),
 	mListener(p.listener),
-	mArrowImage(p.folder_arrow_image),
-	mBoxImage(p.selection_image),
 	mHidden(false),
 	mShowLoadStatus(false)
 {
@@ -392,10 +391,11 @@ BOOL LLFolderViewItem::addToFolder(LLFolderViewFolder* folder, LLFolderView* roo
 // makes sure that this view and it's children are the right size.
 S32 LLFolderViewItem::arrange( S32* width, S32* height, S32 filter_generation)
 {
-    static LLUICachedControl<S32> indentation("FolderIndentation", 0);
+	const Params& p = LLUICtrlFactory::getDefaultParams<LLFolderViewItem>();
+	S32 indentation = p.folder_indentation();
+	// Only indent deeper items in hierarchy
 	mIndentation = (getParentFolder() 
-					&& getParentFolder()->getParentFolder() 
-					&& getParentFolder()->getParentFolder()->getParentFolder())
+					&& getParentFolder()->getParentFolder() )
 		? mParentFolder->getIndentation() + indentation
 		: 0;
 	if (mLabelWidthDirty)
@@ -421,9 +421,10 @@ S32 LLFolderViewItem::getItemHeight()
 {
 	if (mHidden) return 0;
 
-	S32 icon_height = mIcon->getHeight();
-	S32 label_height = llround(getLabelFontForStyle(mLabelStyle)->getLineHeight());
-	return llmax( icon_height, label_height ) + ICON_PAD;
+	//S32 icon_height = mIcon->getHeight();
+	//S32 label_height = llround(getLabelFontForStyle(mLabelStyle)->getLineHeight());
+	//return llmax( icon_height, label_height ) + ICON_PAD;
+	return mItemHeight;
 }
 
 void LLFolderViewItem::filter( LLInventoryFilter& filter)
@@ -829,11 +830,16 @@ void LLFolderViewItem::draw()
 	static LLUIColor sFgColor = LLUIColorTable::instance().getColor("MenuItemEnabledColor", DEFAULT_WHITE);
 	static LLUIColor sHighlightBgColor = LLUIColorTable::instance().getColor("MenuItemHighlightBgColor", DEFAULT_WHITE);
 	static LLUIColor sHighlightFgColor = LLUIColorTable::instance().getColor("MenuItemHighlightFgColor", DEFAULT_WHITE);
+	static LLUIColor sFocusOutlineColor =
+		LLUIColorTable::instance().getColor("InventoryFocusOutlineColor", DEFAULT_WHITE);
 	static LLUIColor sFilterBGColor = LLUIColorTable::instance().getColor("FilterBackgroundColor", DEFAULT_WHITE);
 	static LLUIColor sFilterTextColor = LLUIColorTable::instance().getColor("FilterTextColor", DEFAULT_WHITE);
 	static LLUIColor sSuffixColor = LLUIColorTable::instance().getColor("InventoryItemSuffixColor", DEFAULT_WHITE);
 	static LLUIColor sSearchStatusColor = LLUIColorTable::instance().getColor("InventorySearchStatusColor", DEFAULT_WHITE);
 
+	const Params& default_params = LLUICtrlFactory::getDefaultParams<LLFolderViewItem>();
+	const S32 TOP_PAD = default_params.item_top_pad;
+
 	bool possibly_has_children = false;
 	bool up_to_date = mListener && mListener->isUpToDate();
 	if((up_to_date && hasVisibleChildren() ) || // we fetched our children and some of them have passed the filter...
@@ -843,13 +849,13 @@ void LLFolderViewItem::draw()
 	}
 	if(/*mControlLabel[0] != '\0' && */possibly_has_children)
 	{
-		if (sArrowImage)
-		{
-			gl_draw_scaled_rotated_image(mIndentation, getRect().getHeight() - ARROW_SIZE - TEXT_PAD,
-				ARROW_SIZE, ARROW_SIZE, mControlLabelRotation, sArrowImage->getImage(), sFgColor);
-		}
+		LLUIImage* arrow_image = default_params.folder_arrow_image;
+		gl_draw_scaled_rotated_image(
+			mIndentation, getRect().getHeight() - ARROW_SIZE - TEXT_PAD - TOP_PAD,
+			ARROW_SIZE, ARROW_SIZE, mControlLabelRotation, arrow_image->getImage(), sFgColor);
 	}
 
+	// See also LLFolderView::updateRenamerPosition()
 	F32 text_left = (F32)(ARROW_SIZE + TEXT_PAD + ICON_WIDTH + ICON_PAD + mIndentation);
 
 	LLFontGL* font = getLabelFontForStyle(mLabelStyle);
@@ -857,6 +863,10 @@ void LLFolderViewItem::draw()
 	// If we have keyboard focus, draw selection filled
 	BOOL show_context = getRoot()->getShowSelectionContext();
 	BOOL filled = show_context || (getRoot()->getParentPanel()->hasFocus());
+	const S32 FOCUS_LEFT = 1;
+	S32 focus_top = getRect().getHeight();
+	S32 focus_bottom = getRect().getHeight() - mItemHeight;
+	bool folder_open = (getRect().getHeight() > mItemHeight + 4);
 
 	// always render "current" item, only render other selected items if
 	// mShowSingleSelection is FALSE
@@ -864,7 +874,6 @@ void LLFolderViewItem::draw()
 	{
 		gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
 		LLColor4 bg_color = sHighlightBgColor;
-		//const S32 TRAILING_PAD = 5;  // It just looks better with this.
 		if (!mIsCurSelection)
 		{
 			// do time-based fade of extra objects
@@ -882,35 +891,35 @@ void LLFolderViewItem::draw()
 		}
 
 		gl_rect_2d(
-			0, 
-			getRect().getHeight(), 
+			FOCUS_LEFT,
+			focus_top, 
 			getRect().getWidth() - 2,
-			llfloor(getRect().getHeight() - font->getLineHeight() - ICON_PAD),
+			focus_bottom,
 			bg_color, filled);
 		if (mIsCurSelection)
 		{
 			gl_rect_2d(
-				0, 
-				getRect().getHeight(), 
+				FOCUS_LEFT, 
+				focus_top, 
 				getRect().getWidth() - 2,
-				llfloor(getRect().getHeight() - font->getLineHeight() - ICON_PAD),
-				sHighlightFgColor, FALSE);
+				focus_bottom,
+				sFocusOutlineColor, FALSE);
 		}
-		if (getRect().getHeight() > llround(font->getLineHeight()) + ICON_PAD + 4)
+		if (folder_open)
 		{
 			gl_rect_2d(
-				0, 
-				llfloor(getRect().getHeight() - font->getLineHeight() - ICON_PAD) - 4, 
+				FOCUS_LEFT,
+				focus_bottom + 1, // overlap with bottom edge of above rect
 				getRect().getWidth() - 2,
-				2,
-				sHighlightFgColor, FALSE);
+				0,
+				sFocusOutlineColor, FALSE);
 			if (show_context)
 			{
 				gl_rect_2d(
-					0, 
-					llfloor(getRect().getHeight() - font->getLineHeight() - ICON_PAD) - 4, 
+					FOCUS_LEFT,
+					focus_bottom + 1,
 					getRect().getWidth() - 2,
-					2,
+					0,
 					sHighlightBgColor, TRUE);
 			}
 		}
@@ -919,32 +928,32 @@ void LLFolderViewItem::draw()
 	{
 		gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
 		gl_rect_2d(
-			0, 
-			getRect().getHeight(), 
+			FOCUS_LEFT, 
+			focus_top, 
 			getRect().getWidth() - 2,
-			llfloor(getRect().getHeight() - font->getLineHeight() - ICON_PAD),
+			focus_bottom,
 			sHighlightBgColor, FALSE);
-
-		if (getRect().getHeight() > llround(font->getLineHeight()) + ICON_PAD + 2)
+		if (folder_open)
 		{
 			gl_rect_2d(
-				0, 
-				llfloor(getRect().getHeight() - font->getLineHeight() - ICON_PAD) - 2, 
+				FOCUS_LEFT,
+				focus_bottom + 1, // overlap with bottom edge of above rect
 				getRect().getWidth() - 2,
-				2,
+				0,
 				sHighlightBgColor, FALSE);
 		}
 		mDragAndDropTarget = FALSE;
 	}
 
+	S32 icon_x = mIndentation + ARROW_SIZE + TEXT_PAD;
 	// First case is used for open folders
 	if (!mIconOpen.isNull() && (llabs(mControlLabelRotation) > 80))
  	{
-		mIconOpen->draw(mIndentation + ARROW_SIZE + TEXT_PAD, getRect().getHeight() - mIcon->getHeight());
+		mIconOpen->draw(icon_x, getRect().getHeight() - mIconOpen->getHeight() - TOP_PAD + 1);
 	}
 	else if(mIcon)
 	{
- 		mIcon->draw(mIndentation + ARROW_SIZE + TEXT_PAD, getRect().getHeight() - mIcon->getHeight());
+ 		mIcon->draw(icon_x, getRect().getHeight() - mIcon->getHeight() - TOP_PAD + 1);
  	}
 
 	if (!mLabel.empty())
@@ -953,7 +962,7 @@ void LLFolderViewItem::draw()
 		BOOL debug_filters = getRoot()->getDebugFilters();
 		LLColor4 color = ( (mIsSelected && filled) ? sHighlightFgColor : sFgColor );
 		F32 right_x;
-		F32 y = (F32)getRect().getHeight() - font->getLineHeight() - (F32)TEXT_PAD;
+		F32 y = (F32)getRect().getHeight() - font->getLineHeight() - (F32)TEXT_PAD - (F32)TOP_PAD;
 
 		if (debug_filters)
 		{
@@ -963,7 +972,8 @@ void LLFolderViewItem::draw()
 			}
 
 			LLColor4 filter_color = mLastFilterGeneration >= getRoot()->getFilter()->getCurrentGeneration() ? LLColor4(0.5f, 0.8f, 0.5f, 1.f) : LLColor4(0.8f, 0.5f, 0.5f, 1.f);
-			sSmallFont->renderUTF8(mStatusText, 0, text_left, y, filter_color,
+			LLFontGL::getFontMonospace()->renderUTF8(
+				mStatusText, 0, text_left, y, filter_color,
 				LLFontGL::LEFT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW,
 				S32_MAX, S32_MAX, &right_x, FALSE );
 			text_left = right_x;
@@ -1004,7 +1014,7 @@ void LLFolderViewItem::draw()
 				S32_MAX, S32_MAX, &right_x, FALSE );
 		}
 
-		if (sBoxImage.notNull() && mStringMatchOffset != std::string::npos)
+		if (mStringMatchOffset != std::string::npos)
 		{
 			// don't draw backgrounds for zero-length strings
 			S32 filter_string_length = getRoot()->getFilterSubString().size();
@@ -1013,14 +1023,15 @@ void LLFolderViewItem::draw()
 				std::string combined_string = mLabel + mLabelSuffix;
 				S32 left = llround(text_left) + font->getWidth(combined_string, 0, mStringMatchOffset) - 1;
 				S32 right = left + font->getWidth(combined_string, mStringMatchOffset, filter_string_length) + 2;
-				S32 bottom = llfloor(getRect().getHeight() - font->getLineHeight() - 3);
-				S32 top = getRect().getHeight();
-				
+				S32 bottom = llfloor(getRect().getHeight() - font->getLineHeight() - 3 - TOP_PAD);
+				S32 top = getRect().getHeight() - TOP_PAD;
+		
+				LLUIImage* box_image = default_params.selection_image;
 				LLRect box_rect(left, top, right, bottom);
-				sBoxImage->draw(box_rect, sFilterBGColor);
+				box_image->draw(box_rect, sFilterBGColor);
 				F32 match_string_left = text_left + font->getWidthF32(combined_string, 0, mStringMatchOffset);
-				F32 y = (F32)getRect().getHeight() - font->getLineHeight() - (F32)TEXT_PAD;
-				font->renderUTF8( combined_string, mStringMatchOffset, match_string_left, y,
+				F32 yy = (F32)getRect().getHeight() - font->getLineHeight() - (F32)TEXT_PAD - (F32)TOP_PAD;
+				font->renderUTF8( combined_string, mStringMatchOffset, match_string_left, yy,
 								  sFilterTextColor, LLFontGL::LEFT, LLFontGL::BOTTOM, LLFontGL::NORMAL, LLFontGL::NO_SHADOW,
 								  filter_string_length, S32_MAX, &right_x, FALSE );
 			}
diff --git a/indra/newview/llfolderviewitem.h b/indra/newview/llfolderviewitem.h
index 6f8c738a596..be8e73a5a9d 100644
--- a/indra/newview/llfolderviewitem.h
+++ b/indra/newview/llfolderviewitem.h
@@ -101,7 +101,10 @@ class LLFolderViewItem : public LLView
 		Optional<LLFolderViewEventListener*>	listener;
 
 		Optional<LLUIImage*>					folder_arrow_image;
+		Optional<S32>							folder_indentation; // pixels
 		Optional<LLUIImage*>					selection_image;
+		Optional<S32>							item_height; // pixels
+		Optional<S32>							item_top_pad; // pixels
 
 		Optional<S32>							creation_date; //UTC seconds
 
@@ -110,7 +113,7 @@ class LLFolderViewItem : public LLView
 
 	// layout constants
 	static const S32 LEFT_PAD = 5;
-    // LEFT_INDENTATION is set via settings.xml FolderIndentation
+    // LEFT_INDENTATION is set via folder_indentation above
 	static const S32 ICON_PAD = 2;
 	static const S32 ICON_WIDTH = 16;
 	static const S32 TEXT_PAD = 1;
@@ -127,11 +130,7 @@ class LLFolderViewItem : public LLView
 	friend class LLUICtrlFactory;
 	friend class LLFolderViewEventListener;
 
-	LLFolderViewItem(Params p = LLFolderViewItem::Params());
-
-	static const LLFontGL*		sSmallFont;
-	static LLUIImagePtr			sArrowImage;
-	static LLUIImagePtr			sBoxImage;
+	LLFolderViewItem(const Params& p);
 
 	std::string					mLabel;
 	std::string					mSearchableLabel;
@@ -150,6 +149,7 @@ class LLFolderViewItem : public LLView
 	LLUIImagePtr				mIconOpen;
 	BOOL						mHasVisibleChildren;
 	S32							mIndentation;
+	S32							mItemHeight;
 	S32							mNumDescendantsSelected;
 	BOOL						mPassedFilter;
 	S32							mLastFilterGeneration;
@@ -157,8 +157,6 @@ class LLFolderViewItem : public LLView
 	F32							mControlLabelRotation;
 	LLFolderView*				mRoot;
 	BOOL						mDragAndDropTarget;
-	LLUIImagePtr				mArrowImage;
-	LLUIImagePtr				mBoxImage;
 	BOOL                        mIsLoading;
 	LLTimer                     mTimeSinceRequestStart;
 	bool						mHidden;
@@ -237,7 +235,7 @@ class LLFolderViewItem : public LLView
 	virtual void recursiveDeselect(BOOL deselect_self);
 
 	// gets multiple-element selection
-	virtual BOOL getSelectionList(std::set<LLUUID> &selection){return TRUE;}
+	virtual BOOL getSelectionList(std::set<LLUUID> &selection) const {return TRUE;}
 
 	// Returns true is this object and all of its children can be removed (deleted by user)
 	virtual BOOL isRemovable();
@@ -304,7 +302,7 @@ class LLFolderViewItem : public LLView
 	// Show children (unfortunate that this is called "open")
 	virtual void setOpen(BOOL open = TRUE) {};
 
-	virtual BOOL isOpen() { return FALSE; }
+	virtual BOOL isOpen() const { return FALSE; }
 
 	virtual LLFolderView*	getRoot();
 	BOOL			isDescendantOf( const LLFolderViewFolder* potential_ancestor );
@@ -499,7 +497,7 @@ class LLFolderViewFolder : public LLFolderViewItem
 	virtual void setOpenArrangeRecursively(BOOL openitem, ERecurseType recurse = RECURSE_NO);
 
 	// Get the current state of the folder.
-	virtual BOOL isOpen() { return mIsOpen; }
+	virtual BOOL isOpen() const { return mIsOpen; }
 
 	// special case if an object is dropped on the child.
 	BOOL handleDragAndDropFromChild(MASK mask,
diff --git a/indra/newview/llgesturemgr.cpp b/indra/newview/llgesturemgr.cpp
index df7aa9eabf3..82293b4aa0b 100644
--- a/indra/newview/llgesturemgr.cpp
+++ b/indra/newview/llgesturemgr.cpp
@@ -417,6 +417,16 @@ BOOL LLGestureManager::isGesturePlaying(const LLUUID& item_id)
 	return gesture->mPlaying;
 }
 
+BOOL LLGestureManager::isGesturePlaying(LLMultiGesture* gesture)
+{
+	if(!gesture)
+	{
+		return FALSE;
+	}
+
+	return gesture->mPlaying;
+}
+
 void LLGestureManager::replaceGesture(const LLUUID& item_id, LLMultiGesture* new_gesture, const LLUUID& asset_id)
 {
 	const LLUUID& base_item_id = get_linked_uuid(item_id);
diff --git a/indra/newview/llgesturemgr.h b/indra/newview/llgesturemgr.h
index e80eea9ae90..c562587c6fd 100644
--- a/indra/newview/llgesturemgr.h
+++ b/indra/newview/llgesturemgr.h
@@ -103,6 +103,8 @@ class LLGestureManager : public LLSingleton<LLGestureManager>, public LLInventor
 
 	BOOL isGesturePlaying(const LLUUID& item_id);
 
+	BOOL isGesturePlaying(LLMultiGesture* gesture);
+
 	const item_map_t& getActiveGestures() const { return mActive; }
 	// Force a gesture to be played, for example, if it is being
 	// previewed.
diff --git a/indra/newview/llgroupactions.cpp b/indra/newview/llgroupactions.cpp
index 7dd8ea694e9..d6e2bb0445f 100644
--- a/indra/newview/llgroupactions.cpp
+++ b/indra/newview/llgroupactions.cpp
@@ -146,6 +146,12 @@ void LLGroupActions::startCall(const LLUUID& group_id)
 // static
 void LLGroupActions::join(const LLUUID& group_id)
 {
+	if (!gAgent.canJoinGroups())
+	{
+		LLNotificationsUtil::add("JoinedTooManyGroups");
+		return;
+	}
+
 	LLGroupMgrGroupData* gdatap = 
 		LLGroupMgr::getInstance()->getGroupData(group_id);
 
@@ -226,7 +232,9 @@ void LLGroupActions::activate(const LLUUID& group_id)
 
 static bool isGroupUIVisible()
 {
-	LLPanel* panel = LLSideTray::getInstance()->findChild<LLPanel>("panel_group_info_sidetray");
+	static LLPanel* panel = 0;
+	if(!panel)
+		panel = LLSideTray::getInstance()->findChild<LLPanel>("panel_group_info_sidetray");
 	if(!panel)
 		return false;
 	return panel->isInVisibleChain();
diff --git a/indra/newview/llgrouplist.cpp b/indra/newview/llgrouplist.cpp
index 3ca459a4038..e75d35bea41 100644
--- a/indra/newview/llgrouplist.cpp
+++ b/indra/newview/llgrouplist.cpp
@@ -210,7 +210,6 @@ void LLGroupList::addNewItem(const LLUUID& id, const std::string& name, const LL
 	item->setGroupID(id);
 	item->setName(name, mNameFilter);
 	item->setGroupIconID(icon_id);
-//	item->setContextMenu(mContextMenu);
 
 	item->childSetVisible("info_btn", false);
 	item->childSetVisible("profile_btn", false);
@@ -268,8 +267,9 @@ bool LLGroupList::onContextMenuItemEnable(const LLSD& userdata)
 	LLUUID selected_group_id = getSelectedUUID();
 	bool real_group_selected = selected_group_id.notNull(); // a "real" (not "none") group is selected
 
+	// each group including "none" can be activated
 	if (userdata.asString() == "activate")
-		return real_group_selected && gAgent.getGroupID() != selected_group_id;
+		return gAgent.getGroupID() != selected_group_id;
 
 	return real_group_selected;
 }
@@ -283,7 +283,6 @@ LLGroupListItem::LLGroupListItem()
 mGroupIcon(NULL),
 mGroupNameBox(NULL),
 mInfoBtn(NULL),
-//mContextMenu(NULL), //TODO:
 mGroupID(LLUUID::null)
 {
 	LLUICtrlFactory::getInstance()->buildPanel(this, "panel_group_list_item.xml");
diff --git a/indra/newview/llhudtext.cpp b/indra/newview/llhudtext.cpp
index 0b5da40be4d..8ad94b957d7 100644
--- a/indra/newview/llhudtext.cpp
+++ b/indra/newview/llhudtext.cpp
@@ -287,7 +287,7 @@ void LLHUDText::renderText(BOOL for_select)
 	mOffsetY = lltrunc(mHeight * ((mVertAlignment == ALIGN_VERT_CENTER) ? 0.5f : 1.f));
 
 	// *TODO: cache this image
-	LLUIImagePtr imagep = LLUI::getUIImage("rounded_square.tga");
+	LLUIImagePtr imagep = LLUI::getUIImage("Rounded_Square");
 
 	// *TODO: make this a per-text setting
 	LLColor4 bg_color = LLUIColorTable::instance().getColor("BackgroundChatColor");
@@ -606,7 +606,7 @@ void LLHUDText::addLine(const LLWString &wstr, const LLColor4& color, const LLFo
 			U32 line_length = 0;
 			do	
 			{
-				S32 segment_length = mFontp->maxDrawableChars(iter->substr(line_length).c_str(), mUseBubble ? HUD_TEXT_MAX_WIDTH : HUD_TEXT_MAX_WIDTH_NO_BUBBLE, wline.length(), TRUE);
+				S32 segment_length = mFontp->maxDrawableChars(iter->substr(line_length).c_str(), mUseBubble ? HUD_TEXT_MAX_WIDTH : HUD_TEXT_MAX_WIDTH_NO_BUBBLE, wline.length(), LLFontGL::WORD_BOUNDARY_IF_POSSIBLE);
 				mTextSegments.push_back(LLHUDTextSegment(iter->substr(line_length, segment_length), style, color));
 				line_length += segment_length;
 			}
@@ -642,7 +642,7 @@ void LLHUDText::setLabel(const LLWString &wlabel)
 			U32 line_length = 0;
 			do	
 			{
-				S32 segment_length = mFontp->maxDrawableChars(iter->substr(line_length).c_str(), mUseBubble ? HUD_TEXT_MAX_WIDTH : HUD_TEXT_MAX_WIDTH_NO_BUBBLE, wstr.length(), TRUE);
+				S32 segment_length = mFontp->maxDrawableChars(iter->substr(line_length).c_str(), mUseBubble ? HUD_TEXT_MAX_WIDTH : HUD_TEXT_MAX_WIDTH_NO_BUBBLE, wstr.length(), LLFontGL::WORD_BOUNDARY_IF_POSSIBLE);
 				mLabelSegments.push_back(LLHUDTextSegment(iter->substr(line_length, segment_length), LLFontGL::NORMAL, mColor));
 				line_length += segment_length;
 			}
diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp
index 259f629bdd3..e06e0c94ec9 100644
--- a/indra/newview/llimfloater.cpp
+++ b/indra/newview/llimfloater.cpp
@@ -42,7 +42,6 @@
 #include "llbottomtray.h"
 #include "llchannelmanager.h"
 #include "llchiclet.h"
-#include "llfloaterchat.h"
 #include "llfloaterreg.h"
 #include "llimfloatercontainer.h" // to replace separate IM Floaters with multifloater container
 #include "lllayoutstack.h"
@@ -59,6 +58,7 @@
 #include "llinventorymodel.h"
 #include "llrootview.h"
 
+#include "llspeakers.h"
 
 
 LLIMFloater::LLIMFloater(const LLUUID& session_id)
@@ -115,11 +115,21 @@ LLIMFloater::LLIMFloater(const LLUUID& session_id)
 void LLIMFloater::onFocusLost()
 {
 	LLIMModel::getInstance()->resetActiveSessionID();
+	
+	LLBottomTray::getInstance()->getChicletPanel()->setChicletToggleState(mSessionID, false);
 }
 
 void LLIMFloater::onFocusReceived()
 {
 	LLIMModel::getInstance()->setActiveSessionID(mSessionID);
+
+	// return focus to the input field when active tab in the multitab container is clicked.
+	if (isChatMultiTab() && mInputEditor)
+	{
+		mInputEditor->setFocus(TRUE);
+	}
+
+	LLBottomTray::getInstance()->getChicletPanel()->setChicletToggleState(mSessionID, true);
 }
 
 // virtual
@@ -341,13 +351,15 @@ void* LLIMFloater::createPanelAdHocControl(void* userdata)
 
 void LLIMFloater::onSlide()
 {
-	LLPanel* im_control_panel = getChild<LLPanel>("panel_im_control_panel");
-	im_control_panel->setVisible(!im_control_panel->getVisible());
+	mControlPanel->setVisible(!mControlPanel->getVisible());
+
+	gSavedSettings.setBOOL("IMShowControlPanel", mControlPanel->getVisible());
 
-	gSavedSettings.setBOOL("IMShowControlPanel", im_control_panel->getVisible());
+	getChild<LLButton>("slide_left_btn")->setVisible(mControlPanel->getVisible());
+	getChild<LLButton>("slide_right_btn")->setVisible(!mControlPanel->getVisible());
 
-	getChild<LLButton>("slide_left_btn")->setVisible(im_control_panel->getVisible());
-	getChild<LLButton>("slide_right_btn")->setVisible(!im_control_panel->getVisible());
+	LLLayoutStack* stack = getChild<LLLayoutStack>("im_panels");
+	if (stack) stack->setAnimate(true);
 }
 
 //static
@@ -355,35 +367,7 @@ LLIMFloater* LLIMFloater::show(const LLUUID& session_id)
 {
 	if (!gIMMgr->hasSession(session_id)) return NULL;
 
-	// we should make sure all related chiclets are in place when the session is a voice call
-	// chiclets come firts, then comes IM window
-	if (gIMMgr->isVoiceCall(session_id))
-	{
-		LLIMModel* im_model = LLIMModel::getInstance();
-		LLBottomTray* b_tray = LLBottomTray::getInstance();
-		
-		//*TODO hide that into Bottom tray
-		if (!b_tray->getChicletPanel()->findChiclet<LLChiclet>(session_id))
-		{
-			LLIMChiclet* chiclet = b_tray->createIMChiclet(session_id);
-			if(chiclet)
-			{
-				chiclet->setIMSessionName(im_model->getName(session_id));
-				chiclet->setOtherParticipantId(im_model->getOtherParticipantID(session_id));
-			}
-		}
-
-		LLIMWellWindow::getInstance()->addIMRow(session_id);
-	}
-		
-	bool not_existed = true;
-
-	if(isChatMultiTab())
-	{
-		LLIMFloater* target_floater = findInstance(session_id);
-		not_existed = NULL == target_floater;
-	}
-	else
+	if(!isChatMultiTab())
 	{
 		//hide all
 		LLFloaterReg::const_instance_list_t& inst_list = LLFloaterReg::getFloaterList("impanel");
@@ -398,19 +382,33 @@ LLIMFloater* LLIMFloater::show(const LLUUID& session_id)
 		}
 	}
 
-	LLIMFloater* floater = LLFloaterReg::showTypedInstance<LLIMFloater>("impanel", session_id);
+	bool exist = findInstance(session_id);
+
+	LLIMFloater* floater = getInstance(session_id);
+	if (!floater) return NULL;
 
 	if(isChatMultiTab())
 	{
+		LLIMFloaterContainer* floater_container = LLIMFloaterContainer::getInstance();
+
 		// do not add existed floaters to avoid adding torn off instances
-		if (not_existed)
+		if (!exist)
 		{
 			//		LLTabContainer::eInsertionPoint i_pt = user_initiated ? LLTabContainer::RIGHT_OF_CURRENT : LLTabContainer::END;
 			// TODO: mantipov: use LLTabContainer::RIGHT_OF_CURRENT if it exists
 			LLTabContainer::eInsertionPoint i_pt = LLTabContainer::END;
+			
+			if (floater_container)
+			{
+				floater_container->addFloater(floater, TRUE, i_pt);
+			}
+		}
 
-			LLIMFloaterContainer* floater_container = LLFloaterReg::showTypedInstance<LLIMFloaterContainer>("im_container");
-			floater_container->addFloater(floater, TRUE, i_pt);
+		if (floater_container)
+		{
+			//selecting the panel resets a chiclet's counter
+			floater_container->selectFloater(floater);
+			floater_container->setVisible(TRUE);
 		}
 	}
 	else
@@ -437,8 +435,8 @@ LLIMFloater* LLIMFloater::show(const LLUUID& session_id)
 		}
 
 		// window is positioned, now we can show it.
-		floater->setVisible(true);
 	}
+	floater->setVisible(TRUE);
 
 	return floater;
 }
@@ -478,16 +476,6 @@ void LLIMFloater::setDocked(bool docked, bool pop_on_undock)
 	}
 }
 
-void LLIMFloater::setTornOff(bool torn_off)
-{
-	// When IM Floater isn't torn off, "close" button should be hidden.
-	// This call will just disables it, since there is a hack in LLFloater::updateButton,
-	// which prevents hiding of close button in that case.
-	setCanClose(torn_off);
-
-	LLTransientDockableFloater::setTornOff(torn_off);
-}
-
 void LLIMFloater::setVisible(BOOL visible)
 {
 	LLNotificationsUI::LLScreenChannel* channel = dynamic_cast<LLNotificationsUI::LLScreenChannel*>
@@ -508,6 +496,15 @@ void LLIMFloater::setVisible(BOOL visible)
 		updateMessages();
 		mInputEditor->setFocus(TRUE);
 	}
+
+	if(!visible)
+	{
+		LLIMChiclet* chiclet = LLBottomTray::getInstance()->getChicletPanel()->findChiclet<LLIMChiclet>(mSessionID);
+		if(chiclet)
+		{
+			chiclet->setToggleState(false);
+		}
+	}
 }
 
 //static
@@ -542,6 +539,11 @@ LLIMFloater* LLIMFloater::findInstance(const LLUUID& session_id)
 	return LLFloaterReg::findTypedInstance<LLIMFloater>("impanel", session_id);
 }
 
+LLIMFloater* LLIMFloater::getInstance(const LLUUID& session_id)
+{
+	return LLFloaterReg::getTypedInstance<LLIMFloater>("impanel", session_id);
+}
+
 void LLIMFloater::sessionInitReplyReceived(const LLUUID& im_session_id)
 {
 	mSessionInitialized = true;
@@ -589,7 +591,7 @@ void LLIMFloater::updateMessages()
 
 			std::string time = msg["time"].asString();
 			LLUUID from_id = msg["from_id"].asUUID();
-			std::string from = from_id != gAgentID ? msg["from"].asString() : LLTrans::getString("You");
+			std::string from = msg["from"].asString();
 			std::string message = msg["message"].asString();
 
 			LLChat chat;
@@ -618,6 +620,15 @@ void LLIMFloater::onInputEditorFocusReceived( LLFocusableElement* caller, void*
 		//in disconnected state IM input editor should be disabled
 		self->mInputEditor->setEnabled(!gDisconnected);
 	}
+
+	// when IM Floater is a part of the multitab container LLTabContainer set focus to the first
+	// child on tab button's mouse up. This leads input field lost focus. See EXT-3852.
+	if (isChatMultiTab())
+	{
+		// So, clear control captured mouse to prevent LLTabContainer set focus on the panel's first child.
+		// do not pass self->mInputEditor, this leads to have "Edit Text" mouse pointer wherever it is.
+		gFocusMgr.setMouseCapture(NULL);
+	}
 }
 
 // static
@@ -1011,3 +1022,20 @@ void LLIMFloater::sRemoveTypingIndicator(const LLSD& data)
 
 	floater->removeTypingIndicator();
 }
+
+void LLIMFloater::onIMChicletCreated( const LLUUID& session_id )
+{
+
+	if (isChatMultiTab())
+	{
+		LLIMFloaterContainer* im_box = LLIMFloaterContainer::getInstance();
+		if (!im_box) return;
+
+		if (LLIMFloater::findInstance(session_id)) return;
+
+		LLIMFloater* new_tab = LLIMFloater::getInstance(session_id);
+
+		im_box->addFloater(new_tab, FALSE, LLTabContainer::END);
+	}
+
+}
diff --git a/indra/newview/llimfloater.h b/indra/newview/llimfloater.h
index bc7a43e852a..d9db385d06a 100644
--- a/indra/newview/llimfloater.h
+++ b/indra/newview/llimfloater.h
@@ -64,7 +64,6 @@ class LLIMFloater : public LLTransientDockableFloater
 	// LLFloater overrides
 	/*virtual*/ void onClose(bool app_quitting);
 	/*virtual*/ void setDocked(bool docked, bool pop_on_undock = true);
-	/*virtual*/ void setTornOff(bool torn_off);
 
 	// Make IM conversion visible and update the message history
 	static LLIMFloater* show(const LLUUID& session_id);
@@ -75,6 +74,8 @@ class LLIMFloater : public LLTransientDockableFloater
 
 	static LLIMFloater* findInstance(const LLUUID& session_id);
 
+	static LLIMFloater* getInstance(const LLUUID& session_id);
+
 	void sessionInitReplyReceived(const LLUUID& im_session_id);
 
 	// get new messages from LLIMModel
@@ -113,6 +114,8 @@ class LLIMFloater : public LLTransientDockableFloater
 	//used as a callback on receiving new IM message
 	static void sRemoveTypingIndicator(const LLSD& data);
 
+	static void onIMChicletCreated(const LLUUID& session_id);
+
 private:
 	// process focus events to set a currently active session
 	/* virtual */ void onFocusLost();
diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp
index 2d7333f7e47..6cc985aef49 100644
--- a/indra/newview/llimfloatercontainer.cpp
+++ b/indra/newview/llimfloatercontainer.cpp
@@ -34,6 +34,7 @@
 #include "llviewerprecompiledheaders.h"
 
 #include "llimfloatercontainer.h"
+#include "llfloaterreg.h"
 
 //
 // LLIMFloaterContainer
@@ -93,4 +94,14 @@ void LLIMFloaterContainer::addFloater(LLFloater* floaterp,
 	}
 }
 
+LLIMFloaterContainer* LLIMFloaterContainer::findInstance()
+{
+	return LLFloaterReg::findTypedInstance<LLIMFloaterContainer>("im_container");
+}
+
+LLIMFloaterContainer* LLIMFloaterContainer::getInstance()
+{
+	return LLFloaterReg::getTypedInstance<LLIMFloaterContainer>("im_container");
+}
+
 // EOF
diff --git a/indra/newview/llimfloatercontainer.h b/indra/newview/llimfloatercontainer.h
index ead7cf47309..d4a542dfc22 100644
--- a/indra/newview/llimfloatercontainer.h
+++ b/indra/newview/llimfloatercontainer.h
@@ -52,7 +52,11 @@ class LLIMFloaterContainer : public LLMultiFloater
 								LLTabContainer::eInsertionPoint insertion_point = LLTabContainer::END);
 
 	static LLFloater* getCurrentVoiceFloater();
-	
+
+	static LLIMFloaterContainer* findInstance();
+
+	static LLIMFloaterContainer* getInstance();
+
 protected:
 	
 	LLFloater* mActiveVoiceFloater;
diff --git a/indra/newview/llimpanel.cpp b/indra/newview/llimpanel.cpp
index 029ddbaf2c7..4bdf5f42dc4 100644
--- a/indra/newview/llimpanel.cpp
+++ b/indra/newview/llimpanel.cpp
@@ -40,6 +40,7 @@
 #include "llfontgl.h"
 #include "llrect.h"
 #include "llerror.h"
+#include "llmultifloater.h"
 #include "llstring.h"
 #include "message.h"
 #include "lltextbox.h"
@@ -59,7 +60,6 @@
 #include "llinventory.h"
 #include "llinventorymodel.h"
 #include "llfloaterinventory.h"
-#include "llfloaterchat.h"
 #include "lliconctrl.h"
 #include "llkeyboard.h"
 #include "lllineeditor.h"
diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp
index 40227539d03..ff20a55358c 100644
--- a/indra/newview/llimview.cpp
+++ b/indra/newview/llimview.cpp
@@ -42,46 +42,30 @@
 #include "llhttpclient.h"
 #include "llsdutil_math.h"
 #include "llstring.h"
+#include "lltrans.h"
 #include "lluictrlfactory.h"
 
 #include "llagent.h"
+#include "llagentui.h"
+#include "llappviewer.h"
 #include "llavatariconctrl.h"
 #include "llbottomtray.h"
 #include "llcallingcard.h"
 #include "llchat.h"
-#include "llchiclet.h"
-#include "llresmgr.h"
-#include "llfloaterchat.h"
 #include "llfloaterchatterbox.h"
-#include "llavataractions.h"
-#include "llhttpnode.h"
 #include "llimfloater.h"
-#include "llimpanel.h"
 #include "llgroupiconctrl.h"
-#include "llresizebar.h"
-#include "lltabcontainer.h"
-#include "llviewercontrol.h"
-#include "llfloater.h"
 #include "llmutelist.h"
-#include "llresizehandle.h"
-#include "llkeyboard.h"
-#include "llui.h"
-#include "llviewermenu.h"
-#include "llcallingcard.h"
-#include "lltoolbar.h"
+#include "llrecentpeople.h"
 #include "llviewermessage.h"
 #include "llviewerwindow.h"
 #include "llnotifications.h"
 #include "llnotificationsutil.h"
 #include "llnearbychat.h"
-#include "llviewerregion.h"
-#include "llvoicechannel.h"
-#include "lltrans.h"
-#include "llrecentpeople.h"
-#include "llsyswellwindow.h"
+#include "llspeakers.h" //for LLIMSpeakerMgr
+#include "lltextutil.h"
+#include "llviewercontrol.h"
 
-#include "llfirstuse.h"
-#include "llagentui.h"
 
 const static std::string IM_TIME("time");
 const static std::string IM_TEXT("message");
@@ -92,6 +76,7 @@ const static std::string NO_SESSION("(IM Session Doesn't Exist)");
 const static std::string ADHOC_NAME_SUFFIX(" Conference");
 
 std::string LLCallDialogManager::sPreviousSessionlName = "";
+LLIMModel::LLIMSession::SType LLCallDialogManager::sPreviousSessionType = LLIMModel::LLIMSession::P2P_SESSION;
 std::string LLCallDialogManager::sCurrentSessionlName = "";
 LLIMModel::LLIMSession* LLCallDialogManager::sSession = NULL;
 LLVoiceChannel::EState LLCallDialogManager::sOldState = LLVoiceChannel::STATE_READY;
@@ -178,6 +163,7 @@ LLIMModel::LLIMSession::LLIMSession(const LLUUID& session_id, const std::string&
 	if (IM_NOTHING_SPECIAL == type || IM_SESSION_P2P_INVITE == type)
 	{
 		mVoiceChannel  = new LLVoiceChannelP2P(session_id, name, other_participant_id);
+		mOtherParticipantIsAvatar = LLVoiceClient::getInstance()->isParticipantAvatar(mSessionID);
 
 		// check if it was AVALINE call
 		if (!mOtherParticipantIsAvatar)
@@ -208,7 +194,10 @@ LLIMModel::LLIMSession::LLIMSession(const LLUUID& session_id, const std::string&
 	mSpeakers = new LLIMSpeakerMgr(mVoiceChannel);
 
 	// All participants will be added to the list of people we've recently interacted with.
-	mSpeakers->addListener(&LLRecentPeople::instance(), "add");
+
+	// we need to add only _active_ speakers...so comment this. 
+	// may delete this later on cleanup
+	//mSpeakers->addListener(&LLRecentPeople::instance(), "add");
 
 	//we need to wait for session initialization for outgoing ad-hoc and group chat session
 	//correct session id for initiated ad-hoc chat will be received from the server
@@ -224,7 +213,6 @@ LLIMModel::LLIMSession::LLIMSession(const LLUUID& session_id, const std::string&
 	{
 		mCallBackEnabled = LLVoiceClient::getInstance()->isSessionCallBackPossible(mSessionID);
 		mTextIMPossible = LLVoiceClient::getInstance()->isSessionTextIMPossible(mSessionID);
-		mOtherParticipantIsAvatar = LLVoiceClient::getInstance()->isParticipantAvatar(mSessionID);
 	}
 
 	if ( gSavedPerAccountSettings.getBOOL("LogShowHistory") )
@@ -675,6 +663,12 @@ bool LLIMModel::addMessage(const LLUUID& session_id, const std::string& from, co
 	LLIMSession* session = addMessageSilently(session_id, from, from_id, utf8_text, log2file);
 	if (!session) return false;
 
+	//good place to add some1 to recent list
+	//other places may be called from message history.
+	if( !from_id.isNull() &&
+		( session->isP2PSessionType() || session->isAdHocSessionType() ) )
+		LLRecentPeople::instance().add(from_id);
+
 	// notify listeners
 	LLSD arg;
 	arg["session_id"] = session_id;
@@ -781,7 +775,7 @@ LLIMSpeakerMgr* LLIMModel::getSpeakerManager( const LLUUID& session_id ) const
 	LLIMSession* session = findIMSession(session_id);
 	if (!session)
 	{
-		llwarns << "session " << session_id << "does not exist " << llendl;
+		llwarns << "session " << session_id << " does not exist " << llendl;
 		return NULL;
 	}
 
@@ -1360,8 +1354,15 @@ void LLCallDialogManager::onVoiceChannelChanged(const LLUUID &session_id)
 		sCurrentSessionlName = ""; // Empty string results in "Nearby Voice Chat" after substitution
 		return;
 	}
+	
+	if (sSession)
+	{
+		// store previous session type to process Avaline calls in dialogs
+		sPreviousSessionType = sSession->mSessionType;
+	}
+
 	sSession = session;
-	sSession->mVoiceChannel->setStateChangedCallback(LLCallDialogManager::onVoiceChannelStateChanged);
+	sSession->mVoiceChannel->setStateChangedCallback(boost::bind(LLCallDialogManager::onVoiceChannelStateChanged, _1, _2, _3));
 	if(sCurrentSessionlName != session->mName)
 	{
 		sPreviousSessionlName = sCurrentSessionlName;
@@ -1378,6 +1379,7 @@ void LLCallDialogManager::onVoiceChannelChanged(const LLUUID &session_id)
 		mCallDialogPayload["session_name"] = sSession->mName;
 		mCallDialogPayload["other_user_id"] = sSession->mOtherParticipantID;
 		mCallDialogPayload["old_channel_name"] = sPreviousSessionlName;
+		mCallDialogPayload["old_session_type"] = sPreviousSessionType;
 		mCallDialogPayload["state"] = LLVoiceChannel::STATE_CALL_STARTED;
 		mCallDialogPayload["disconnected_channel_name"] = sSession->mName;
 		mCallDialogPayload["session_type"] = sSession->mSessionType;
@@ -1407,6 +1409,7 @@ void LLCallDialogManager::onVoiceChannelStateChanged(const LLVoiceChannel::EStat
 	mCallDialogPayload["session_name"] = sSession->mName;
 	mCallDialogPayload["other_user_id"] = sSession->mOtherParticipantID;
 	mCallDialogPayload["old_channel_name"] = sPreviousSessionlName;
+	mCallDialogPayload["old_session_type"] = sPreviousSessionType;
 	mCallDialogPayload["state"] = new_state;
 	mCallDialogPayload["disconnected_channel_name"] = sSession->mName;
 	mCallDialogPayload["session_type"] = sSession->mSessionType;
@@ -1421,6 +1424,11 @@ void LLCallDialogManager::onVoiceChannelStateChanged(const LLVoiceChannel::EStat
 		}
 		break;
 
+	case LLVoiceChannel::STATE_HUNG_UP:
+		// this state is coming before session is changed, so, put it into payload map
+		mCallDialogPayload["old_session_type"] = sSession->mSessionType;
+		break;
+
 	case LLVoiceChannel::STATE_CONNECTED :
 		ocd = LLFloaterReg::findTypedInstance<LLOutgoingCallDialog>("outgoing_call", LLOutgoingCallDialog::OCD_KEY);
 		if (ocd)
@@ -1561,7 +1569,15 @@ void LLOutgoingCallDialog::show(const LLSD& key)
 	// tell the user which voice channel they are leaving
 	if (!mPayload["old_channel_name"].asString().empty())
 	{
-		childSetTextArg("leaving", "[CURRENT_CHAT]", mPayload["old_channel_name"].asString());
+		bool was_avaline_call = LLIMModel::LLIMSession::AVALINE_SESSION == mPayload["old_session_type"].asInteger();
+
+		std::string old_caller_name = mPayload["old_channel_name"].asString();
+		if (was_avaline_call)
+		{
+			old_caller_name = LLTextUtil::formatPhoneNumber(old_caller_name);
+		}
+
+		childSetTextArg("leaving", "[CURRENT_CHAT]", old_caller_name);
 	}
 	else
 	{
@@ -1570,15 +1586,28 @@ void LLOutgoingCallDialog::show(const LLSD& key)
 
 	if (!mPayload["disconnected_channel_name"].asString().empty())
 	{
-		childSetTextArg("nearby", "[VOICE_CHANNEL_NAME]", mPayload["disconnected_channel_name"].asString());
+		std::string channel_name = mPayload["disconnected_channel_name"].asString();
+		if (LLIMModel::LLIMSession::AVALINE_SESSION == mPayload["session_type"].asInteger())
+		{
+			channel_name = LLTextUtil::formatPhoneNumber(channel_name);
+		}
+		childSetTextArg("nearby", "[VOICE_CHANNEL_NAME]", channel_name);
 		childSetTextArg("nearby_P2P", "[VOICE_CHANNEL_NAME]", mPayload["disconnected_channel_name"].asString());
 	}
 
 	std::string callee_name = mPayload["session_name"].asString();
+
+	LLUUID session_id = mPayload["session_id"].asUUID();
+	bool is_avatar = LLVoiceClient::getInstance()->isParticipantAvatar(session_id);
+
 	if (callee_name == "anonymous")
 	{
 		callee_name = getString("anonymous");
 	}
+	else if (!is_avatar)
+	{
+		callee_name = LLTextUtil::formatPhoneNumber(callee_name);
+	}
 	
 	setTitle(callee_name);
 
@@ -1728,16 +1757,21 @@ BOOL LLIncomingCallDialog::postBuild()
 		call_type = getString(mPayload["notify_box_type"]);
 	}
 		
+	
+	// check to see if this is an Avaline call
+	bool is_avatar = LLVoiceClient::getInstance()->isParticipantAvatar(session_id);
+	childSetVisible("Start IM", is_avatar); // no IM for avaline
+
 	if (caller_name == "anonymous")
 	{
 		caller_name = getString("anonymous");
 	}
-	
-	setTitle(caller_name + " " + call_type);
+	else if (!is_avatar)
+	{
+		caller_name = LLTextUtil::formatPhoneNumber(caller_name);
+	}
 
-	// check to see if this is an Avaline call
-	bool is_avatar = LLVoiceClient::getInstance()->isParticipantAvatar(session_id);
-	childSetVisible("Start IM", is_avatar); // no IM for avaline
+	setTitle(caller_name + " " + call_type);
 
 	LLUICtrl* caller_name_widget = getChild<LLUICtrl>("caller name");
 	caller_name_widget->setValue(caller_name + " " + call_type);
@@ -1805,7 +1839,7 @@ void LLIncomingCallDialog::onStartIM(void* user_data)
 
 void LLIncomingCallDialog::processCallResponse(S32 response)
 {
-	if (!gIMMgr)
+	if (!gIMMgr || gDisconnected)
 		return;
 
 	LLUUID session_id = mPayload["session_id"].asUUID();
@@ -2185,7 +2219,6 @@ void LLIMMgr::addSystemMessage(const LLUUID& session_id, const std::string& mess
 
 		LLChat chat(message);
 		chat.mSourceType = CHAT_SOURCE_SYSTEM;
-		LLFloaterChat::addChatHistory(chat);
 
 		LLNearbyChat* nearby_chat = LLFloaterReg::getTypedInstance<LLNearbyChat>("nearby_chat", LLSD());
 		if(nearby_chat)
@@ -2353,7 +2386,9 @@ LLUUID LLIMMgr::addSession(
 	//we don't need to show notes about online/offline, mute/unmute users' statuses for existing sessions
 	if (!new_session) return session_id;
 	
-	noteOfflineUsers(session_id, floater, ids);
+	//Per Plan's suggestion commented "explicit offline status warning" out to make Dessie happier (see EXT-3609)
+	//*TODO After February 2010 remove this commented out line if no one will be missing that warning
+	//noteOfflineUsers(session_id, floater, ids);
 
 	// Only warn for regular IMs - not group IMs
 	if( dialog == IM_NOTHING_SPECIAL )
@@ -3085,9 +3120,6 @@ class LLViewerChatterBoxInvitation : public LLHTTPNode
 				ll_vector3_from_sd(message_params["position"]),
 				true);
 
-			chat.mText = std::string("IM: ") + name + separator_string + saved + message;
-			LLFloaterChat::addChat(chat, TRUE, is_this_agent);
-
 			//K now we want to accept the invitation
 			std::string url = gAgent.getRegion()->getCapability(
 				"ChatSessionRequest");
diff --git a/indra/newview/llimview.h b/indra/newview/llimview.h
index 11860d0efb8..a226d66b12e 100644
--- a/indra/newview/llimview.h
+++ b/indra/newview/llimview.h
@@ -33,22 +33,19 @@
 #ifndef LL_LLIMVIEW_H
 #define LL_LLIMVIEW_H
 
-#include "lldarray.h"
-#include "lldockablefloater.h"
-#include "llspeakers.h" //for LLIMSpeakerMgr
-#include "llimpanel.h" //for voice channels
-#include "llmodaldialog.h"
 #include "lldockablefloater.h"
 #include "llinstantmessage.h"
-#include "lluuid.h"
-#include "llmultifloater.h"
+
 #include "lllogchat.h"
+#include "llvoicechannel.h"
 
 class LLFloaterChatterBox;
 class LLUUID;
 class LLFloaterIMPanel;
 class LLFriendObserver;
 class LLCallDialogManager;	
+class LLIMSpeakerMgr;
+
 
 class LLIMModel :  public LLSingleton<LLIMModel>
 {
@@ -78,6 +75,11 @@ class LLIMModel :  public LLSingleton<LLIMModel>
 		bool isP2P();
 		bool isOtherParticipantAvaline();
 
+		bool isP2PSessionType() const { return mSessionType == P2P_SESSION;}
+		bool isAdHocSessionType() const { return mSessionType == ADHOC_SESSION;}
+		bool isGroupSessionType() const { return mSessionType == GROUP_SESSION;}
+		bool isAvalineSessionType() const { return mSessionType == AVALINE_SESSION;}
+
 		LLUUID mSessionID;
 		std::string mName;
 		EInstantMessage mType;
@@ -475,6 +477,7 @@ class LLCallDialogManager : public LLInitClass<LLCallDialogManager>
 
 protected:
 	static std::string sPreviousSessionlName;
+	static LLIMModel::LLIMSession::SType sPreviousSessionType;
 	static std::string sCurrentSessionlName;
 	static LLIMModel::LLIMSession* sSession;
 	static LLVoiceChannel::EState sOldState;
diff --git a/indra/newview/llinspect.h b/indra/newview/llinspect.h
index 731e99534b8..a1cb9cd71cd 100644
--- a/indra/newview/llinspect.h
+++ b/indra/newview/llinspect.h
@@ -55,7 +55,7 @@ class LLInspect : public LLFloater
 	/// Inspectors close themselves when they lose focus
 	/*virtual*/ void onFocusLost();
 	
-private:
+protected:
 	LLFrameTimer		mCloseTimer;
 	LLFrameTimer		mOpenTimer;
 };
diff --git a/indra/newview/llinspectavatar.cpp b/indra/newview/llinspectavatar.cpp
index dae980feb15..0374a1d25b0 100644
--- a/indra/newview/llinspectavatar.cpp
+++ b/indra/newview/llinspectavatar.cpp
@@ -93,6 +93,10 @@ class LLInspectAvatar : public LLInspect
 	// Update view based on information from avatar properties processor
 	void processAvatarData(LLAvatarData* data);
 	
+	// override the inspector mouse leave so timer is only paused if 
+	// gear menu is not open
+	/* virtual */ void onMouseLeave(S32 x, S32 y, MASK mask);
+	
 private:
 	// Make network requests for all the data to display in this view.
 	// Used on construction and if avatar id changes.
@@ -112,6 +116,7 @@ class LLInspectAvatar : public LLInspect
 	void onClickAddFriend();
 	void onClickViewProfile();
 	void onClickIM();
+	void onClickCall();
 	void onClickTeleport();
 	void onClickInviteToGroup();
 	void onClickPay();
@@ -204,6 +209,7 @@ LLInspectAvatar::LLInspectAvatar(const LLSD& sd)
 	mCommitCallbackRegistrar.add("InspectAvatar.AddFriend",	boost::bind(&LLInspectAvatar::onClickAddFriend, this));	
 	mCommitCallbackRegistrar.add("InspectAvatar.IM",
 		boost::bind(&LLInspectAvatar::onClickIM, this));	
+	mCommitCallbackRegistrar.add("InspectAvatar.Call",		boost::bind(&LLInspectAvatar::onClickCall, this));	
 	mCommitCallbackRegistrar.add("InspectAvatar.Teleport",	boost::bind(&LLInspectAvatar::onClickTeleport, this));	
 	mCommitCallbackRegistrar.add("InspectAvatar.InviteToGroup",	boost::bind(&LLInspectAvatar::onClickInviteToGroup, this));	
 	mCommitCallbackRegistrar.add("InspectAvatar.Pay",	boost::bind(&LLInspectAvatar::onClickPay, this));	
@@ -257,8 +263,6 @@ BOOL LLInspectAvatar::postBuild(void)
 }
 
 
-
-
 // Multiple calls to showInstance("inspect_avatar", foo) will provide different
 // LLSD for foo, which we will catch here.
 //virtual
@@ -274,7 +278,7 @@ void LLInspectAvatar::onOpen(const LLSD& data)
 	
 	getChild<LLUICtrl>("gear_self_btn")->setVisible(self);
 	getChild<LLUICtrl>("gear_btn")->setVisible(!self);
-	
+
 	// Position the inspector relative to the mouse cursor
 	// Similar to how tooltips are positioned
 	// See LLToolTipMgr::createToolTip
@@ -382,11 +386,25 @@ void LLInspectAvatar::processAvatarData(LLAvatarData* data)
 	mPropertiesRequest = NULL;
 }
 
+// For the avatar inspector, we only want to unpause the fade timer 
+// if neither the gear menu or self gear menu are open
+void LLInspectAvatar::onMouseLeave(S32 x, S32 y, MASK mask)
+{
+	LLMenuGL* gear_menu = getChild<LLMenuButton>("gear_btn")->getMenu();
+	LLMenuGL* gear_menu_self = getChild<LLMenuButton>("gear_self_btn")->getMenu();
+	if ( !(gear_menu && gear_menu->getVisible()) &&
+		 !(gear_menu_self && gear_menu_self->getVisible()))
+	{
+		mOpenTimer.unpause();
+	}
+}
+
 void LLInspectAvatar::updateModeratorPanel()
 {
 	bool enable_moderator_panel = false;
 
-    if (LLVoiceChannel::getCurrentVoiceChannel())
+    if (LLVoiceChannel::getCurrentVoiceChannel() &&
+		mAvatarID != gAgent.getID())
     {
 		LLUUID session_id = LLVoiceChannel::getCurrentVoiceChannel()->getSessionID();
 
@@ -400,6 +418,7 @@ void LLInspectAvatar::updateModeratorPanel()
 				LLPointer<LLSpeaker> selected_speakerp = speaker_mgr->findSpeaker(mAvatarID);
 				
 				if(speaker_mgr->isVoiceActive() && selected_speakerp && 
+					selected_speakerp->isInVoiceChannel() &&
 					((self_speakerp && self_speakerp->mIsModerator) || gAgent.isGodlike()))
 				{
 					getChild<LLUICtrl>("enable_voice")->setVisible(selected_speakerp->mModeratorMutedVoice);
@@ -497,42 +516,58 @@ void LLInspectAvatar::toggleSelectedVoice(bool enabled)
 
 void LLInspectAvatar::updateVolumeSlider()
 {
-	// By convention, we only display and toggle voice mutes, not all mutes
-	bool is_muted = LLMuteList::getInstance()->
-						isMuted(mAvatarID, LLMute::flagVoiceChat);
-	bool voice_enabled = gVoiceClient->getVoiceEnabled(mAvatarID);
 
-	LLUICtrl* mute_btn = getChild<LLUICtrl>("mute_btn");
-	mute_btn->setEnabled( voice_enabled );
-	mute_btn->setValue( is_muted );
+	bool voice_enabled = gVoiceClient->getVoiceEnabled(mAvatarID);
 
-	LLUICtrl* volume_slider = getChild<LLUICtrl>("volume_slider");
-	volume_slider->setEnabled( voice_enabled && !is_muted );
-	const F32 DEFAULT_VOLUME = 0.5f;
-	F32 volume;
-	if (is_muted)
+	// Do not display volume slider and mute button if it 
+	// is ourself or we are not in a voice channel together
+	if (!voice_enabled || (mAvatarID == gAgent.getID()))
 	{
-		// it's clearer to display their volume as zero
-		volume = 0.f;
+		getChild<LLUICtrl>("mute_btn")->setVisible(false);
+		getChild<LLUICtrl>("volume_slider")->setVisible(false);
 	}
-	else if (!voice_enabled)
-	{
-		// use nominal value rather than 0
-		volume = DEFAULT_VOLUME;
-	}
-	else
+
+	else 
 	{
-		// actual volume
-		volume = gVoiceClient->getUserVolume(mAvatarID);
+		getChild<LLUICtrl>("mute_btn")->setVisible(true);
+		getChild<LLUICtrl>("volume_slider")->setVisible(true);
 
-		// *HACK: Voice client doesn't have any data until user actually
-		// says something.
-		if (volume == 0.f)
+		// By convention, we only display and toggle voice mutes, not all mutes
+		bool is_muted = LLMuteList::getInstance()->
+							isMuted(mAvatarID, LLMute::flagVoiceChat);
+
+		LLUICtrl* mute_btn = getChild<LLUICtrl>("mute_btn");
+
+		bool is_linden = LLStringUtil::endsWith(mAvatarName, " Linden");
+
+		mute_btn->setEnabled( !is_linden);
+		mute_btn->setValue( is_muted );
+
+		LLUICtrl* volume_slider = getChild<LLUICtrl>("volume_slider");
+		volume_slider->setEnabled( !is_muted );
+
+		const F32 DEFAULT_VOLUME = 0.5f;
+		F32 volume;
+		if (is_muted)
 		{
-			volume = DEFAULT_VOLUME;
+			// it's clearer to display their volume as zero
+			volume = 0.f;
 		}
+		else
+		{
+			// actual volume
+			volume = gVoiceClient->getUserVolume(mAvatarID);
+
+			// *HACK: Voice client doesn't have any data until user actually
+			// says something.
+			if (volume == 0.f)
+			{
+				volume = DEFAULT_VOLUME;
+			}
+		}
+		volume_slider->setValue( (F64)volume );
 	}
-	volume_slider->setValue( (F64)volume );
+
 }
 
 void LLInspectAvatar::onClickMuteVolume()
@@ -611,6 +646,12 @@ void LLInspectAvatar::onClickIM()
 	closeFloater();
 }
 
+void LLInspectAvatar::onClickCall()
+{ 
+	LLAvatarActions::startCall(mAvatarID);
+	closeFloater();
+}
+
 void LLInspectAvatar::onClickTeleport()
 {
 	LLAvatarActions::offerTeleport(mAvatarID);
diff --git a/indra/newview/llinspectobject.cpp b/indra/newview/llinspectobject.cpp
index cb35a287e9c..dd313c528d8 100644
--- a/indra/newview/llinspectobject.cpp
+++ b/indra/newview/llinspectobject.cpp
@@ -41,6 +41,7 @@
 #include "llslurl.h"
 #include "llviewermenu.h"		// handle_object_touch(), handle_buy()
 #include "llviewermedia.h"
+#include "llviewermediafocus.h"
 #include "llviewerobjectlist.h"	// to select the requested object
 
 // Linden libraries
@@ -82,6 +83,10 @@ class LLInspectObject : public LLInspect
 	// Release the selection and do other cleanup
 	/*virtual*/ void onClose(bool app_quitting);
 	
+	// override the inspector mouse leave so timer is only paused if 
+	// gear menu is not open
+	/* virtual */ void onMouseLeave(S32 x, S32 y, MASK mask);
+	
 private:
 	// Refresh displayed data with information from selection manager
 	void update();
@@ -181,7 +186,6 @@ BOOL LLInspectObject::postBuild(void)
 	return TRUE;
 }
 
-
 // Multiple calls to showInstance("inspect_avatar", foo) will provide different
 // LLSD for foo, which we will catch here.
 //virtual
@@ -214,6 +218,10 @@ void LLInspectObject::onOpen(const LLSD& data)
 	LLViewerObject* obj = gObjectList.findObject( mObjectID );
 	if (obj)
 	{
+		// Media focus and this code fight over the select manager.  
+		// Make sure any media is unfocused before changing the selection here.
+		LLViewerMediaFocus::getInstance()->clearFocus();
+		
 		LLSelectMgr::instance().deselectAll();
 		mObjectSelection = LLSelectMgr::instance().selectObjectAndFamily(obj);
 
@@ -562,6 +570,16 @@ void LLInspectObject::updateSecureBrowsing()
 	getChild<LLUICtrl>("secure_browsing")->setVisible(is_secure_browsing);
 }
 
+// For the object inspector, only unpause the fade timer 
+// if the gear menu is not open
+void LLInspectObject::onMouseLeave(S32 x, S32 y, MASK mask)
+{
+	LLMenuGL* gear_menu = getChild<LLMenuButton>("gear_btn")->getMenu();
+	if ( !(gear_menu && gear_menu->getVisible()))
+	{
+		mOpenTimer.unpause();
+	}
+}
 
 void LLInspectObject::onClickBuy()
 {
diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp
index d70221b22ae..099f863dc90 100644
--- a/indra/newview/llinventorybridge.cpp
+++ b/indra/newview/llinventorybridge.cpp
@@ -2074,7 +2074,12 @@ void LLFolderBridge::performAction(LLFolderView* folder, LLInventoryModel* model
 {
 	if ("open" == action)
 	{
-		openItem();
+		LLFolderViewFolder *f = dynamic_cast<LLFolderViewFolder *>(folder->getItemByID(mUUID));
+		if (f)
+		{
+			f->setOpen(TRUE);
+		}
+		
 		return;
 	}
 	else if ("paste" == action)
@@ -2228,9 +2233,22 @@ LLUIImagePtr LLFolderBridge::getIcon() const
 LLUIImagePtr LLFolderBridge::getIcon(LLFolderType::EType preferred_type)
 {
 	// we only have one folder image now
+	if (preferred_type == LLFolderType::FT_OUTFIT)
+	{
+		return LLUI::getUIImage("Inv_LookFolderClosed");
+	}
 	return LLUI::getUIImage("Inv_FolderClosed");
 }
 
+LLUIImagePtr LLFolderBridge::getOpenIcon() const
+{
+	if (getPreferredType() == LLFolderType::FT_OUTFIT)
+	{
+		return LLUI::getUIImage("Inv_LookFolderOpen");
+	}
+	return LLUI::getUIImage("Inv_FolderOpen");
+}
+
 BOOL LLFolderBridge::renameItem(const std::string& new_name)
 {
 	if(!isItemRenameable())
@@ -2430,7 +2448,7 @@ void LLFolderBridge::folderOptionsMenu()
 
 	const LLInventoryCategory* category = model->getCategory(mUUID);
 	LLFolderType::EType type = category->getPreferredType();
-	const bool is_default_folder = category && LLFolderType::lookupIsProtectedType(type);
+	const bool is_system_folder = category && LLFolderType::lookupIsProtectedType(type);
 	// BAP change once we're no longer treating regular categories as ensembles.
 	const bool is_ensemble = category && (type == LLFolderType::FT_NONE ||
 										  LLFolderType::lookupIsEnsembleType(type));
@@ -2444,8 +2462,8 @@ void LLFolderBridge::folderOptionsMenu()
 		mItems.push_back("Delete");
 	}
 
-	// Only enable calling-card related options for non-default folders.
-	if (!is_sidepanel && !is_default_folder)
+	// Only enable calling-card related options for non-system folders.
+	if (!is_sidepanel && !is_system_folder)
 	{
 		LLIsType is_callingcard(LLAssetType::AT_CALLINGCARD);
 		if (mCallingCards || checkFolderForContentsOfType(model, is_callingcard))
@@ -2479,10 +2497,14 @@ void LLFolderBridge::folderOptionsMenu()
 			mItems.push_back(std::string("Folder Wearables Separator"));
 		}
 
-		// Only enable add/replace outfit for non-default folders.
-		if (!is_default_folder)
+		// Only enable add/replace outfit for non-system folders.
+		if (!is_system_folder)
 		{
-			mItems.push_back(std::string("Add To Outfit"));
+			// Adding an outfit onto another (versus replacing) doesn't make sense.
+			if (type != LLFolderType::FT_OUTFIT)
+			{
+				mItems.push_back(std::string("Add To Outfit"));
+			}
 			mItems.push_back(std::string("Replace Outfit"));
 		}
 		if (is_ensemble)
@@ -2614,6 +2636,13 @@ void LLFolderBridge::buildContextMenu(LLMenuGL& menu, U32 flags)
 			{
 				mItems.push_back(std::string("Rename"));
 				mItems.push_back(std::string("Delete"));
+
+				// EXT-4030: disallow deletion of currently worn outfit
+				const LLViewerInventoryItem *base_outfit_link = LLAppearanceManager::instance().getBaseOutfitLink();
+				if (base_outfit_link && (cat == base_outfit_link->getLinkedCategory()))
+				{
+					mDisabledItems.push_back(std::string("Delete"));
+				}
 			}
 		}
 
@@ -2902,80 +2931,6 @@ bool move_task_inventory_callback(const LLSD& notification, const LLSD& response
 	return false;
 }
 
-/*
-Next functions intended to reorder items in the inventory folder and save order on server
-Is now used for Favorites folder.
-
-*TODO: refactoring is needed with Favorites Bar functionality. Probably should be moved in LLInventoryModel
-*/
-void saveItemsOrder(LLInventoryModel::item_array_t& items)
-{
-	int sortField = 0;
-
-	// current order is saved by setting incremental values (1, 2, 3, ...) for the sort field
-	for (LLInventoryModel::item_array_t::iterator i = items.begin(); i != items.end(); ++i)
-	{
-		LLViewerInventoryItem* item = *i;
-
-		item->setSortField(++sortField);
-		item->setComplete(TRUE);
-		item->updateServer(FALSE);
-
-		gInventory.updateItem(item);
-
-		// Tell the parent folder to refresh its sort order.
-		gInventory.addChangedMask(LLInventoryObserver::SORT, item->getParentUUID());
-	}
-
-	gInventory.notifyObservers();
-}
-
-LLInventoryModel::item_array_t::iterator findItemByUUID(LLInventoryModel::item_array_t& items, const LLUUID& id)
-{
-	LLInventoryModel::item_array_t::iterator result = items.end();
-
-	for (LLInventoryModel::item_array_t::iterator i = items.begin(); i != items.end(); ++i)
-	{
-		if ((*i)->getUUID() == id)
-		{
-			result = i;
-			break;
-		}
-	}
-
-	return result;
-}
-
-// See also LLInventorySort where landmarks in the Favorites folder are sorted.
-class LLViewerInventoryItemSort
-{
-public:
-	bool operator()(const LLPointer<LLViewerInventoryItem>& a, const LLPointer<LLViewerInventoryItem>& b)
-	{
-		return a->getSortField() < b->getSortField();
-	}
-};
-
-/**
- * Sorts passed items by LLViewerInventoryItem sort field.
- *
- * @param[in, out] items - array of items, not sorted.
- */
-void rearrange_item_order_by_sort_field(LLInventoryModel::item_array_t& items)
-{
-	static LLViewerInventoryItemSort sort_functor;
-	std::sort(items.begin(), items.end(), sort_functor);
-}
-
-void updateItemsOrder(LLInventoryModel::item_array_t& items, const LLUUID& srcItemId, const LLUUID& destItemId)
-{
-	LLViewerInventoryItem* srcItem = gInventory.getItem(srcItemId);
-	LLViewerInventoryItem* destItem = gInventory.getItem(destItemId);
-
-	items.erase(findItemByUUID(items, srcItem->getUUID()));
-	items.insert(findItemByUUID(items, destItem->getUUID()), srcItem);
-}
-
 BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item,
 										BOOL drop)
 {
@@ -3058,36 +3013,34 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item,
 			// if dragging from/into favorites folder only reorder items
 			if ((mUUID == inv_item->getParentUUID()) && folder_allows_reorder)
 			{
-				LLInventoryModel::cat_array_t cats;
-				LLInventoryModel::item_array_t items;
-				LLIsType is_type(LLAssetType::AT_LANDMARK);
-				model->collectDescendentsIf(mUUID, cats, items, LLInventoryModel::EXCLUDE_TRASH, is_type);
-
 				LLInventoryPanel* panel = dynamic_cast<LLInventoryPanel*>(mInventoryPanel.get());
 				LLFolderViewItem* itemp = panel ? panel->getRootFolder()->getDraggingOverItem() : NULL;
 				if (itemp)
 				{
 					LLUUID srcItemId = inv_item->getUUID();
 					LLUUID destItemId = itemp->getListener()->getUUID();
-
-					// ensure items are sorted properly before changing order. EXT-3498
-					rearrange_item_order_by_sort_field(items);
-
-					// update order
-					updateItemsOrder(items, srcItemId, destItemId);
-
-					saveItemsOrder(items);
+					gInventory.rearrangeFavoriteLandmarks(srcItemId, destItemId);
 				}
 			}
 			else if (favorites_id == mUUID) // if target is the favorites folder we use copy
 			{
+				// use callback to rearrange favorite landmarks after adding
+				// to have new one placed before target (on which it was dropped). See EXT-4312.
+				LLPointer<AddFavoriteLandmarkCallback> cb = new AddFavoriteLandmarkCallback();
+				LLInventoryPanel* panel = dynamic_cast<LLInventoryPanel*>(mInventoryPanel.get());
+				LLFolderViewItem* drag_over_item = panel ? panel->getRootFolder()->getDraggingOverItem() : NULL;
+				if (drag_over_item && drag_over_item->getListener())
+				{
+					cb.get()->setTargetLandmarkId(drag_over_item->getListener()->getUUID());
+				}
+
 				copy_inventory_item(
 					gAgent.getID(),
 					inv_item->getPermissions().getOwner(),
 					inv_item->getUUID(),
 					mUUID,
 					std::string(),
-					LLPointer<LLInventoryCallback>(NULL));
+					cb);
 			}
 			else if (move_is_into_current_outfit || move_is_into_outfit)
 			{
diff --git a/indra/newview/llinventorybridge.h b/indra/newview/llinventorybridge.h
index cc1fa45b269..fced0047e8c 100644
--- a/indra/newview/llinventorybridge.h
+++ b/indra/newview/llinventorybridge.h
@@ -289,6 +289,7 @@ class LLFolderBridge : public LLInvFVBridge
 
 	virtual LLFolderType::EType getPreferredType() const;
 	virtual LLUIImagePtr getIcon() const;
+	virtual LLUIImagePtr getOpenIcon() const;
 	static LLUIImagePtr getIcon(LLFolderType::EType preferred_type);
 
 	virtual BOOL renameItem(const std::string& new_name);
diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp
index 8f4136c01f6..2885ba13fae 100644
--- a/indra/newview/llinventoryfunctions.cpp
+++ b/indra/newview/llinventoryfunctions.cpp
@@ -50,8 +50,7 @@
 // newview includes
 #include "llappearancemgr.h"
 #include "llappviewer.h"
-#include "llfirstuse.h"
-#include "llfloaterchat.h"
+//#include "llfirstuse.h"
 #include "llfloatercustomize.h"
 #include "llfocusmgr.h"
 #include "llfolderview.h"
diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp
index 711114173c9..e44adfb511d 100644
--- a/indra/newview/llinventorymodel.cpp
+++ b/indra/newview/llinventorymodel.cpp
@@ -1994,21 +1994,23 @@ void LLInventoryModel::accountForUpdate(const LLCategoryUpdate& update) const
 				descendents_actual += update.mDescendentDelta;
 				cat->setDescendentCount(descendents_actual);
 				cat->setVersion(++version);
-				llinfos << "accounted: '" << cat->getName() << "' "
-						<< version << " with " << descendents_actual
-						<< " descendents." << llendl;
+				lldebugs << "accounted: '" << cat->getName() << "' "
+						 << version << " with " << descendents_actual
+						 << " descendents." << llendl;
 			}
 		}
 		if(!accounted)
 		{
-			lldebugs << "No accounting for: '" << cat->getName() << "' "
+			// Error condition, this means that the category did not register that
+			// it got new descendents (perhaps because it is still being loaded)
+			// which means its descendent count will be wrong.
+			llwarns << "Accounting failed for '" << cat->getName() << "' version:"
 					 << version << llendl;
 		}
 	}
 	else
 	{
-		llwarns << "No category found for update " << update.mCategoryID
-				<< llendl;
+		llwarns << "No category found for update " << update.mCategoryID << llendl;
 	}
 }
 
@@ -3620,6 +3622,98 @@ BOOL LLInventoryModel::getIsFirstTimeInViewer2()
 	return sFirstTimeInViewer2;
 }
 
+static LLInventoryModel::item_array_t::iterator find_item_iter_by_uuid(LLInventoryModel::item_array_t& items, const LLUUID& id)
+{
+	LLInventoryModel::item_array_t::iterator result = items.end();
+
+	for (LLInventoryModel::item_array_t::iterator i = items.begin(); i != items.end(); ++i)
+	{
+		if ((*i)->getUUID() == id)
+		{
+			result = i;
+			break;
+		}
+	}
+
+	return result;
+}
+
+// static
+void LLInventoryModel::updateItemsOrder(LLInventoryModel::item_array_t& items, const LLUUID& src_item_id, const LLUUID& dest_item_id)
+{
+	LLInventoryModel::item_array_t::iterator it_src = find_item_iter_by_uuid(items, src_item_id);
+	LLInventoryModel::item_array_t::iterator it_dest = find_item_iter_by_uuid(items, dest_item_id);
+
+	if (it_src == items.end() || it_dest == items.end()) return;
+
+	LLViewerInventoryItem* src_item = *it_src;
+	items.erase(it_src);
+	
+	// target iterator can not be valid because the container was changed, so update it.
+	it_dest = find_item_iter_by_uuid(items, dest_item_id);
+	items.insert(it_dest, src_item);
+}
+
+void LLInventoryModel::saveItemsOrder(const LLInventoryModel::item_array_t& items)
+{
+	int sortField = 0;
+
+	// current order is saved by setting incremental values (1, 2, 3, ...) for the sort field
+	for (item_array_t::const_iterator i = items.begin(); i != items.end(); ++i)
+	{
+		LLViewerInventoryItem* item = *i;
+
+		item->setSortField(++sortField);
+		item->setComplete(TRUE);
+		item->updateServer(FALSE);
+
+		updateItem(item);
+
+		// Tell the parent folder to refresh its sort order.
+		addChangedMask(LLInventoryObserver::SORT, item->getParentUUID());
+	}
+
+	notifyObservers();
+}
+
+// See also LLInventorySort where landmarks in the Favorites folder are sorted.
+class LLViewerInventoryItemSort
+{
+public:
+	bool operator()(const LLPointer<LLViewerInventoryItem>& a, const LLPointer<LLViewerInventoryItem>& b)
+	{
+		return a->getSortField() < b->getSortField();
+	}
+};
+
+/**
+ * Sorts passed items by LLViewerInventoryItem sort field.
+ *
+ * @param[in, out] items - array of items, not sorted.
+ */
+static void rearrange_item_order_by_sort_field(LLInventoryModel::item_array_t& items)
+{
+	static LLViewerInventoryItemSort sort_functor;
+	std::sort(items.begin(), items.end(), sort_functor);
+}
+
+void LLInventoryModel::rearrangeFavoriteLandmarks(const LLUUID& source_item_id, const LLUUID& target_item_id)
+{
+	LLInventoryModel::cat_array_t cats;
+	LLInventoryModel::item_array_t items;
+	LLIsType is_type(LLAssetType::AT_LANDMARK);
+	LLUUID favorites_id = gInventory.findCategoryUUIDForType(LLFolderType::FT_FAVORITE);
+	gInventory.collectDescendentsIf(favorites_id, cats, items, LLInventoryModel::EXCLUDE_TRASH, is_type);
+
+	// ensure items are sorted properly before changing order. EXT-3498
+	rearrange_item_order_by_sort_field(items);
+
+	// update order
+	updateItemsOrder(items, source_item_id, target_item_id);
+
+	saveItemsOrder(items);
+}
+
 //----------------------------------------------------------------------------
 
 // *NOTE: DEBUG functionality
diff --git a/indra/newview/llinventorymodel.h b/indra/newview/llinventorymodel.h
index 39377b4ae24..2a2b48ce3c6 100644
--- a/indra/newview/llinventorymodel.h
+++ b/indra/newview/llinventorymodel.h
@@ -384,6 +384,39 @@ class LLInventoryModel
 	void setLibraryOwnerID(const LLUUID& id);
 	void setLibraryRootFolderID(const LLUUID& id);
 
+
+	/**
+	 * Changes items order by insertion of the item identified by src_item_id
+	 * BEFORE the item identified by dest_item_id. Both items must exist in items array.
+	 *
+	 * Sorting is stored after method is finished. Only src_item_id is moved before dest_item_id.
+	 *
+	 * @param[in, out] items - vector with items to be updated. It should be sorted in a right way
+	 * before calling this method.
+	 * @param src_item_id - LLUUID of inventory item to be moved in new position
+	 * @param dest_item_id - LLUUID of inventory item before which source item should be placed.
+	 */
+	static void updateItemsOrder(LLInventoryModel::item_array_t& items, const LLUUID& src_item_id, const LLUUID& dest_item_id);
+
+	/**
+	 * Saves current order of the passed items using inventory item sort field.
+	 *
+	 * It reset items' sort fields and saves them on server.
+	 * Is used to save order for Favorites folder.
+	 *
+	 * @param[in] items vector of items in order to be saved.
+	 */
+	void saveItemsOrder(const LLInventoryModel::item_array_t& items);
+
+	/**
+	 * Rearranges Landmarks inside Favorites folder.
+	 * Moves source landmark before target one.
+	 *
+	 * @param source_item_id - LLUUID of the source item to be moved into new position
+	 * @param target_item_id - LLUUID of the target item before which source item should be placed.
+	 */
+	void rearrangeFavoriteLandmarks(const LLUUID& source_item_id, const LLUUID& target_item_id);
+
 protected:
 
 	// Internal methods which add inventory and make sure that all of
diff --git a/indra/newview/llinventoryobserver.cpp b/indra/newview/llinventoryobserver.cpp
index 2d9ea21b5f2..2fb8aea4e94 100644
--- a/indra/newview/llinventoryobserver.cpp
+++ b/indra/newview/llinventoryobserver.cpp
@@ -311,10 +311,10 @@ bool LLInventoryFetchDescendentsObserver::isEverythingComplete() const
 
 bool LLInventoryFetchDescendentsObserver::isComplete(LLViewerInventoryCategory* cat)
 {
-	S32 version = cat->getVersion();
-	S32 descendents = cat->getDescendentCount();
-	if((LLViewerInventoryCategory::VERSION_UNKNOWN == version)
-	   || (LLViewerInventoryCategory::DESCENDENT_COUNT_UNKNOWN == descendents))
+	const S32 version = cat->getVersion();
+	const S32 expected_num_descendents = cat->getDescendentCount();
+	if ((version == LLViewerInventoryCategory::VERSION_UNKNOWN) ||
+		(expected_num_descendents == LLViewerInventoryCategory::DESCENDENT_COUNT_UNKNOWN))
 	{
 		return false;
 	}
@@ -325,15 +325,28 @@ bool LLInventoryFetchDescendentsObserver::isComplete(LLViewerInventoryCategory*
 	gInventory.getDirectDescendentsOf(cat->getUUID(), cats, items);
 	if(!cats || !items)
 	{
-		// bit of a hack - pretend we're done if they are gone or
-		// incomplete. should never know, but it would suck if this
-		// kept tight looping because of a corrupt memory state.
+		llwarns << "Category '" << cat->getName() << "' descendents corrupted, fetch failed." << llendl;
+		// NULL means the call failed -- cats/items map doesn't exist (note: this does NOT mean
+		// that the cat just doesn't have any items or subfolders).
+		// Unrecoverable, so just return done so that this observer can be cleared
+		// from memory.
 		return true;
 	}
-	S32 known = cats->count() + items->count();
-	if(descendents == known)
+	const S32 current_num_known_descendents = cats->count() + items->count();
+	
+	// Got the number of descendents that we were expecting, so we're done.
+	if (current_num_known_descendents == expected_num_descendents)
+	{
+		return true;
+	}
+
+	// Error condition, but recoverable.  This happens if something was added to the
+	// category before it was initialized, so accountForUpdate didn't update descendent
+	// count and thus the category thinks it has fewer descendents than it actually has.
+	if (current_num_known_descendents >= expected_num_descendents)
 	{
-		// hey - we're done.
+		llwarns << "Category '" << cat->getName() << "' expected descendentcount:" << expected_num_descendents << " descendents but got descendentcount:" << current_num_known_descendents << llendl;
+		cat->setDescendentCount(current_num_known_descendents);
 		return true;
 	}
 	return false;
@@ -352,7 +365,7 @@ void LLInventoryFetchComboObserver::changed(U32 mask)
 				continue;
 			}
 			if(item->isComplete())
-			{
+		{	
 				mCompleteItems.push_back(*it);
 				it = mIncompleteItems.erase(it);
 				continue;
diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp
index 164e72e6219..9141d50829c 100644
--- a/indra/newview/llinventorypanel.cpp
+++ b/indra/newview/llinventorypanel.cpp
@@ -98,10 +98,6 @@ LLInventoryPanel::LLInventoryPanel(const LLInventoryPanel::Params& p) :
 	mCommitCallbackRegistrar.add("Inventory.AttachObject", boost::bind(&LLInventoryPanel::attachObject, this, _2));
 	mCommitCallbackRegistrar.add("Inventory.BeginIMSession", boost::bind(&LLInventoryPanel::beginIMSession, this));
 	
-	setBackgroundColor(LLUIColorTable::instance().getColor("InventoryBackgroundColor"));
-	setBackgroundVisible(TRUE);
-	setBackgroundOpaque(TRUE);
-	
 	if (mStartFolderString != "")
 	{
 		mBuildDefaultHierarchy = false;
@@ -433,11 +429,10 @@ void LLInventoryPanel::initializeViews()
 	{
 		mStartFolderID = (preferred_type != LLFolderType::FT_NONE ? gInventory.findCategoryUUIDForType(preferred_type) : LLUUID::null);
 	}
-	llinfos << this << " Generating views for start folder " << mStartFolderString << llendl;
 	rebuildViewsFor(mStartFolderID);
 
 	mViewsInitialized = true;
-	defaultOpenInventory();
+	openStartFolderOrMyInventory();
 }
 
 void LLInventoryPanel::rebuildViewsFor(const LLUUID& id)
@@ -491,13 +486,14 @@ void LLInventoryPanel::buildNewViews(const LLUUID& id)
 			
 			if (new_listener)
 			{
-				LLFolderViewFolder::Params p;
-				p.name = new_listener->getDisplayName();
-				p.icon = new_listener->getIcon();
-				p.root = mFolders;
-				p.listener = new_listener;
-				p.tool_tip = p.name;
-				LLFolderViewFolder* folderp = LLUICtrlFactory::create<LLFolderViewFolder>(p);
+				LLFolderViewFolder::Params params;
+				params.name = new_listener->getDisplayName();
+				params.icon = new_listener->getIcon();
+				params.icon_open = new_listener->getOpenIcon();
+				params.root = mFolders;
+				params.listener = new_listener;
+				params.tool_tip = params.name;
+				LLFolderViewFolder* folderp = LLUICtrlFactory::create<LLFolderViewFolder>(params);
 				folderp->setItemSortOrder(mFolders->getSortOrder());
 				itemp = folderp;
 
@@ -523,12 +519,13 @@ void LLInventoryPanel::buildNewViews(const LLUUID& id)
 			if (new_listener)
 			{
 				LLFolderViewItem::Params params;
-				params.name(new_listener->getDisplayName());
-				params.icon(new_listener->getIcon());
-				params.creation_date(new_listener->getCreationDate());
-				params.root(mFolders);
-				params.listener(new_listener);
-				params.rect(LLRect (0, 0, 0, 0));
+				params.name = new_listener->getDisplayName();
+				params.icon = new_listener->getIcon();
+				params.icon_open = new_listener->getOpenIcon();
+				params.creation_date = new_listener->getCreationDate();
+				params.root = mFolders;
+				params.listener = new_listener;
+				params.rect = LLRect (0, 0, 0, 0);
 				params.tool_tip = params.name;
 				itemp = LLUICtrlFactory::create<LLFolderViewItem> (params);
 			}
@@ -575,7 +572,7 @@ void LLInventoryPanel::buildNewViews(const LLUUID& id)
 }
 
 // bit of a hack to make sure the inventory is open.
-void LLInventoryPanel::defaultOpenInventory()
+void LLInventoryPanel::openStartFolderOrMyInventory()
 {
 	if (mStartFolderString != "")
 	{
@@ -583,13 +580,17 @@ void LLInventoryPanel::defaultOpenInventory()
 	}
 	else
 	{
-		// Get the first child (it should be "My Inventory") and
-		// open it up by name (just to make sure the first child is actually a folder).
-		LLView* first_child = mFolders->getFirstChild();
-		if (first_child)
+		// Find My Inventory folder and open it up by name
+		for (LLView *child = mFolders->getFirstChild(); child; child = mFolders->findNextSibling(child))
 		{
-			const std::string& first_child_name = first_child->getName();
-			mFolders->openFolder(first_child_name);
+			LLFolderViewFolder *fchild = dynamic_cast<LLFolderViewFolder*>(child);
+			if (fchild && fchild->getListener() &&
+				(fchild->getListener()->getUUID() == gInventory.getRootFolderID()))
+			{
+				const std::string& child_name = child->getName();
+				mFolders->openFolder(child_name);
+				break;
+			}
 		}
 	}
 }
diff --git a/indra/newview/llinventorypanel.h b/indra/newview/llinventorypanel.h
index 4f7f0a79f64..09533b52f1e 100644
--- a/indra/newview/llinventorypanel.h
+++ b/indra/newview/llinventorypanel.h
@@ -167,7 +167,7 @@ class LLInventoryPanel : public LLPanel
 	static LLInventoryPanel *getActiveInventoryPanel(BOOL auto_open = TRUE);
 
 protected:
-	void defaultOpenInventory(); // open the first level of inventory
+	void openStartFolderOrMyInventory(); // open the first level of inventory
 
 	LLInventoryModel*			mInventory;
 	LLInventoryObserver*		mInventoryObserver;
diff --git a/indra/newview/lllandmarklist.cpp b/indra/newview/lllandmarklist.cpp
index bd9d22c3270..ce84474c05a 100644
--- a/indra/newview/lllandmarklist.cpp
+++ b/indra/newview/lllandmarklist.cpp
@@ -59,6 +59,13 @@ LLLandmark* LLLandmarkList::getAsset(const LLUUID& asset_uuid, loaded_callback_t
 	LLLandmark* landmark = get_ptr_in_map(mList, asset_uuid);
 	if(landmark)
 	{
+		LLVector3d dummy;
+		if(cb && !landmark->getGlobalPos(dummy))
+		{
+			// landmark is not completely loaded yet
+			loaded_callback_map_t::value_type vt(asset_uuid, cb);
+			mLoadedCallbackMap.insert(vt);
+		}
 		return landmark;
 	}
 	else
diff --git a/indra/newview/lllocationhistory.cpp b/indra/newview/lllocationhistory.cpp
index d910dbf7185..ae1b8f85408 100644
--- a/indra/newview/lllocationhistory.cpp
+++ b/indra/newview/lllocationhistory.cpp
@@ -123,6 +123,12 @@ void LLLocationHistory::save() const
 	// build filename for each user
 	std::string resolved_filename = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, mFilename);
 
+	if (resolved_filename.empty())
+	{
+		llinfos << "can't get path to location history filename - probably not logged in yet." << llendl;
+		return;
+	}
+
 	// open a file for writing
 	llofstream file (resolved_filename);
 	if (!file.is_open())
diff --git a/indra/newview/lllogchat.cpp b/indra/newview/lllogchat.cpp
index fc9654e9adb..4e5aaeb66ad 100644
--- a/indra/newview/lllogchat.cpp
+++ b/indra/newview/lllogchat.cpp
@@ -35,7 +35,6 @@
 #include "llagent.h"
 #include "llagentui.h"
 #include "lllogchat.h"
-#include "llfloaterchat.h"
 #include "lltrans.h"
 #include "llviewercontrol.h"
 
@@ -59,9 +58,6 @@ const static std::string NEW_LINE_SPACE_PREFIX("\n ");
 const static std::string TWO_SPACES("  ");
 const static std::string MULTI_LINE_PREFIX(" ");
 
-//viewer 1.23 may have used "You" for Agent's entries
-const static std::string YOU("You");
-
 /**
  *  Chat log lines - timestamp and name are optional but message text is mandatory.
  *
diff --git a/indra/newview/llmanip.cpp b/indra/newview/llmanip.cpp
index f30821cacf0..a96240e31cc 100644
--- a/indra/newview/llmanip.cpp
+++ b/indra/newview/llmanip.cpp
@@ -436,7 +436,7 @@ void LLManip::renderXYZ(const LLVector3 &vec)
 
 	glPushMatrix();
 	{
-		LLUIImagePtr imagep = LLUI::getUIImage("rounded_square.tga");
+		LLUIImagePtr imagep = LLUI::getUIImage("Rounded_Square");
 		gViewerWindow->setup2DRender();
 		const LLVector2& display_scale = gViewerWindow->getDisplayScale();
 		glScalef(display_scale.mV[VX], display_scale.mV[VY], 1.f);
diff --git a/indra/newview/llmediactrl.cpp b/indra/newview/llmediactrl.cpp
index 93f926b5d01..87ebce1d347 100644
--- a/indra/newview/llmediactrl.cpp
+++ b/indra/newview/llmediactrl.cpp
@@ -84,7 +84,6 @@ LLMediaCtrl::LLMediaCtrl( const Params& p) :
 	mHomePageUrl( "" ),
 	mIgnoreUIScale( true ),
 	mAlwaysRefresh( false ),
-	mExternalUrl( "" ),
 	mMediaSource( 0 ),
 	mTakeFocusOnClick( true ),
 	mCurrentNavUrl( "" ),
@@ -632,6 +631,7 @@ bool LLMediaCtrl::ensureMediaSourceExists()
 			mMediaSource->setHomeURL(mHomePageUrl);
 			mMediaSource->setVisible( getVisible() );
 			mMediaSource->addObserver( this );
+			mMediaSource->setBackgroundColor( getBackgroundColor() );
 			if(mClearCache)
 			{
 				mMediaSource->clearCache();
@@ -671,34 +671,12 @@ LLPluginClassMedia* LLMediaCtrl::getMediaPlugin()
 //
 void LLMediaCtrl::draw()
 {
-	LLPluginClassMedia* media_plugin = NULL;
-	
-	if(mMediaSource && mMediaSource->hasMedia())
-	{
-		media_plugin = mMediaSource->getMediaPlugin();
-	}
-	else
-	{
-		return;
-	}
-	
-	if(!media_plugin || (!media_plugin->textureValid()))
-	{
-		// Don't try to draw without a valid texture
-		return;
-	}
-
-	LLViewerMediaTexture* media_texture = LLViewerTextureManager::findMediaTexture(mMediaTextureID);
-	
-	if (!media_texture )
-		return;
-	
 	if ( gRestoreGL == 1 )
 	{
 		LLRect r = getRect();
 		reshape( r.getWidth(), r.getHeight(), FALSE );
 		return;
-	};
+	}
 
 	// NOTE: optimization needed here - probably only need to do this once
 	// unless tearoffs change the parent which they probably do.
@@ -712,125 +690,161 @@ void LLMediaCtrl::draw()
 		setFrequentUpdates( false );
 	};
 	
+	bool draw_media = false;
+	
+	LLPluginClassMedia* media_plugin = NULL;
+	LLViewerMediaTexture* media_texture = NULL;
+	
+	if(mMediaSource && mMediaSource->hasMedia())
+	{
+		media_plugin = mMediaSource->getMediaPlugin();
+
+		if(media_plugin && (media_plugin->textureValid()))
+		{
+			media_texture = LLViewerTextureManager::findMediaTexture(mMediaTextureID);
+			if(media_texture)
+			{
+				draw_media = true;
+			}
+		}
+	}
+	
 	if(mHidingInitialLoad)
 	{
 		// If we're hiding loading, don't draw at all.
-		return;
+		draw_media = false;
 	}
 	
-	// alpha off for this
-	LLGLSUIDefault gls_ui;
-	LLGLDisable gls_alphaTest( GL_ALPHA_TEST );
-
-	gGL.pushMatrix();
+	bool background_visible = isBackgroundVisible();
+	bool background_opaque = isBackgroundOpaque();
+	
+	if(draw_media)
 	{
-		if (mIgnoreUIScale)
+		// alpha off for this
+		LLGLSUIDefault gls_ui;
+		LLGLDisable gls_alphaTest( GL_ALPHA_TEST );
+
+		gGL.pushMatrix();
 		{
-			glLoadIdentity();
-			// font system stores true screen origin, need to scale this by UI scale factor
-			// to get render origin for this view (with unit scale)
-			gGL.translatef(floorf(LLFontGL::sCurOrigin.mX * LLUI::sGLScaleFactor.mV[VX]), 
-						floorf(LLFontGL::sCurOrigin.mY * LLUI::sGLScaleFactor.mV[VY]), 
-						LLFontGL::sCurOrigin.mZ);
-		}
+			if (mIgnoreUIScale)
+			{
+				glLoadIdentity();
+				// font system stores true screen origin, need to scale this by UI scale factor
+				// to get render origin for this view (with unit scale)
+				gGL.translatef(floorf(LLFontGL::sCurOrigin.mX * LLUI::sGLScaleFactor.mV[VX]), 
+							floorf(LLFontGL::sCurOrigin.mY * LLUI::sGLScaleFactor.mV[VY]), 
+							LLFontGL::sCurOrigin.mZ);
+			}
 
-		// scale texture to fit the space using texture coords
-		gGL.getTexUnit(0)->bind(media_texture);
-		gGL.color4fv( LLColor4::white.mV );
-		F32 max_u = ( F32 )media_plugin->getWidth() / ( F32 )media_plugin->getTextureWidth();
-		F32 max_v = ( F32 )media_plugin->getHeight() / ( F32 )media_plugin->getTextureHeight();
+			// scale texture to fit the space using texture coords
+			gGL.getTexUnit(0)->bind(media_texture);
+			gGL.color4fv( LLColor4::white.mV );
+			F32 max_u = ( F32 )media_plugin->getWidth() / ( F32 )media_plugin->getTextureWidth();
+			F32 max_v = ( F32 )media_plugin->getHeight() / ( F32 )media_plugin->getTextureHeight();
 
-		LLRect r = getRect();
-		S32 width, height;
-		S32 x_offset = 0;
-		S32 y_offset = 0;
-		
-		if(mStretchToFill)
-		{
-			if(mMaintainAspectRatio)
+			LLRect r = getRect();
+			S32 width, height;
+			S32 x_offset = 0;
+			S32 y_offset = 0;
+			
+			if(mStretchToFill)
 			{
-				F32 media_aspect = (F32)(media_plugin->getWidth()) / (F32)(media_plugin->getHeight());
-				F32 view_aspect = (F32)(r.getWidth()) / (F32)(r.getHeight());
-				if(media_aspect > view_aspect)
+				if(mMaintainAspectRatio)
 				{
-					// max width, adjusted height
-					width = r.getWidth();
-					height = llmin(llmax(llround(width / media_aspect), 0), r.getHeight());
+					F32 media_aspect = (F32)(media_plugin->getWidth()) / (F32)(media_plugin->getHeight());
+					F32 view_aspect = (F32)(r.getWidth()) / (F32)(r.getHeight());
+					if(media_aspect > view_aspect)
+					{
+						// max width, adjusted height
+						width = r.getWidth();
+						height = llmin(llmax(llround(width / media_aspect), 0), r.getHeight());
+					}
+					else
+					{
+						// max height, adjusted width
+						height = r.getHeight();
+						width = llmin(llmax(llround(height * media_aspect), 0), r.getWidth());
+					}
 				}
 				else
 				{
-					// max height, adjusted width
+					width = r.getWidth();
 					height = r.getHeight();
-					width = llmin(llmax(llround(height * media_aspect), 0), r.getWidth());
 				}
 			}
 			else
 			{
-				width = r.getWidth();
-				height = r.getHeight();
+				width = llmin(media_plugin->getWidth(), r.getWidth());
+				height = llmin(media_plugin->getHeight(), r.getHeight());
 			}
-		}
-		else
-		{
-			width = llmin(media_plugin->getWidth(), r.getWidth());
-			height = llmin(media_plugin->getHeight(), r.getHeight());
-		}
-		
-		x_offset = (r.getWidth() - width) / 2;
-		y_offset = (r.getHeight() - height) / 2;		
+			
+			x_offset = (r.getWidth() - width) / 2;
+			y_offset = (r.getHeight() - height) / 2;		
 
-		if(mIgnoreUIScale)
-		{
-			x_offset = llround((F32)x_offset * LLUI::sGLScaleFactor.mV[VX]);
-			y_offset = llround((F32)y_offset * LLUI::sGLScaleFactor.mV[VY]);
-			width = llround((F32)width * LLUI::sGLScaleFactor.mV[VX]);
-			height = llround((F32)height * LLUI::sGLScaleFactor.mV[VY]);
-		}
+			if(mIgnoreUIScale)
+			{
+				x_offset = llround((F32)x_offset * LLUI::sGLScaleFactor.mV[VX]);
+				y_offset = llround((F32)y_offset * LLUI::sGLScaleFactor.mV[VY]);
+				width = llround((F32)width * LLUI::sGLScaleFactor.mV[VX]);
+				height = llround((F32)height * LLUI::sGLScaleFactor.mV[VY]);
+			}
 
-		// draw the browser
-		gGL.setSceneBlendType(LLRender::BT_REPLACE);
-		gGL.begin( LLRender::QUADS );
-		if (! media_plugin->getTextureCoordsOpenGL())
-		{
-			// render using web browser reported width and height, instead of trying to invert GL scale
-			gGL.texCoord2f( max_u, 0.f );
-			gGL.vertex2i( x_offset + width, y_offset + height );
+			// draw the browser
+			gGL.setSceneBlendType(LLRender::BT_REPLACE);
+			gGL.begin( LLRender::QUADS );
+			if (! media_plugin->getTextureCoordsOpenGL())
+			{
+				// render using web browser reported width and height, instead of trying to invert GL scale
+				gGL.texCoord2f( max_u, 0.f );
+				gGL.vertex2i( x_offset + width, y_offset + height );
 
-			gGL.texCoord2f( 0.f, 0.f );
-			gGL.vertex2i( x_offset, y_offset + height );
+				gGL.texCoord2f( 0.f, 0.f );
+				gGL.vertex2i( x_offset, y_offset + height );
 
-			gGL.texCoord2f( 0.f, max_v );
-			gGL.vertex2i( x_offset, y_offset );
+				gGL.texCoord2f( 0.f, max_v );
+				gGL.vertex2i( x_offset, y_offset );
 
-			gGL.texCoord2f( max_u, max_v );
-			gGL.vertex2i( x_offset + width, y_offset );
-		}
-		else
-		{
-			// render using web browser reported width and height, instead of trying to invert GL scale
-			gGL.texCoord2f( max_u, max_v );
-			gGL.vertex2i( x_offset + width, y_offset + height );
+				gGL.texCoord2f( max_u, max_v );
+				gGL.vertex2i( x_offset + width, y_offset );
+			}
+			else
+			{
+				// render using web browser reported width and height, instead of trying to invert GL scale
+				gGL.texCoord2f( max_u, max_v );
+				gGL.vertex2i( x_offset + width, y_offset + height );
 
-			gGL.texCoord2f( 0.f, max_v );
-			gGL.vertex2i( x_offset, y_offset + height );
+				gGL.texCoord2f( 0.f, max_v );
+				gGL.vertex2i( x_offset, y_offset + height );
 
-			gGL.texCoord2f( 0.f, 0.f );
-			gGL.vertex2i( x_offset, y_offset );
+				gGL.texCoord2f( 0.f, 0.f );
+				gGL.vertex2i( x_offset, y_offset );
 
-			gGL.texCoord2f( max_u, 0.f );
-			gGL.vertex2i( x_offset + width, y_offset );
+				gGL.texCoord2f( max_u, 0.f );
+				gGL.vertex2i( x_offset + width, y_offset );
+			}
+			gGL.end();
+			gGL.setSceneBlendType(LLRender::BT_ALPHA);
 		}
-		gGL.end();
-		gGL.setSceneBlendType(LLRender::BT_ALPHA);
+		gGL.popMatrix();
+	
 	}
-	gGL.popMatrix();
-
+	else
+	{
+		// Setting these will make LLPanel::draw draw the opaque background color.
+		setBackgroundVisible(true);
+		setBackgroundOpaque(true);
+	}
+	
 	// highlight if keyboard focus here. (TODO: this needs some work)
 	if ( mBorder && mBorder->getVisible() )
 		mBorder->setKeyboardFocusHighlight( gFocusMgr.childHasKeyboardFocus( this ) );
 
 	
 	LLPanel::draw();
+
+	// Restore the previous values
+	setBackgroundVisible(background_visible);
+	setBackgroundOpaque(background_opaque);
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -862,9 +876,27 @@ bool LLMediaCtrl::onClickLinkExternalTarget(const LLSD& notification, const LLSD
 	S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
 	if ( 0 == option )
 	{
-		// open in external browser because we don't support 
-		// creation of our own secondary browser windows
-		LLWeb::loadURLExternal( notification["payload"]["external_url"].asString() );
+		LLSD payload = notification["payload"];
+		std::string url = payload["url"].asString();
+		S32 target_type = payload["target_type"].asInteger();
+
+		switch (target_type)
+		{
+		case LLPluginClassMedia::TARGET_EXTERNAL:
+			// load target in an external browser
+			LLWeb::loadURLExternal(url);
+			break;
+
+		case LLPluginClassMedia::TARGET_BLANK:
+			// load target in the user's preferred browser
+			LLWeb::loadURL(url);
+			break;
+
+		default:
+			// unsupported link target - shouldn't happen
+			LL_WARNS("LinkTarget") << "Unsupported link target type" << LL_ENDL;
+			break;
+		}
 	}
 	return false;
 }
@@ -978,20 +1010,18 @@ void LLMediaCtrl::handleMediaEvent(LLPluginClassMedia* self, EMediaEvent event)
 void LLMediaCtrl::onClickLinkHref( LLPluginClassMedia* self )
 {
 	// retrieve the event parameters
-	std::string target = self->getClickTarget();
 	std::string url = self->getClickURL();
+	U32 target_type = self->getClickTargetType();
 	
-	// if there is a value for the target
-	if ( !target.empty() )
+	// is there is a target specified for the link?
+	if (target_type == LLPluginClassMedia::TARGET_EXTERNAL ||
+		target_type == LLPluginClassMedia::TARGET_BLANK)
 	{
-		if ( target == "_external" )		
-		{
-			mExternalUrl = url;
-			LLSD payload;
-			payload["external_url"] = mExternalUrl;
-			LLNotificationsUtil::add( "WebLaunchExternalTarget", LLSD(), payload, onClickLinkExternalTarget);
-			return;
-		}
+		LLSD payload;
+		payload["url"] = url;
+		payload["target_type"] = LLSD::Integer(target_type);
+		LLNotificationsUtil::add( "WebLaunchExternalTarget", LLSD(), payload, onClickLinkExternalTarget);
+		return;
 	}
 
 	const std::string protocol1( "http://" );
diff --git a/indra/newview/llmediactrl.h b/indra/newview/llmediactrl.h
index 8f9e6e71797..b0aca3cfa46 100644
--- a/indra/newview/llmediactrl.h
+++ b/indra/newview/llmediactrl.h
@@ -182,7 +182,6 @@ class LLMediaCtrl :
 		bool mOpenLinksInInternalBrowser;
 		bool mTrusted;
 		std::string mHomePageUrl;
-		std::string mExternalUrl;
 		std::string mCurrentNavUrl;
 		bool mIgnoreUIScale;
 		bool mAlwaysRefresh;
diff --git a/indra/newview/llmenucommands.cpp b/indra/newview/llmenucommands.cpp
index a2aef9ba63b..8d950f072d8 100644
--- a/indra/newview/llmenucommands.cpp
+++ b/indra/newview/llmenucommands.cpp
@@ -45,8 +45,7 @@
 #include "llagent.h"
 #include "llcallingcard.h"
 #include "llviewercontrol.h"
-#include "llfirstuse.h"
-#include "llfloaterchat.h"
+//#include "llfirstuse.h"
 #include "llfloaterworldmap.h"
 #include "lllineeditor.h"
 #include "llstatusbar.h"
diff --git a/indra/newview/llmorphview.cpp b/indra/newview/llmorphview.cpp
index f562e457704..b95e8bd3a2d 100644
--- a/indra/newview/llmorphview.cpp
+++ b/indra/newview/llmorphview.cpp
@@ -40,7 +40,7 @@
 #include "lldrawable.h"
 #include "lldrawpoolavatar.h"
 #include "llface.h"
-#include "llfirstuse.h"
+//#include "llfirstuse.h"
 #include "llfloatercustomize.h"
 #include "llfloatertools.h"
 #include "llresmgr.h"
@@ -143,7 +143,7 @@ void LLMorphView::setVisible(BOOL visible)
 			initialize();
 
 			// First run dialog
-			LLFirstUse::useAppearance();
+			//LLFirstUse::useAppearance();
 		}
 		else
 		{
diff --git a/indra/newview/llmutelist.cpp b/indra/newview/llmutelist.cpp
index b520bc1c2d3..7ee4c64f8fb 100644
--- a/indra/newview/llmutelist.cpp
+++ b/indra/newview/llmutelist.cpp
@@ -64,7 +64,7 @@
 #include "llviewerwindow.h"
 #include "llworld.h" //for particle system banning
 #include "llchat.h"
-#include "llfloaterchat.h"
+#include "llimpanel.h"
 #include "llimview.h"
 #include "llnotifications.h"
 #include "lluistring.h"
@@ -258,7 +258,7 @@ LLMuteList::~LLMuteList()
 {
 	// If we quit from the login screen we will not have an SL account
 	// name.  Don't try to save, otherwise we'll dump a file in
-	// C:\Program Files\SecondLife\  JC
+	// C:\Program Files\SecondLife\ or similar. JC
 	std::string user_dir = gDirUtilp->getLindenUserDir();
 	if (!user_dir.empty())
 	{
@@ -532,9 +532,6 @@ void notify_automute_callback(const LLUUID& agent_id, const std::string& first_n
 
 			LLIMModel::getInstance()->addMessage(agent_id, SYSTEM_FROM, LLUUID::null, message);
 		}
-
-		LLChat auto_chat(message);
-		LLFloaterChat::addChat(auto_chat, FALSE, FALSE);
 	}
 }
 
diff --git a/indra/newview/llnamebox.cpp b/indra/newview/llnamebox.cpp
index 2f4a2661985..cd810b9793b 100644
--- a/indra/newview/llnamebox.cpp
+++ b/indra/newview/llnamebox.cpp
@@ -52,6 +52,8 @@ LLNameBox::LLNameBox(const Params& p)
 :	LLTextBox(p)
 {
 	mNameID = LLUUID::null;
+	mLink = p.link;
+	mInitialValue = p.initial_value().asString();
 	LLNameBox::sInstances.insert(this);
 	setText(LLStringUtil::null);
 }
@@ -66,17 +68,23 @@ void LLNameBox::setNameID(const LLUUID& name_id, BOOL is_group)
 	mNameID = name_id;
 
 	std::string name;
+	BOOL got_name = FALSE;
 
 	if (!is_group)
 	{
-		gCacheName->getFullName(name_id, name);
+		got_name = gCacheName->getFullName(name_id, name);
 	}
 	else
 	{
-		gCacheName->getGroupName(name_id, name);
+		got_name = gCacheName->getGroupName(name_id, name);
 	}
 
-	setText(name);
+	// Got the name already? Set it.
+	// Otherwise it will be set later in refresh().
+	if (got_name)
+		setName(name, is_group);
+	else
+		setText(mInitialValue);
 }
 
 void LLNameBox::refresh(const LLUUID& id, const std::string& firstname,
@@ -93,7 +101,7 @@ void LLNameBox::refresh(const LLUUID& id, const std::string& firstname,
 		{
 			name = firstname;
 		}
-		setText(name);
+		setName(name, is_group);
 	}
 }
 
@@ -109,3 +117,22 @@ void LLNameBox::refreshAll(const LLUUID& id, const std::string& firstname,
 		box->refresh(id, firstname, lastname, is_group);
 	}
 }
+
+void LLNameBox::setName(const std::string& name, BOOL is_group)
+{
+	if (mLink)
+	{
+		std::string url;
+
+		if (is_group)
+			url = "[secondlife:///app/group/" + LLURI::escape(name) + "/about " + name + "]";
+		else
+			url = "[secondlife:///app/agent/" + mNameID.asString() + "/about " + name + "]";
+
+		setText(url);
+	}
+	else
+	{
+		setText(name);
+	}
+}
diff --git a/indra/newview/llnamebox.h b/indra/newview/llnamebox.h
index 3edb36883f9..48b54faec8f 100644
--- a/indra/newview/llnamebox.h
+++ b/indra/newview/llnamebox.h
@@ -47,9 +47,11 @@ class LLNameBox
 	struct Params : public LLInitParam::Block<Params, LLTextBox::Params>
 	{
 		Optional<bool>		is_group;
+		Optional<bool>		link;
 
 		Params()
 		:	is_group("is_group", false)
+		,	link("link", false)
 		{}
 	};
 
@@ -67,10 +69,14 @@ class LLNameBox
 
 	friend class LLUICtrlFactory;
 private:
+	void setName(const std::string& name, BOOL is_group);
+
 	static std::set<LLNameBox*> sInstances;
 
 private:
 	LLUUID mNameID;
+	BOOL mLink;
+	std::string mInitialValue;
 
 };
 
diff --git a/indra/newview/llnamelistctrl.cpp b/indra/newview/llnamelistctrl.cpp
index 7e6145f578f..6375362ae28 100644
--- a/indra/newview/llnamelistctrl.cpp
+++ b/indra/newview/llnamelistctrl.cpp
@@ -74,12 +74,12 @@ void LLNameListCtrl::addNameItem(const LLUUID& agent_id, EAddPosition pos,
 {
 	//llinfos << "LLNameListCtrl::addNameItem " << agent_id << llendl;
 
-	std::string fullname;
-	gCacheName->getFullName(agent_id, fullname);
-
-	fullname.append(suffix);
+	NameItem item;
+	item.value = agent_id;
+	item.enabled = enabled;
+	item.target = INDIVIDUAL;
 
-	addStringUUIDItem(fullname, agent_id, pos, enabled);
+	addNameItemRow(item, pos);
 }
 
 // virtual, public
@@ -130,11 +130,12 @@ BOOL LLNameListCtrl::handleDragAndDrop(
 	return handled;
 }
 
-void LLNameListCtrl::showAvatarInspector(const LLUUID& avatar_id)
+void LLNameListCtrl::showInspector(const LLUUID& avatar_id, bool is_group)
 {
-	LLSD key;
-	key["avatar_id"] = avatar_id;
-	LLFloaterReg::showInstance("inspect_avatar", key);
+	if (is_group)
+		LLFloaterReg::showInstance("inspect_group", LLSD().with("group_id", avatar_id));
+	else
+		LLFloaterReg::showInstance("inspect_avatar", LLSD().with("avatar_id", avatar_id));
 }
 
 //virtual
@@ -147,7 +148,7 @@ BOOL LLNameListCtrl::handleToolTip(S32 x, S32 y, MASK mask)
 		&& column_index == mNameColumnIndex)
 	{
 		// ...this is the column with the avatar name
-		LLUUID avatar_id = hit_item->getValue().asUUID();
+		LLUUID avatar_id = getItemId(hit_item);
 		if (avatar_id.notNull())
 		{
 			// ...valid avatar id
@@ -164,9 +165,12 @@ BOOL LLNameListCtrl::handleToolTip(S32 x, S32 y, MASK mask)
 				LLCoordGL pos( sticky_rect.mRight - 16, sticky_rect.mTop );
 				LLPointer<LLUIImage> icon = LLUI::getUIImage("Info_Small");
 
+				// Should we show a group or an avatar inspector?
+				bool is_group = hit_item->getValue()["is_group"].asBoolean();
+
 				LLToolTip::Params params;
 				params.background_visible( false );
-				params.click_callback( boost::bind(&LLNameListCtrl::showAvatarInspector, this, avatar_id) );
+				params.click_callback( boost::bind(&LLNameListCtrl::showInspector, this, avatar_id, is_group) );
 				params.delay_time(0.0f);		// spawn instantly on hover
 				params.image( icon );
 				params.message("");
@@ -220,9 +224,22 @@ LLScrollListItem* LLNameListCtrl::addElement(const LLSD& element, EAddPosition p
 }
 
 
-LLScrollListItem* LLNameListCtrl::addNameItemRow(const LLNameListCtrl::NameItem& name_item, EAddPosition pos)
+LLScrollListItem* LLNameListCtrl::addNameItemRow(
+	const LLNameListCtrl::NameItem& name_item,
+	EAddPosition pos,
+	std::string& suffix)
 {
-	LLScrollListItem* item = LLScrollListCtrl::addRow(name_item, pos);
+	LLUUID id = name_item.value().asUUID();
+	LLScrollListItem* item = NULL;
+
+	// Store item type so that we can invoke the proper inspector.
+	// *TODO Vadim: Is there a more proper way of storing additional item data?
+	{
+		LLNameListCtrl::NameItem name_item_(name_item);
+		name_item_.value = LLSD().with("uuid", id).with("is_group", name_item.target() == GROUP);
+		item = LLScrollListCtrl::addRow(name_item_, pos);
+	}
+
 	if (!item) return NULL;
 
 	// use supplied name by default
@@ -230,7 +247,7 @@ LLScrollListItem* LLNameListCtrl::addNameItemRow(const LLNameListCtrl::NameItem&
 	switch(name_item.target)
 	{
 	case GROUP:
-		gCacheName->getGroupName(name_item.value().asUUID(), fullname);
+		gCacheName->getGroupName(id, fullname);
 		// fullname will be "nobody" if group not found
 		break;
 	case SPECIAL:
@@ -239,7 +256,7 @@ LLScrollListItem* LLNameListCtrl::addNameItemRow(const LLNameListCtrl::NameItem&
 	case INDIVIDUAL:
 		{
 			std::string name;
-			if (gCacheName->getFullName(name_item.value().asUUID(), name))
+			if (gCacheName->getFullName(id, name))
 			{
 				fullname = name;
 			}
@@ -249,6 +266,12 @@ LLScrollListItem* LLNameListCtrl::addNameItemRow(const LLNameListCtrl::NameItem&
 		break;
 	}
 	
+	// Append optional suffix.
+	if (!suffix.empty())
+	{
+		fullname.append(suffix);
+	}
+
 	LLScrollListCell* cell = item->getColumn(mNameColumnIndex);
 	if (cell)
 	{
@@ -270,15 +293,24 @@ LLScrollListItem* LLNameListCtrl::addNameItemRow(const LLNameListCtrl::NameItem&
 // public
 void LLNameListCtrl::removeNameItem(const LLUUID& agent_id)
 {
-	BOOL item_exists = selectByID( agent_id );
-	if(item_exists)
+	// Find the item specified with agent_id.
+	S32 idx = -1;
+	for (item_list::iterator it = getItemList().begin(); it != getItemList().end(); it++)
 	{
-		S32 index = getItemIndex(getFirstSelected());
-		if(index >= 0)
+		LLScrollListItem* item = *it;
+		if (getItemId(item) == agent_id)
 		{
-			deleteSingleItem(index);
+			idx = getItemIndex(item);
+			break;
 		}
 	}
+
+	// Remove it.
+	if (idx >= 0)
+	{
+		selectNthItem(idx); // not sure whether this is needed, taken from previous implementation
+		deleteSingleItem(idx);
+	}
 }
 
 // public
@@ -303,7 +335,7 @@ void LLNameListCtrl::refresh(const LLUUID& id, const std::string& first,
 	for (iter = getItemList().begin(); iter != getItemList().end(); iter++)
 	{
 		LLScrollListItem* item = *iter;
-		if (item->getUUID() == id)
+		if (getItemId(item) == id)
 		{
 			LLScrollListCell* cell = (LLScrollListCell*)item->getColumn(0);
 			cell = item->getColumn(mNameColumnIndex);
@@ -343,3 +375,9 @@ void LLNameListCtrl::updateColumns()
 		}
 	}
 }
+
+// static
+LLUUID LLNameListCtrl::getItemId(LLScrollListItem* item)
+{
+	return item->getValue()["uuid"].asUUID();
+}
diff --git a/indra/newview/llnamelistctrl.h b/indra/newview/llnamelistctrl.h
index d0f0ec4d218..192a3a5afae 100644
--- a/indra/newview/llnamelistctrl.h
+++ b/indra/newview/llnamelistctrl.h
@@ -94,7 +94,7 @@ class LLNameListCtrl
 	void addNameItem(NameItem& item, EAddPosition pos = ADD_BOTTOM);
 
 	/*virtual*/ LLScrollListItem* addElement(const LLSD& element, EAddPosition pos = ADD_BOTTOM, void* userdata = NULL);
-	LLScrollListItem* addNameItemRow(const NameItem& value, EAddPosition pos = ADD_BOTTOM);
+	LLScrollListItem* addNameItemRow(const NameItem& value, EAddPosition pos = ADD_BOTTOM, std::string& suffix = LLStringUtil::null);
 
 	// Add a user to the list by name.  It will be added, the name 
 	// requested from the cache, and updated as necessary.
@@ -121,7 +121,8 @@ class LLNameListCtrl
 
 	/*virtual*/ void updateColumns();
 private:
-	void showAvatarInspector(const LLUUID& avatar_id);
+	void showInspector(const LLUUID& avatar_id, bool is_group);
+	static LLUUID getItemId(LLScrollListItem* item);
 
 private:
 	S32    			mNameColumnIndex;
diff --git a/indra/newview/llnearbychat.cpp b/indra/newview/llnearbychat.cpp
index 2ad82d3e8e8..a7c1e73328e 100644
--- a/indra/newview/llnearbychat.cpp
+++ b/indra/newview/llnearbychat.cpp
@@ -63,7 +63,7 @@
 static const S32 RESIZE_BAR_THICKNESS = 3;
 
 LLNearbyChat::LLNearbyChat(const LLSD& key) 
-	: LLDockableFloater(NULL, false, key)
+	: LLDockableFloater(NULL, false, false, key)
 	,mChatHistory(NULL)
 {
 	
@@ -137,7 +137,7 @@ std::string appendTime()
 	time_t utc_time;
 	utc_time = time_corrected();
 	std::string timeStr ="["+ LLTrans::getString("TimeHour")+"]:["
-		+LLTrans::getString("TimeMin")+"] ";
+		+LLTrans::getString("TimeMin")+"]";
 
 	LLSD substitution;
 
@@ -178,28 +178,8 @@ void	LLNearbyChat::addMessage(const LLChat& chat,bool archive)
 	
 	if (!chat.mMuted)
 	{
-		tmp_chat.mFromName = chat.mFromID != gAgentID ? chat.mFromName : LLTrans::getString("You");
-
-		if (chat.mChatStyle == CHAT_STYLE_IRC)
-		{
-			LLColor4 txt_color = LLUIColorTable::instance().getColor("White");
-			LLViewerChat::getChatColor(chat,txt_color);
-			LLFontGL* fontp = LLViewerChat::getChatFont();
-			std::string font_name = LLFontGL::nameFromFont(fontp);
-			std::string font_size = LLFontGL::sizeFromFont(fontp);
-			LLStyle::Params append_style_params;
-			append_style_params.color(txt_color);
-			append_style_params.readonly_color(txt_color);
-			append_style_params.font.name(font_name);
-			append_style_params.font.size(font_size);
-			append_style_params.font.style = "ITALIC";
-
-			mChatHistory->appendMessage(chat, use_plain_text_chat_history, append_style_params);
-		}
-		else
-		{
-			mChatHistory->appendMessage(chat, use_plain_text_chat_history);
-		}
+		tmp_chat.mFromName = chat.mFromName;
+		mChatHistory->appendMessage(chat, use_plain_text_chat_history);
 	}
 
 	if(archive)
diff --git a/indra/newview/llnearbychatbar.cpp b/indra/newview/llnearbychatbar.cpp
index 8dbaa5ac53a..6cf8bcb4178 100644
--- a/indra/newview/llnearbychatbar.cpp
+++ b/indra/newview/llnearbychatbar.cpp
@@ -48,13 +48,16 @@
 #include "llcommandhandler.h"
 #include "llviewercontrol.h"
 #include "llnavigationbar.h"
+#include "llwindow.h"
+#include "llviewerwindow.h"
+#include "llrootview.h"
 
 S32 LLNearbyChatBar::sLastSpecialChatChannel = 0;
 
 // legacy callback glue
 void send_chat_from_viewer(const std::string& utf8_out_text, EChatType type, S32 channel);
 
-static LLDefaultChildRegistry::Register<LLGestureComboBox> r("gesture_combo_box");
+static LLDefaultChildRegistry::Register<LLGestureComboList> r("gesture_combo_list");
 
 struct LLChatTypeTrigger {
 	std::string name;
@@ -66,13 +69,42 @@ static LLChatTypeTrigger sChatTypeTriggers[] = {
 	{ "/shout"	, CHAT_TYPE_SHOUT}
 };
 
-LLGestureComboBox::LLGestureComboBox(const LLGestureComboBox::Params& p)
-	: LLComboBox(p)
-	, mGestureLabelTimer()
+LLGestureComboList::Params::Params()
+:	combo_button("combo_button"),
+	combo_list("combo_list")
+{
+}
+
+LLGestureComboList::LLGestureComboList(const LLGestureComboList::Params& p)
+:	LLUICtrl(p)
 	, mLabel(p.label)
 	, mViewAllItemIndex(0)
 {
-	setCommitCallback(boost::bind(&LLGestureComboBox::onCommitGesture, this));
+	LLButton::Params button_params = p.combo_button;
+	button_params.follows.flags(FOLLOWS_LEFT|FOLLOWS_BOTTOM|FOLLOWS_RIGHT);
+
+	mButton = LLUICtrlFactory::create<LLButton>(button_params);
+	mButton->reshape(getRect().getWidth(),getRect().getHeight());
+	mButton->setCommitCallback(boost::bind(&LLGestureComboList::onButtonCommit, this));
+
+	addChild(mButton);
+
+	LLScrollListCtrl::Params params = p.combo_list;
+	params.name("GestureComboList");
+	params.commit_callback.function(boost::bind(&LLGestureComboList::onItemSelected, this, _2));
+	params.visible(false);
+	params.commit_on_keyboard_movement(false);
+
+	mList = LLUICtrlFactory::create<LLScrollListCtrl>(params);
+	
+	// *HACK: adding list as a child to NonSideTrayView to make it fully visible without
+	// making it top control (because it would cause problems).
+	gViewerWindow->getNonSideTrayView()->addChild(mList);
+	mList->setVisible(FALSE);
+
+	//****************************Gesture Part********************************/
+
+	setCommitCallback(boost::bind(&LLGestureComboList::onCommitGesture, this));
 
 	// now register us as observer since we have a place to put the results
 	LLGestureManager::instance().addObserver(this);
@@ -80,23 +112,139 @@ LLGestureComboBox::LLGestureComboBox(const LLGestureComboBox::Params& p)
 	// refresh list from current active gestures
 	refreshGestures();
 
-	// This forces using of halign from xml, since LLComboBox
-	// sets it to LLFontGL::LEFT, if text entry is disabled
-	mButton->setHAlign(p.drop_down_button.font_halign);
+	setFocusLostCallback(boost::bind(&LLGestureComboList::hideList, this));
 }
 
-LLGestureComboBox::~LLGestureComboBox()
+BOOL LLGestureComboList::handleKey(KEY key, MASK mask, BOOL called_from_parent)
 {
-	LLGestureManager::instance().removeObserver(this);
+	BOOL handled = FALSE;
+	
+	if (key == KEY_ESCAPE && mask == MASK_NONE )
+	{
+		hideList();
+		handled = TRUE;
+	}
+	else
+	{
+		handled = mList->handleKey(key, mask, called_from_parent);
+	}
+
+	return handled; 		
+}
+
+void LLGestureComboList::showList()
+{
+	LLRect rect = mList->getRect();
+	LLRect screen;
+	mButton->localRectToScreen(getRect(), &screen);
+	
+	// Calculating amount of space between the navigation bar and gestures combo
+	LLNavigationBar* nb = LLNavigationBar::getInstance();
+
+	S32 x, nb_bottom;
+	nb->localPointToScreen(0, 0, &x, &nb_bottom);
+
+	S32 max_height = nb_bottom - screen.mTop;
+	mList->calcColumnWidths();
+	rect.setOriginAndSize(screen.mLeft, screen.mTop, llmax(mList->getMaxContentWidth(),mButton->getRect().getWidth()), max_height);
+
+	mList->setRect(rect);
+	mList->fitContents( llmax(mList->getMaxContentWidth(),mButton->getRect().getWidth()), max_height);
+
+	gFocusMgr.setKeyboardFocus(this);
+
+	// Show the list and push the button down
+	mButton->setToggleState(TRUE);
+	mList->setVisible(TRUE);
+}
+
+void LLGestureComboList::onButtonCommit()
+{
+	if (!mList->getVisible())
+	{
+		// highlight the last selected item from the original selection before potentially selecting a new item
+		// as visual cue to original value of combo box
+		LLScrollListItem* last_selected_item = mList->getLastSelectedItem();
+		if (last_selected_item)
+		{
+			mList->mouseOverHighlightNthItem(mList->getItemIndex(last_selected_item));
+		}
+
+		if (mList->getItemCount() != 0)
+		{
+			showList();
+		}
+	}
+	else
+	{
+		hideList();
+	} 
+}
+
+void LLGestureComboList::hideList()
+{
+	if (mList->getVisible())
+	{
+		mButton->setToggleState(FALSE);
+		mList->setVisible(FALSE);
+		mList->mouseOverHighlightNthItem(-1);
+		gFocusMgr.setKeyboardFocus(NULL);
+	}
+}
+
+S32 LLGestureComboList::getCurrentIndex() const
+{
+	LLScrollListItem* item = mList->getFirstSelected();
+	if( item )
+	{
+		return mList->getItemIndex( item );
+	}
+	return -1;
+}
+
+void LLGestureComboList::onItemSelected(const LLSD& data)
+{
+	const std::string name = mList->getSelectedItemLabel();
+
+	S32 cur_id = getCurrentIndex();
+	mLastSelectedIndex = cur_id;
+	if (cur_id != mList->getItemCount()-1 && cur_id != -1)
+	{
+		mButton->setLabel(name);
+	}
+
+	// hiding the list reasserts the old value stored in the text editor/dropdown button
+	hideList();
+
+	// commit does the reverse, asserting the value in the list
+	onCommit();
+}
+
+void LLGestureComboList::sortByName(bool ascending)
+{
+	mList->sortOnce(0, ascending);
+}
+
+LLSD LLGestureComboList::getValue() const
+{
+	LLScrollListItem* item = mList->getFirstSelected();
+	if( item )
+	{
+		return item->getValue();
+	}
+	else
+	{
+		return LLSD();
+	}
 }
 
-void LLGestureComboBox::refreshGestures()
+void LLGestureComboList::refreshGestures()
 {
 	//store current selection so we can maintain it
 	LLSD cur_gesture = getValue();
-	selectFirstItem();
-	// clear
-	clearRows();
+	
+	mList->selectFirstItem();
+	mList->clearRows();
 	mGestures.clear();
 
 	LLGestureManager::item_map_t::const_iterator it;
@@ -107,7 +255,7 @@ void LLGestureComboBox::refreshGestures()
 		LLMultiGesture* gesture = (*it).second;
 		if (gesture)
 		{
-			addSimpleElement(gesture->mName, ADD_BOTTOM, LLSD(idx));
+			mList->addSimpleElement(gesture->mName, ADD_BOTTOM, LLSD(idx));
 			mGestures.push_back(gesture);
 			idx++;
 		}
@@ -117,23 +265,42 @@ void LLGestureComboBox::refreshGestures()
 
 	// store index followed by the last added Gesture and add View All item at bottom
 	mViewAllItemIndex = idx;
-	addSimpleElement(LLTrans::getString("ViewAllGestures"), ADD_BOTTOM, LLSD(mViewAllItemIndex));
+	
+	mList->addSimpleElement(LLTrans::getString("ViewAllGestures"), ADD_BOTTOM, LLSD(mViewAllItemIndex));
 
 	// Insert label after sorting, at top, with separator below it
-	addSeparator(ADD_TOP);		
-	addSimpleElement(mLabel, ADD_TOP);
+	mList->addSeparator(ADD_TOP);	
+	mList->addSimpleElement(mLabel, ADD_TOP);
 
 	if (cur_gesture.isDefined())
 	{ 
-		selectByValue(cur_gesture);
+		mList->selectByValue(cur_gesture);
+
 	}
 	else
 	{
-		selectFirstItem();
+		mList->selectFirstItem();
 	}
+
+	LLCtrlListInterface* gestures = getListInterface();
+	LLMultiGesture* gesture = NULL;
+	
+	if (gestures)
+	{
+		S32 index = gestures->getSelectedValue().asInteger();
+		if(index > 0)
+			gesture = mGestures.at(index);
+	}
+	
+	if(gesture && LLGestureManager::instance().isGesturePlaying(gesture))
+	{
+		return;
+	}
+	
+	mButton->setLabel(mLabel);
 }
 
-void LLGestureComboBox::onCommitGesture()
+void LLGestureComboList::onCommitGesture()
 {
 	LLCtrlListInterface* gestures = getListInterface();
 	if (gestures)
@@ -164,50 +331,11 @@ void LLGestureComboBox::onCommitGesture()
 			}
 		}
 	}
-
-	mGestureLabelTimer.start();
-	// free focus back to chat bar
-	setFocus(FALSE);
 }
 
-//virtual
-void LLGestureComboBox::draw()
+LLGestureComboList::~LLGestureComboList()
 {
-	// HACK: Leave the name of the gesture in place for a few seconds.
-	const F32 SHOW_GESTURE_NAME_TIME = 2.f;
-	if (mGestureLabelTimer.getStarted() && mGestureLabelTimer.getElapsedTimeF32() > SHOW_GESTURE_NAME_TIME)
-	{
-		LLCtrlListInterface* gestures = getListInterface();
-		if (gestures) gestures->selectFirstItem();
-		mGestureLabelTimer.stop();
-	}
-
-	LLComboBox::draw();
-}
-
-//virtual
-void LLGestureComboBox::showList()
-{
-	LLComboBox::showList();
-
-	// Calculating amount of space between the navigation bar and gestures combo
-	LLNavigationBar* nb = LLNavigationBar::getInstance();
-	S32 x, nb_bottom;
-	nb->localPointToScreen(0, 0, &x, &nb_bottom);
-	
-	S32 list_bottom;
-	mList->localPointToScreen(0, 0, &x, &list_bottom);
-
-	S32 max_height = nb_bottom - list_bottom;
-
-	LLRect rect = mList->getRect();
-	// List overlapped navigation bar, downsize it
-	if (rect.getHeight() > max_height) 
-	{
-		rect.setOriginAndSize(rect.mLeft, rect.mBottom, rect.getWidth(), max_height);
-		mList->setRect(rect);
-		mList->reshape(rect.getWidth(), rect.getHeight());
-	}
+	LLGestureManager::instance().removeObserver(this);
 }
 
 LLNearbyChatBar::LLNearbyChatBar() 
diff --git a/indra/newview/llnearbychatbar.h b/indra/newview/llnearbychatbar.h
index 224118e088d..d9a7403611a 100644
--- a/indra/newview/llnearbychatbar.h
+++ b/indra/newview/llnearbychatbar.h
@@ -42,33 +42,52 @@
 #include "llspeakers.h"
 
 
-class LLGestureComboBox
-	: public LLComboBox
-	, public LLGestureManagerObserver
+class LLGestureComboList
+	: public LLGestureManagerObserver
+	, public LLUICtrl
 {
 public:
-	struct Params : public LLInitParam::Block<Params, LLComboBox::Params> { };
+	struct Params :	public LLInitParam::Block<Params, LLUICtrl::Params>
+	{
+		Optional<LLButton::Params>			combo_button;
+		Optional<LLScrollListCtrl::Params>	combo_list;
+		
+		Params();
+	};
+
 protected:
-	LLGestureComboBox(const Params&);
+	
 	friend class LLUICtrlFactory;
+	LLGestureComboList(const Params&);
+	std::vector<LLMultiGesture*> mGestures;
+	std::string mLabel;
+	LLSD::Integer mViewAllItemIndex;
+
 public:
-	~LLGestureComboBox();
 
+	~LLGestureComboList();
+
+	LLCtrlListInterface* getListInterface()		{ return (LLCtrlListInterface*)mList; };
+	virtual void	showList();
+	virtual void	hideList();
+	virtual BOOL	handleKey(KEY key, MASK mask, BOOL called_from_parent);
+
+	S32				getCurrentIndex() const;
+	void			onItemSelected(const LLSD& data);
+	void			sortByName(bool ascending = true);
 	void refreshGestures();
 	void onCommitGesture();
-	virtual void draw();
+	void onButtonCommit();
+	virtual LLSD	getValue() const;
 
 	// LLGestureManagerObserver trigger
 	virtual void changed() { refreshGestures(); }
 
-protected:
-
-	virtual void showList();
+private:
 
-	LLFrameTimer mGestureLabelTimer;
-	std::vector<LLMultiGesture*> mGestures;
-	std::string mLabel;
-	LLSD::Integer mViewAllItemIndex;
+	LLButton*			mButton;
+	LLScrollListCtrl*	mList;
+	S32                 mLastSelectedIndex;
 };
 
 class LLNearbyChatBar
diff --git a/indra/newview/llnearbychathandler.cpp b/indra/newview/llnearbychathandler.cpp
index 9e13a626b44..c50e049d4c3 100644
--- a/indra/newview/llnearbychathandler.cpp
+++ b/indra/newview/llnearbychathandler.cpp
@@ -302,7 +302,6 @@ LLNearbyChatHandler::LLNearbyChatHandler(e_notification_type type, const LLSD& i
 	channel->setCreatePanelCallback(callback);
 
 	mChannel = LLChannelManager::getInstance()->addChannel(channel);
-	mChannel->setOverflowFormatString("You have %d unread nearby chat messages");
 }
 
 LLNearbyChatHandler::~LLNearbyChatHandler()
@@ -332,25 +331,25 @@ void LLNearbyChatHandler::processChat(const LLChat& chat_msg)
 
 	LLChat& tmp_chat = const_cast<LLChat&>(chat_msg);
 
-	if (tmp_chat.mChatStyle == CHAT_STYLE_IRC)
-	{
-		if(!tmp_chat.mFromName.empty())
-			tmp_chat.mText = tmp_chat.mFromName + tmp_chat.mText.substr(3);
-		else
-			tmp_chat.mText = tmp_chat.mText.substr(3);
-	}
-	
+	LLNearbyChat* nearby_chat = LLFloaterReg::getTypedInstance<LLNearbyChat>("nearby_chat", LLSD());
 	{
 		//sometimes its usefull to have no name at all...
 		//if(tmp_chat.mFromName.empty() && tmp_chat.mFromID!= LLUUID::null)
 		//	tmp_chat.mFromName = tmp_chat.mFromID.asString();
 	}
-	
-	LLNearbyChat* nearby_chat = LLFloaterReg::getTypedInstance<LLNearbyChat>("nearby_chat", LLSD());
 	nearby_chat->addMessage(chat_msg);
 	if(nearby_chat->getVisible())
 		return;//no need in toast if chat is visible
-	
+
+	// Handle irc styled messages for toast panel
+	if (tmp_chat.mChatStyle == CHAT_STYLE_IRC)
+	{
+		if(!tmp_chat.mFromName.empty())
+			tmp_chat.mText = tmp_chat.mFromName + tmp_chat.mText.substr(3);
+		else
+			tmp_chat.mText = tmp_chat.mText.substr(3);
+	}
+
 	// arrange a channel on a screen
 	if(!mChannel->getVisible())
 	{
diff --git a/indra/newview/llnotificationofferhandler.cpp b/indra/newview/llnotificationofferhandler.cpp
index dd66a6c5075..fad0c6a91e6 100644
--- a/indra/newview/llnotificationofferhandler.cpp
+++ b/indra/newview/llnotificationofferhandler.cpp
@@ -112,8 +112,8 @@ bool LLOfferHandler::processNotification(const LLSD& notify)
 				LLHandlerUtil::spawnIMSession(name, from_id);
 			}
 
-			if (notification->getPayload().has("SUPPRES_TOST")
-						&& notification->getPayload()["SUPPRES_TOST"])
+			if (notification->getPayload().has("SUPPRESS_TOAST")
+						&& notification->getPayload()["SUPPRESS_TOAST"])
 			{
 				LLNotificationsUtil::cancel(notification);
 			}
diff --git a/indra/newview/lloutputmonitorctrl.cpp b/indra/newview/lloutputmonitorctrl.cpp
index 63803469dd1..f816dc589d6 100644
--- a/indra/newview/lloutputmonitorctrl.cpp
+++ b/indra/newview/lloutputmonitorctrl.cpp
@@ -77,7 +77,9 @@ LLOutputMonitorCtrl::LLOutputMonitorCtrl(const LLOutputMonitorCtrl::Params& p)
 	mImageLevel3(p.image_level_3),
 	mAutoUpdate(p.auto_update),
 	mSpeakerId(p.speaker_id),
-	mIsAgentControl(false)
+	mIsAgentControl(false),
+	mIsSwitchDirty(false),
+	mShouldSwitchOn(false)
 {
 	//static LLUIColor output_monitor_muted_color = LLUIColorTable::instance().getColor("OutputMonitorMutedColor", LLColor4::orange);
 	//static LLUIColor output_monitor_overdriven_color = LLUIColorTable::instance().getColor("OutputMonitorOverdrivenColor", LLColor4::red);
@@ -108,6 +110,7 @@ LLOutputMonitorCtrl::LLOutputMonitorCtrl(const LLOutputMonitorCtrl::Params& p)
 LLOutputMonitorCtrl::~LLOutputMonitorCtrl()
 {
 	LLMuteList::getInstance()->removeObserver(this);
+	LLSpeakingIndicatorManager::unregisterSpeakingIndicator(mSpeakerId, this);
 }
 
 void LLOutputMonitorCtrl::setPower(F32 val)
@@ -117,6 +120,26 @@ void LLOutputMonitorCtrl::setPower(F32 val)
 
 void LLOutputMonitorCtrl::draw()
 {
+	// see also switchIndicator()
+	if (mIsSwitchDirty)
+	{
+		mIsSwitchDirty = false;
+		if (mShouldSwitchOn)
+		{
+			// just notify parent visibility may have changed
+			notifyParentVisibilityChanged();
+		}
+		else
+		{
+			// make itself invisible and notify parent about this
+			setVisible(FALSE);
+			notifyParentVisibilityChanged();
+
+			// no needs to render for invisible element
+			return;
+		}
+	}
+
 	// Copied from llmediaremotectrl.cpp
 	// *TODO: Give the LLOutputMonitorCtrl an agent-id to monitor, then
 	// call directly into gVoiceClient to ask if that agent-id is muted, is
@@ -229,6 +252,7 @@ void LLOutputMonitorCtrl::setSpeakerId(const LLUUID& speaker_id)
 	if (speaker_id.isNull() || speaker_id == mSpeakerId) return;
 
 	mSpeakerId = speaker_id;
+	LLSpeakingIndicatorManager::registerSpeakingIndicator(mSpeakerId, this);
 
 	//mute management
 	if (mAutoUpdate)
@@ -251,3 +275,42 @@ void LLOutputMonitorCtrl::onChange()
 	// check only blocking on voice. EXT-3542
 	setIsMuted(LLMuteList::getInstance()->isMuted(mSpeakerId, LLMute::flagVoiceChat));
 }
+
+// virtual
+void LLOutputMonitorCtrl::switchIndicator(bool switch_on)
+{
+	// ensure indicator is visible in case it is not in visible chain
+	// to be called when parent became visible next time to notify parent that visibility is changed.
+	setVisible(TRUE);
+
+	// if parent is in visible chain apply switch_on state and notify it immediately
+	if (getParent() && getParent()->isInVisibleChain())
+	{
+		LL_DEBUGS("SpeakingIndicator") << "Indicator is in visible chain, notifying parent: " << mSpeakerId << LL_ENDL;
+		setVisible((BOOL)switch_on);
+		notifyParentVisibilityChanged();
+	}
+
+	// otherwise remember necessary state and mark itself as dirty.
+	// State will be applied i next draw when parents chain became visible.
+	else
+	{
+		LL_DEBUGS("SpeakingIndicator") << "Indicator is not in visible chain, parent won't be notified: " << mSpeakerId << LL_ENDL;
+		mIsSwitchDirty = true;
+		mShouldSwitchOn = switch_on;
+	}
+}
+
+//////////////////////////////////////////////////////////////////////////
+// PRIVATE SECTION
+//////////////////////////////////////////////////////////////////////////
+void LLOutputMonitorCtrl::notifyParentVisibilityChanged()
+{
+	LL_DEBUGS("SpeakingIndicator") << "Notify parent that visibility was changed: " << mSpeakerId << " ,new_visibility: " << getVisible() << LL_ENDL;
+
+	LLSD params = LLSD().with("visibility_changed", getVisible());
+
+	notifyParent(params);
+}
+
+// EOF
diff --git a/indra/newview/lloutputmonitorctrl.h b/indra/newview/lloutputmonitorctrl.h
index 85ea552a572..2bbfa251e9d 100644
--- a/indra/newview/lloutputmonitorctrl.h
+++ b/indra/newview/lloutputmonitorctrl.h
@@ -36,6 +36,7 @@
 #include "v4color.h"
 #include "llview.h"
 #include "llmutelist.h"
+#include "llspeakingindicatormanager.h"
 
 class LLTextBox;
 class LLUICtrlFactory;
@@ -45,7 +46,7 @@ class LLUICtrlFactory;
 //
 
 class LLOutputMonitorCtrl
-: public LLView, LLMuteListObserver
+: public LLView, public LLSpeakingIndicator, LLMuteListObserver
 {
 public:
 	struct Params : public LLInitParam::Block<Params, LLView::Params>
@@ -90,7 +91,29 @@ class LLOutputMonitorCtrl
 	//called by mute list
 	virtual void onChange();
 
+	/**
+	 * Implementation of LLSpeakingIndicator interface.
+	 * Behavior is implemented via changing visibility.
+	 *
+	 * If instance is in visible chain now (all parents are visible) it changes visibility 
+	 * and notify parent about this.
+	 *
+	 * Otherwise it marks an instance as dirty and stores necessary visibility.
+	 * It will be applied in next draw and parent will be notified.
+	 */
+	virtual void	switchIndicator(bool switch_on);
+
 private:
+
+	/**
+	 * Notifies parent about changed visibility.
+	 *
+	 * Passes LLSD with "visibility_changed" => <current visibility> value.
+	 * For now it is processed by LLAvatarListItem to update (reshape) its children.
+	 * Implemented fo complete EXT-3976
+	 */
+	void			notifyParentVisibilityChanged();
+
 	//static LLColor4	sColorMuted;
 	//static LLColor4	sColorNormal;
 	//static LLColor4	sColorOverdriven;
@@ -117,6 +140,10 @@ class LLOutputMonitorCtrl
 
 	/** uuid of a speaker being monitored */
 	LLUUID			mSpeakerId;
+
+	/** indicates if the instance is dirty and should notify parent */
+	bool			mIsSwitchDirty;
+	bool			mShouldSwitchOn;
 };
 
 #endif
diff --git a/indra/newview/llpanelavatar.cpp b/indra/newview/llpanelavatar.cpp
index f3d6dbbb464..85e95ca1d65 100644
--- a/indra/newview/llpanelavatar.cpp
+++ b/indra/newview/llpanelavatar.cpp
@@ -52,6 +52,7 @@
 #include "llfloaterreg.h"
 #include "llnotificationsutil.h"
 #include "llvoiceclient.h"
+#include "llnamebox.h"
 
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 // Class LLDropTarget
@@ -594,8 +595,11 @@ void LLPanelAvatarProfile::processGroupProperties(const LLAvatarGroups* avatar_g
 		if (it != mGroups.begin())
 			groups += ", ";
 
-		
-		std::string group_url="[secondlife:///app/group/" + it->second.asString() + "/about " + it->first + "]";
+		std::string group_name = LLURI::escape(it->first);
+		std::string group_url= it->second.notNull()
+				? "[secondlife:///app/group/" + it->second.asString() + "/about " + group_name + "]"
+						: getString("no_group_text");
+
 		groups += group_url;
 	}
 
@@ -621,19 +625,15 @@ void LLPanelAvatarProfile::fillCommonData(const LLAvatarData* avatar_data)
 
 void LLPanelAvatarProfile::fillPartnerData(const LLAvatarData* avatar_data)
 {
+	LLNameBox* name_box = getChild<LLNameBox>("partner_text");
 	if (avatar_data->partner_id.notNull())
 	{
-		std::string first, last;
-		BOOL found = gCacheName->getName(avatar_data->partner_id, first, last);
-		if (found)
-		{
-			childSetTextArg("partner_text", "[FIRST]", first);
-			childSetTextArg("partner_text", "[LAST]", last);
-		}
+		name_box->setNameID(avatar_data->partner_id, FALSE);
 	}
 	else
 	{
-		childSetTextArg("partner_text", "[FIRST]", getString("no_partner_text"));
+		name_box->setNameID(LLUUID::null, FALSE);
+		name_box->setText(getString("no_partner_text"));
 	}
 }
 
diff --git a/indra/newview/llpanelclassified.cpp b/indra/newview/llpanelclassified.cpp
index e29320ffc2b..3f5d80c1234 100644
--- a/indra/newview/llpanelclassified.cpp
+++ b/indra/newview/llpanelclassified.cpp
@@ -72,6 +72,7 @@
 #include "llviewerwindow.h"	// for window width, height
 #include "llappviewer.h"	// abortQuit()
 #include "lltrans.h"
+#include "llstatusbar.h"
 
 const S32 MINIMUM_PRICE_FOR_LISTING = 50;	// L$
 const S32 MATURE_UNDEFINED = -1;
@@ -1364,6 +1365,7 @@ static const S32 CB_ITEM_PG	   = 1;
 LLPanelClassifiedEdit::LLPanelClassifiedEdit()
  : LLPanelClassifiedInfo()
  , mIsNew(false)
+ , mCanClose(false)
 {
 }
 
@@ -1559,7 +1561,7 @@ void LLPanelClassifiedEdit::resetControls()
 
 bool LLPanelClassifiedEdit::canClose()
 {
-	return isValidName();
+	return mCanClose;
 }
 
 void LLPanelClassifiedEdit::sendUpdate()
@@ -1676,12 +1678,23 @@ void LLPanelClassifiedEdit::onChange()
 
 void LLPanelClassifiedEdit::onSaveClick()
 {
+	mCanClose = false;
+
 	if(!isValidName())
 	{
 		notifyInvalidName();
 		return;
 	}
+	if(isNew())
+	{
+		if(gStatusBar->getBalance() < getPriceForListing())
+		{
+			LLNotificationsUtil::add("ClassifiedInsufficientFunds");
+			return;
+		}
+	}
 
+	mCanClose = true;
 	sendUpdate();
 	resetDirty();
 }
diff --git a/indra/newview/llpanelclassified.h b/indra/newview/llpanelclassified.h
index 10fdf60bbe3..e46806f5761 100644
--- a/indra/newview/llpanelclassified.h
+++ b/indra/newview/llpanelclassified.h
@@ -340,6 +340,7 @@ class LLPanelClassifiedEdit : public LLPanelClassifiedInfo
 
 private:
 	bool mIsNew;
+	bool mCanClose;
 };
 
 #endif // LL_LLPANELCLASSIFIED_H
diff --git a/indra/newview/llpanelgroup.cpp b/indra/newview/llpanelgroup.cpp
index fff25758938..569d3001bf5 100644
--- a/indra/newview/llpanelgroup.cpp
+++ b/indra/newview/llpanelgroup.cpp
@@ -151,6 +151,11 @@ BOOL LLPanelGroup::postBuild()
 	button->setVisible(true);
 	button->setEnabled(false);
 
+	button = getChild<LLButton>("btn_call");
+	button->setClickedCallback(onBtnGroupCallClicked, this);
+
+	button = getChild<LLButton>("btn_chat");
+	button->setClickedCallback(onBtnGroupChatClicked, this);
 
 	button = getChild<LLButton>("btn_join");
 	button->setVisible(false);
@@ -215,6 +220,8 @@ void LLPanelGroup::reposButtons()
 	reposButton("btn_create");
 	reposButton("btn_refresh");
 	reposButton("btn_cancel");
+	reposButton("btn_chat");
+	reposButton("btn_call");
 }
 
 void LLPanelGroup::reshape(S32 width, S32 height, BOOL called_from_parent )
@@ -262,6 +269,18 @@ void LLPanelGroup::onBtnApply(void* user_data)
 	self->apply();
 }
 
+void LLPanelGroup::onBtnGroupCallClicked(void* user_data)
+{
+	LLPanelGroup* self = static_cast<LLPanelGroup*>(user_data);
+	self->callGroup();
+}
+
+void LLPanelGroup::onBtnGroupChatClicked(void* user_data)
+{
+	LLPanelGroup* self = static_cast<LLPanelGroup*>(user_data);
+	self->chatGroup();
+}
+
 void LLPanelGroup::onBtnJoin()
 {
 	lldebugs << "joining group: " << mID << llendl;
@@ -349,6 +368,8 @@ void LLPanelGroup::setGroupID(const LLUUID& group_id)
 	LLButton* button_create = findChild<LLButton>("btn_create");
 	LLButton* button_join = findChild<LLButton>("btn_join");
 	LLButton* button_cancel = findChild<LLButton>("btn_cancel");
+	LLButton* button_call = findChild<LLButton>("btn_call");
+	LLButton* button_chat = findChild<LLButton>("btn_chat");
 
 
 	bool is_null_group_id = group_id == LLUUID::null;
@@ -362,6 +383,11 @@ void LLPanelGroup::setGroupID(const LLUUID& group_id)
 	if(button_cancel)
 		button_cancel->setVisible(!is_null_group_id);
 
+	if(button_call)
+			button_call->setVisible(!is_null_group_id);
+	if(button_chat)
+			button_chat->setVisible(!is_null_group_id);
+
 	getChild<LLUICtrl>("prepend_founded_by")->setVisible(!is_null_group_id);
 
 	LLAccordionCtrl* tab_ctrl = findChild<LLAccordionCtrl>("group_accordion");
@@ -393,12 +419,17 @@ void LLPanelGroup::setGroupID(const LLUUID& group_id)
 		if(tab_land->getDisplayChildren())
 			tab_land->changeOpenClose(tab_land->getDisplayChildren());
 
-		tab_roles->canOpenClose(false);
-		tab_notices->canOpenClose(false);
-		tab_land->canOpenClose(false);
+		tab_roles->setVisible(false);
+		tab_notices->setVisible(false);
+		tab_land->setVisible(false);
 
 		getChild<LLUICtrl>("group_name")->setVisible(false);
 		getChild<LLUICtrl>("group_name_editor")->setVisible(true);
+
+		if(button_call)
+			button_call->setVisible(false);
+		if(button_chat)
+			button_chat->setVisible(false);
 	}
 	else 
 	{
@@ -413,19 +444,29 @@ void LLPanelGroup::setGroupID(const LLUUID& group_id)
 			if(tab_land->getDisplayChildren())
 				tab_land->changeOpenClose(tab_land->getDisplayChildren());
 		}
+
+		LLGroupData agent_gdatap;
+		bool is_member = gAgent.getGroupData(mID,agent_gdatap);
 		
-		tab_roles->canOpenClose(true);
-		tab_notices->canOpenClose(true);
-		tab_land->canOpenClose(true);
+		tab_roles->setVisible(is_member);
+		tab_notices->setVisible(is_member);
+		tab_land->setVisible(is_member);
 
 		getChild<LLUICtrl>("group_name")->setVisible(true);
 		getChild<LLUICtrl>("group_name_editor")->setVisible(false);
+
+		if(button_apply)
+			button_apply->setVisible(is_member);
+		if(button_call)
+			button_call->setVisible(is_member);
+		if(button_chat)
+			button_chat->setVisible(is_member);
 	}
 
 	reposButtons();
 }
 
-bool	LLPanelGroup::apply(LLPanelGroupTab* tab)
+bool LLPanelGroup::apply(LLPanelGroupTab* tab)
 {
 	if(!tab)
 		return false;
@@ -468,12 +509,17 @@ void LLPanelGroup::draw()
 		childEnable("btn_refresh");
 	}
 
-	bool enable = false;
-	std::string mesg;
-	for(std::vector<LLPanelGroupTab* >::iterator it = mTabs.begin();it!=mTabs.end();++it)
-		enable = enable || (*it)->needsApply(mesg);
+	LLButton* button_apply = findChild<LLButton>("btn_apply");
+	
+	if(button_apply && button_apply->getVisible())
+	{
+		bool enable = false;
+		std::string mesg;
+		for(std::vector<LLPanelGroupTab* >::iterator it = mTabs.begin();it!=mTabs.end();++it)
+			enable = enable || (*it)->needsApply(mesg);
 
-	childSetEnabled("btn_apply", enable);
+		childSetEnabled("btn_apply", enable);
+	}
 }
 
 void LLPanelGroup::refreshData()
@@ -488,6 +534,15 @@ void LLPanelGroup::refreshData()
 	mRefreshTimer.setTimerExpirySec(5);
 }
 
+void LLPanelGroup::callGroup()
+{
+	LLGroupActions::startCall(getID());
+}
+
+void LLPanelGroup::chatGroup()
+{
+	LLGroupActions::startIM(getID());
+}
 
 void LLPanelGroup::showNotice(const std::string& subject,
 							  const std::string& message,
diff --git a/indra/newview/llpanelgroup.h b/indra/newview/llpanelgroup.h
index f6aefdb676d..7ea5e67b44f 100644
--- a/indra/newview/llpanelgroup.h
+++ b/indra/newview/llpanelgroup.h
@@ -74,6 +74,8 @@ class LLPanelGroup : public LLPanel,
 
 	bool apply();
 	void refreshData();
+	void callGroup();
+	void chatGroup();
 
 	virtual void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE);
 
@@ -103,6 +105,8 @@ class LLPanelGroup : public LLPanel,
 
 	static void onBtnApply(void*);
 	static void onBtnRefresh(void*);
+	static void onBtnGroupCallClicked(void*);
+	static void onBtnGroupChatClicked(void*);
 
 	void reposButton(const std::string& name);
 	void reposButtons();
diff --git a/indra/newview/llpanelgroupgeneral.cpp b/indra/newview/llpanelgroupgeneral.cpp
index 31dfdde887c..21b253223f0 100644
--- a/indra/newview/llpanelgroupgeneral.cpp
+++ b/indra/newview/llpanelgroupgeneral.cpp
@@ -580,7 +580,6 @@ void LLPanelGroupGeneral::update(LLGroupChange gc)
 			}
 		}
 
-		mComboActiveTitle->resetDirty();
 	}
 
 	// If this was just a titles update, we are done.
@@ -595,8 +594,6 @@ void LLPanelGroupGeneral::update(LLGroupChange gc)
 	{
 		mCtrlShowInGroupList->set(gdatap->mShowInList);
 		mCtrlShowInGroupList->setEnabled(mAllowEdit && can_change_ident);
-		mCtrlShowInGroupList->resetDirty();
-
 	}
 	if (mComboMature)
 	{
@@ -610,19 +607,16 @@ void LLPanelGroupGeneral::update(LLGroupChange gc)
 		}
 		mComboMature->setEnabled(mAllowEdit && can_change_ident);
 		mComboMature->setVisible( !gAgent.isTeen() );
-		mComboMature->resetDirty();
 	}
 	if (mCtrlOpenEnrollment) 
 	{
 		mCtrlOpenEnrollment->set(gdatap->mOpenEnrollment);
 		mCtrlOpenEnrollment->setEnabled(mAllowEdit && can_change_member_opts);
-		mCtrlOpenEnrollment->resetDirty();
 	}
 	if (mCtrlEnrollmentFee) 
 	{	
 		mCtrlEnrollmentFee->set(gdatap->mMembershipFee > 0);
 		mCtrlEnrollmentFee->setEnabled(mAllowEdit && can_change_member_opts);
-		mCtrlEnrollmentFee->resetDirty();
 	}
 	
 	if (mSpinEnrollmentFee)
@@ -632,7 +626,6 @@ void LLPanelGroupGeneral::update(LLGroupChange gc)
 		mSpinEnrollmentFee->setEnabled( mAllowEdit &&
 						(fee > 0) &&
 						can_change_member_opts);
-		mSpinEnrollmentFee->resetDirty();
 	}
 	if (mCtrlReceiveNotices)
 	{
@@ -641,7 +634,6 @@ void LLPanelGroupGeneral::update(LLGroupChange gc)
 		{
 			mCtrlReceiveNotices->setEnabled(mAllowEdit);
 		}
-		mCtrlReceiveNotices->resetDirty();
 	}
 
 
@@ -665,7 +657,6 @@ void LLPanelGroupGeneral::update(LLGroupChange gc)
 	if (mEditCharter)
 	{
 		mEditCharter->setText(gdatap->mCharter);
-		mEditCharter->resetDirty();
 	}
 	
 	if (mListVisibleMembers)
@@ -693,6 +684,8 @@ void LLPanelGroupGeneral::update(LLGroupChange gc)
 			mListVisibleMembers->addElement(row);
 		}
 	}
+
+	resetDirty();
 }
 
 void LLPanelGroupGeneral::updateMembers()
diff --git a/indra/newview/llpanelgroupnotices.cpp b/indra/newview/llpanelgroupnotices.cpp
index 6210973dae2..45fc3d46882 100644
--- a/indra/newview/llpanelgroupnotices.cpp
+++ b/indra/newview/llpanelgroupnotices.cpp
@@ -614,7 +614,7 @@ void LLPanelGroupNotices::showNotice(const std::string& subject,
 		mViewInventoryIcon->setVisible(TRUE);
 
 		std::stringstream ss;
-		ss << "        " << inventory_name;
+		ss << "        " << LLViewerInventoryItem::getDisplayName(inventory_name);
 
 		mViewInventoryName->setText(ss.str());
 		mBtnOpenAttachment->setEnabled(TRUE);
diff --git a/indra/newview/llpanelgrouproles.cpp b/indra/newview/llpanelgrouproles.cpp
index 29b647415c3..0e55ff3214d 100644
--- a/indra/newview/llpanelgrouproles.cpp
+++ b/indra/newview/llpanelgrouproles.cpp
@@ -460,17 +460,8 @@ LLPanelGroupSubTab::~LLPanelGroupSubTab()
 {
 }
 
-BOOL LLPanelGroupSubTab::postBuild()
-{
-	// Hook up the search widgets.
-	bool recurse = true;
-	mSearchEditor = getChild<LLFilterEditor>("filter_input", recurse);
-
-	if (!mSearchEditor) 
-		return FALSE;
-
-	mSearchEditor->setCommitCallback(boost::bind(&LLPanelGroupSubTab::setSearchFilter, this, _2));
-	
+BOOL LLPanelGroupSubTab::postBuildSubTab(LLView* root) 
+{ 
 	// Get icons for later use.
 	mActionIcons.clear();
 
@@ -488,6 +479,19 @@ BOOL LLPanelGroupSubTab::postBuild()
 	{
 		mActionIcons["partial"] = getString("power_partial_icon");
 	}
+	return TRUE; 
+}
+
+BOOL LLPanelGroupSubTab::postBuild()
+{
+	// Hook up the search widgets.
+	bool recurse = true;
+	mSearchEditor = getChild<LLFilterEditor>("filter_input", recurse);
+
+	if (!mSearchEditor) 
+		return FALSE;
+
+	mSearchEditor->setCommitCallback(boost::bind(&LLPanelGroupSubTab::setSearchFilter, this, _2));
 
 	return LLPanelGroupTab::postBuild();
 }
@@ -567,7 +571,6 @@ bool LLPanelGroupSubTab::matchesActionSearchFilter(std::string action)
 void LLPanelGroupSubTab::buildActionsList(LLScrollListCtrl* ctrl, 
 										  U64 allowed_by_some, 
 										  U64 allowed_by_all,
-										  icon_map_t& icons,
 										  LLUICtrl::commit_callback_t commit_callback,
 										  BOOL show_all,
 										  BOOL filter,
@@ -588,7 +591,6 @@ void LLPanelGroupSubTab::buildActionsList(LLScrollListCtrl* ctrl,
 							allowed_by_some,
 							allowed_by_all,
 							(*ras_it),
-							icons, 
 							commit_callback,
 							show_all,
 							filter,
@@ -600,7 +602,6 @@ void LLPanelGroupSubTab::buildActionCategory(LLScrollListCtrl* ctrl,
 											 U64 allowed_by_some,
 											 U64 allowed_by_all,
 											 LLRoleActionSet* action_set,
-											 icon_map_t& icons,
 											 LLUICtrl::commit_callback_t commit_callback,
 											 BOOL show_all,
 											 BOOL filter,
@@ -614,26 +615,26 @@ void LLPanelGroupSubTab::buildActionCategory(LLScrollListCtrl* ctrl,
 		LLSD row;
 
 		row["columns"][0]["column"] = "icon";
-		icon_map_t::iterator iter = icons.find("folder");
-		if (iter != icons.end())
+		row["columns"][0]["type"] = "icon";
+		
+		icon_map_t::iterator iter = mActionIcons.find("folder");
+		if (iter != mActionIcons.end())
 		{
-			row["columns"][0]["type"] = "icon";
 			row["columns"][0]["value"] = (*iter).second;
 		}
 
 		row["columns"][1]["column"] = "action";
+		row["columns"][1]["type"] = "text";
 		row["columns"][1]["value"] = action_set->mActionSetData->mName;
 		row["columns"][1]["font"]["name"] = "SANSSERIF_SMALL";
-		row["columns"][1]["font"]["style"] = "BOLD";
+		
 
 		LLScrollListItem* title_row = ctrl->addElement(row, ADD_BOTTOM, action_set->mActionSetData);
 		
-		LLScrollListText* name_textp = dynamic_cast<LLScrollListText*>(title_row->getColumn(1));
+		LLScrollListText* name_textp = dynamic_cast<LLScrollListText*>(title_row->getColumn(2)); //?? I have no idea fix getColumn(1) return column spacer...
 		if (name_textp)
 			name_textp->setFontStyle(LLFontGL::BOLD);
 
-
-
 		bool category_matches_filter = (filter) ? matchesActionSearchFilter(action_set->mActionSetData->mName) : true;
 
 		std::vector<LLRoleAction*>::iterator ra_it = action_set->mActions.begin();
@@ -686,8 +687,8 @@ void LLPanelGroupSubTab::buildActionCategory(LLScrollListCtrl* ctrl,
 			{
 				if (show_full_strength)
 				{
-					icon_map_t::iterator iter = icons.find("full");
-					if (iter != icons.end())
+					icon_map_t::iterator iter = mActionIcons.find("full");
+					if (iter != mActionIcons.end())
 					{
 						row["columns"][column_index]["column"] = "checkbox";
 						row["columns"][column_index]["type"] = "icon";
@@ -697,8 +698,8 @@ void LLPanelGroupSubTab::buildActionCategory(LLScrollListCtrl* ctrl,
 				}
 				else
 				{
-					icon_map_t::iterator iter = icons.find("partial");
-					if (iter != icons.end())
+					icon_map_t::iterator iter = mActionIcons.find("partial");
+					if (iter != mActionIcons.end())
 					{
 						row["columns"][column_index]["column"] = "checkbox";
 						row["columns"][column_index]["type"] = "icon";
@@ -792,6 +793,8 @@ LLPanelGroupMembersSubTab::~LLPanelGroupMembersSubTab()
 
 BOOL LLPanelGroupMembersSubTab::postBuildSubTab(LLView* root)
 {
+	LLPanelGroupSubTab::postBuildSubTab(root);
+	
 	// Upcast parent so we can ask it for sibling controls.
 	LLPanelGroupRoles* parent = (LLPanelGroupRoles*) root;
 
@@ -888,7 +891,6 @@ void LLPanelGroupMembersSubTab::handleMemberSelect()
 	buildActionsList(mAllowedActionsList,
 					 allowed_by_some,
 					 allowed_by_all,
-					 mActionIcons,
 					 NULL,
 					 FALSE,
 					 FALSE,
@@ -1211,7 +1213,6 @@ void LLPanelGroupMembersSubTab::handleRoleCheck(const LLUUID& role_id,
 	buildActionsList(mAllowedActionsList,
 					 powers_some_have,
 					 powers_all_have,
-					 mActionIcons,
 					 NULL,
 					 FALSE,
 					 FALSE,
@@ -1684,6 +1685,8 @@ LLPanelGroupRolesSubTab::~LLPanelGroupRolesSubTab()
 
 BOOL LLPanelGroupRolesSubTab::postBuildSubTab(LLView* root)
 {
+	LLPanelGroupSubTab::postBuildSubTab(root);
+
 	// Upcast parent so we can ask it for sibling controls.
 	LLPanelGroupRoles* parent = (LLPanelGroupRoles*) root;
 
@@ -1994,7 +1997,6 @@ void LLPanelGroupRolesSubTab::handleRoleSelect()
 		buildActionsList(mAllowedActionsList,
 						 rd.mRolePowers,
 						 0LL,
-						 mActionIcons,
 						 boost::bind(&LLPanelGroupRolesSubTab::handleActionCheck, this, _1, false),
 						 TRUE,
 						 FALSE,
@@ -2381,6 +2383,8 @@ LLPanelGroupActionsSubTab::~LLPanelGroupActionsSubTab()
 
 BOOL LLPanelGroupActionsSubTab::postBuildSubTab(LLView* root)
 {
+	LLPanelGroupSubTab::postBuildSubTab(root);
+
 	// Upcast parent so we can ask it for sibling controls.
 	LLPanelGroupRoles* parent = (LLPanelGroupRoles*) root;
 
@@ -2448,7 +2452,6 @@ void LLPanelGroupActionsSubTab::update(LLGroupChange gc)
 	buildActionsList(mActionList,
 					 GP_ALL_POWERS,
 					 GP_ALL_POWERS,
-					 mActionIcons,
 					 NULL,
 					 FALSE,
 					 TRUE,
diff --git a/indra/newview/llpanelgrouproles.h b/indra/newview/llpanelgrouproles.h
index bb3c9096cf4..2f81900e609 100644
--- a/indra/newview/llpanelgrouproles.h
+++ b/indra/newview/llpanelgrouproles.h
@@ -108,7 +108,7 @@ class LLPanelGroupSubTab : public LLPanelGroupTab
 	virtual BOOL postBuild();
 
 	// This allows sub-tabs to collect child widgets from a higher level in the view hierarchy.
-	virtual BOOL postBuildSubTab(LLView* root) { return TRUE; }
+	virtual BOOL postBuildSubTab(LLView* root);
 
 	virtual void setSearchFilter( const std::string& filter );
 
@@ -117,10 +117,15 @@ class LLPanelGroupSubTab : public LLPanelGroupTab
 
 	// Helper functions
 	bool matchesActionSearchFilter(std::string action);
+
+
+	void setFooterEnabled(BOOL enable);
+
+	virtual void setGroupID(const LLUUID& id);
+protected:
 	void buildActionsList(LLScrollListCtrl* ctrl,
 								 U64 allowed_by_some,
 								 U64 allowed_by_all,
-								 icon_map_t& icons,
 						  		 LLUICtrl::commit_callback_t commit_callback,
 								 BOOL show_all,
 								 BOOL filter,
@@ -129,15 +134,11 @@ class LLPanelGroupSubTab : public LLPanelGroupTab
 									U64 allowed_by_some,
 									U64 allowed_by_all,
 									LLRoleActionSet* action_set,
-									icon_map_t& icons,
 									LLUICtrl::commit_callback_t commit_callback,
 									BOOL show_all,
 									BOOL filter,
 									BOOL is_owner_role);
 
-	void setFooterEnabled(BOOL enable);
-
-	virtual void setGroupID(const LLUUID& id);
 protected:
 	LLPanel* mHeader;
 	LLPanel* mFooter;
diff --git a/indra/newview/llpanelhome.cpp b/indra/newview/llpanelhome.cpp
index 92b6d2f6199..713d2d79b4c 100644
--- a/indra/newview/llpanelhome.cpp
+++ b/indra/newview/llpanelhome.cpp
@@ -37,7 +37,7 @@
 #include "llmediactrl.h"
 #include "llviewerhome.h"
 
-static LLRegisterPanelClassWrapper<LLPanelHome> t_people("panel_sidetray_home");
+static LLRegisterPanelClassWrapper<LLPanelHome> t_home("panel_sidetray_home");
 
 LLPanelHome::LLPanelHome() :
 	LLPanel(),
diff --git a/indra/newview/llpanelimcontrolpanel.cpp b/indra/newview/llpanelimcontrolpanel.cpp
index 279818d52fb..b1cdb4d81f6 100644
--- a/indra/newview/llpanelimcontrolpanel.cpp
+++ b/indra/newview/llpanelimcontrolpanel.cpp
@@ -46,6 +46,7 @@
 #include "llimview.h"
 #include "llvoicechannel.h"
 #include "llsidetray.h"
+#include "llspeakers.h"
 #include "lltrans.h"
 
 void LLPanelChatControlPanel::onCallButtonClicked()
@@ -70,9 +71,9 @@ void LLPanelChatControlPanel::onVoiceChannelStateChanged(const LLVoiceChannel::E
 
 void LLPanelChatControlPanel::updateButtons(bool is_call_started)
 {
-	childSetVisible("end_call_btn", is_call_started);
-	childSetVisible("voice_ctrls_btn", is_call_started);
-	childSetVisible("call_btn", ! is_call_started);
+	childSetVisible("end_call_btn_panel", is_call_started);
+	childSetVisible("voice_ctrls_btn_panel", is_call_started);
+	childSetVisible("call_btn_panel", ! is_call_started);
 }
 
 LLPanelChatControlPanel::~LLPanelChatControlPanel()
@@ -302,7 +303,7 @@ void LLPanelGroupControlPanel::setSessionId(const LLUUID& session_id)
 {
 	LLPanelChatControlPanel::setSessionId(session_id);
 
-	mGroupID = LLIMModel::getInstance()->getOtherParticipantID(session_id);
+	mGroupID = session_id;
 
 	// for group and Ad-hoc chat we need to include agent into list 
 	if(!mParticipantList)
diff --git a/indra/newview/llpanellandaudio.cpp b/indra/newview/llpanellandaudio.cpp
index 920fca66f2b..6a4c9097592 100644
--- a/indra/newview/llpanellandaudio.cpp
+++ b/indra/newview/llpanellandaudio.cpp
@@ -37,6 +37,7 @@
 // viewer includes
 #include "llmimetypes.h"
 #include "llviewerparcelmgr.h"
+#include "llviewerregion.h"
 #include "lluictrlfactory.h"
 
 // library includes
@@ -83,8 +84,14 @@ BOOL LLPanelLandAudio::postBuild()
 	mCheckSoundLocal = getChild<LLCheckBoxCtrl>("check sound local");
 	childSetCommitCallback("check sound local", onCommitAny, this);
 
-	mRadioVoiceChat = getChild<LLRadioGroup>("parcel_voice_channel");
-	childSetCommitCallback("parcel_voice_channel", onCommitAny, this);
+	mCheckParcelEnableVoice = getChild<LLCheckBoxCtrl>("parcel_enable_voice_channel");
+	childSetCommitCallback("parcel_enable_voice_channel", onCommitAny, this);
+
+	// This one is always disabled so no need for a commit callback
+	mCheckEstateDisabledVoice = getChild<LLCheckBoxCtrl>("parcel_enable_voice_channel_is_estate_disabled");
+
+	mCheckParcelVoiceLocal = getChild<LLCheckBoxCtrl>("parcel_enable_voice_channel_local");
+	childSetCommitCallback("parcel_enable_voice_channel_local", onCommitAny, this);
 
 	mMusicURLEdit = getChild<LLLineEditor>("music_url");
 	childSetCommitCallback("music_url", onCommitAny, this);
@@ -118,19 +125,33 @@ void LLPanelLandAudio::refresh()
 		mMusicUrlCheck->set( parcel->getObscureMusic() );
 		mMusicUrlCheck->setEnabled( can_change_media );
 
-		if(parcel->getParcelFlagAllowVoice())
+		bool allow_voice = parcel->getParcelFlagAllowVoice();
+
+		LLViewerRegion* region = LLViewerParcelMgr::getInstance()->getSelectionRegion();
+		if (region && region->isVoiceEnabled())
 		{
-			if(parcel->getParcelFlagUseEstateVoiceChannel())
-				mRadioVoiceChat->setSelectedIndex(kRadioVoiceChatEstate);
-			else
-				mRadioVoiceChat->setSelectedIndex(kRadioVoiceChatPrivate);
+			mCheckEstateDisabledVoice->setVisible(false);
+
+			mCheckParcelEnableVoice->setVisible(true);
+			mCheckParcelEnableVoice->setEnabled( can_change_media );
+			mCheckParcelEnableVoice->set(allow_voice);
+
+			mCheckParcelVoiceLocal->setEnabled( can_change_media && allow_voice );
 		}
 		else
 		{
-			mRadioVoiceChat->setSelectedIndex(kRadioVoiceChatDisable);
+			// Voice disabled at estate level, overrides parcel settings
+			// Replace the parcel voice checkbox with a disabled one
+			// labelled with an explanatory message
+			mCheckEstateDisabledVoice->setVisible(true);
+
+			mCheckParcelEnableVoice->setVisible(false);
+			mCheckParcelEnableVoice->setEnabled(false);
+			mCheckParcelVoiceLocal->setEnabled(false);
 		}
 
-		mRadioVoiceChat->setEnabled( can_change_media );
+		mCheckParcelEnableVoice->set(allow_voice);
+		mCheckParcelVoiceLocal->set(!parcel->getParcelFlagUseEstateVoiceChannel());
 
 		mMusicURLEdit->setText(parcel->getMusicURL());
 		mMusicURLEdit->setEnabled( can_change_media );
@@ -149,30 +170,11 @@ void LLPanelLandAudio::onCommitAny(LLUICtrl*, void *userdata)
 
 	// Extract data from UI
 	BOOL sound_local		= self->mCheckSoundLocal->get();
-	int voice_setting		= self->mRadioVoiceChat->getSelectedIndex();
 	std::string music_url	= self->mMusicURLEdit->getText();
 	U8 obscure_music		= self->mMusicUrlCheck->get();
 
-
-	BOOL voice_enabled;
-	BOOL voice_estate_chan;
-
-	switch(voice_setting)
-	{
-		default:
-		case kRadioVoiceChatEstate:
-			voice_enabled = TRUE;
-			voice_estate_chan = TRUE;
-		break;
-		case kRadioVoiceChatPrivate:
-			voice_enabled = TRUE;
-			voice_estate_chan = FALSE;
-		break;
-		case kRadioVoiceChatDisable:
-			voice_enabled = FALSE;
-			voice_estate_chan = FALSE;
-		break;
-	}
+	BOOL voice_enabled = self->mCheckParcelEnableVoice->get();
+	BOOL voice_estate_chan = !self->mCheckParcelVoiceLocal->get();
 
 	// Remove leading/trailing whitespace (common when copying/pasting)
 	LLStringUtil::trim(music_url);
diff --git a/indra/newview/llpanellandaudio.h b/indra/newview/llpanellandaudio.h
index de5da95fa43..19766a40b64 100644
--- a/indra/newview/llpanellandaudio.h
+++ b/indra/newview/llpanellandaudio.h
@@ -52,7 +52,9 @@ class LLPanelLandAudio
 
 private:
 	LLCheckBoxCtrl* mCheckSoundLocal;
-	LLRadioGroup*	mRadioVoiceChat;
+	LLCheckBoxCtrl* mCheckParcelEnableVoice;
+	LLCheckBoxCtrl* mCheckEstateDisabledVoice;
+	LLCheckBoxCtrl* mCheckParcelVoiceLocal;	
 	LLLineEditor*	mMusicURLEdit;
 	LLCheckBoxCtrl* mMusicUrlCheck;
 
diff --git a/indra/newview/llpanellandmarkinfo.cpp b/indra/newview/llpanellandmarkinfo.cpp
index 597b8bdb2db..9654e176598 100644
--- a/indra/newview/llpanellandmarkinfo.cpp
+++ b/indra/newview/llpanellandmarkinfo.cpp
@@ -185,6 +185,13 @@ void LLPanelLandmarkInfo::processParcelInfo(const LLParcelData& parcel_data)
 		region_z = llround(mPosRegion.mV[VZ]);
 	}
 
+	LLSD info;
+	info["update_verbs"] = true;
+	info["global_x"] = parcel_data.global_x;
+	info["global_y"] = parcel_data.global_y;
+	info["global_z"] = parcel_data.global_z;
+	notifyParent(info);
+
 	if (mInfoType == CREATE_LANDMARK)
 	{
 		if (parcel_data.name.empty())
diff --git a/indra/newview/llpanellandmarks.cpp b/indra/newview/llpanellandmarks.cpp
index 30acf37f823..47feef496af 100644
--- a/indra/newview/llpanellandmarks.cpp
+++ b/indra/newview/llpanellandmarks.cpp
@@ -35,6 +35,7 @@
 
 #include "llbutton.h"
 #include "llfloaterreg.h"
+#include "llnotificationsutil.h"
 #include "llsdutil.h"
 #include "llsdutil_math.h"
 #include "llregionhandle.h"
@@ -304,6 +305,29 @@ void LLLandmarksPanel::updateShowFolderState()
 		);
 }
 
+void LLLandmarksPanel::setItemSelected(const LLUUID& obj_id, BOOL take_keyboard_focus)
+{
+	if (selectItemInAccordionTab(mFavoritesInventoryPanel, "tab_favorites", obj_id, take_keyboard_focus))
+	{
+		return;
+	}
+
+	if (selectItemInAccordionTab(mLandmarksInventoryPanel, "tab_landmarks", obj_id, take_keyboard_focus))
+	{
+		return;
+	}
+
+	if (selectItemInAccordionTab(mMyInventoryPanel, "tab_inventory", obj_id, take_keyboard_focus))
+	{
+		return;
+	}
+
+	if (selectItemInAccordionTab(mLibraryInventoryPanel, "tab_library", obj_id, take_keyboard_focus))
+	{
+		return;
+	}
+}
+
 //////////////////////////////////////////////////////////////////////////
 // PROTECTED METHODS
 //////////////////////////////////////////////////////////////////////////
@@ -349,6 +373,36 @@ LLFolderViewItem* LLLandmarksPanel::getCurSelectedItem() const
 	return mCurrentSelectedList ?  mCurrentSelectedList->getRootFolder()->getCurSelectedItem() : NULL;
 }
 
+LLFolderViewItem* LLLandmarksPanel::selectItemInAccordionTab(LLPlacesInventoryPanel* inventory_list,
+															 const std::string& tab_name,
+															 const LLUUID& obj_id,
+															 BOOL take_keyboard_focus) const
+{
+	if (!inventory_list)
+		return NULL;
+
+	LLFolderView* folder_view = inventory_list->getRootFolder();
+
+	LLFolderViewItem* item = folder_view->getItemByID(obj_id);
+	if (!item)
+		return NULL;
+
+	LLAccordionCtrlTab* tab = getChild<LLAccordionCtrlTab>(tab_name);
+	if (!tab->isExpanded())
+	{
+		tab->changeOpenClose(false);
+	}
+
+	folder_view->setSelection(item, FALSE, take_keyboard_focus);
+
+	LLAccordionCtrl* accordion = getChild<LLAccordionCtrl>("landmarks_accordion");
+	LLRect screen_rc;
+	localRectToScreen(item->getRect(), &screen_rc);
+	accordion->notifyParent(LLSD().with("scrollToShowRect", screen_rc.getValue()));
+
+	return item;
+}
+
 void LLLandmarksPanel::updateSortOrder(LLInventoryPanel* panel, bool byDate)
 {
 	if(!panel) return; 
@@ -632,8 +686,7 @@ void LLLandmarksPanel::onAddAction(const LLSD& userdata) const
 		LLViewerInventoryItem* landmark = LLLandmarkActions::findLandmarkForAgentPos();
 		if(landmark)
 		{
-			LLSideTray::getInstance()->showPanel("panel_places", 
-								LLSD().with("type", "landmark").with("id",landmark->getUUID()));
+			LLNotificationsUtil::add("LandmarkAlreadyExists");
 		}
 		else
 		{
diff --git a/indra/newview/llpanellandmarks.h b/indra/newview/llpanellandmarks.h
index 569739237d4..96b790844ca 100644
--- a/indra/newview/llpanellandmarks.h
+++ b/indra/newview/llpanellandmarks.h
@@ -73,6 +73,11 @@ class LLLandmarksPanel : public LLPanelPlacesTab, LLRemoteParcelInfoObserver
 	 */
 	void updateShowFolderState();
 
+	/**
+	 * Selects item with "obj_id" in one of accordion tabs.
+	 */
+	void setItemSelected(const LLUUID& obj_id, BOOL take_keyboard_focus);
+
 protected:
 	/**
 	 * @return true - if current selected panel is not null and selected item is a landmark
@@ -81,6 +86,17 @@ class LLLandmarksPanel : public LLPanelPlacesTab, LLRemoteParcelInfoObserver
 	bool isReceivedFolderSelected() const;
 	void doActionOnCurSelectedLandmark(LLLandmarkList::loaded_callback_t cb);
 	LLFolderViewItem* getCurSelectedItem() const;
+
+	/**
+	 * Selects item with "obj_id" in "inventory_list" and scrolls accordion
+	 * scrollbar to show the item.
+	 * Returns pointer to the item if it is found in "inventory_list", otherwise NULL.
+	 */
+	LLFolderViewItem* selectItemInAccordionTab(LLPlacesInventoryPanel* inventory_list,
+											   const std::string& tab_name,
+											   const LLUUID& obj_id,
+											   BOOL take_keyboard_focus) const;
+
 	void updateSortOrder(LLInventoryPanel* panel, bool byDate);
 
 	//LLRemoteParcelInfoObserver interface
diff --git a/indra/newview/llpanelmaininventory.cpp b/indra/newview/llpanelmaininventory.cpp
index e74a39c85cb..a5a61f0c7ba 100644
--- a/indra/newview/llpanelmaininventory.cpp
+++ b/indra/newview/llpanelmaininventory.cpp
@@ -51,6 +51,8 @@
 #include "llviewermenu.h"
 #include "llviewertexturelist.h"
 
+const std::string FILTERS_FILENAME("filters.xml");
+
 static LLRegisterPanelClassWrapper<LLPanelMainInventory> t_inventory("panel_main_inventory");
 
 void on_file_loaded_for_save(BOOL success, 
@@ -160,7 +162,7 @@ BOOL LLPanelMainInventory::postBuild()
 
 	// Now load the stored settings from disk, if available.
 	std::ostringstream filterSaveName;
-	filterSaveName << gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, "filters.xml");
+	filterSaveName << gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, FILTERS_FILENAME);
 	llinfos << "LLPanelMainInventory::init: reading from " << filterSaveName << llendl;
 	llifstream file(filterSaveName.str());
 	LLSD savedFilterState;
@@ -230,7 +232,7 @@ LLPanelMainInventory::~LLPanelMainInventory( void )
 	}
 
 	std::ostringstream filterSaveName;
-	filterSaveName << gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, "filters.xml");
+	filterSaveName << gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, FILTERS_FILENAME);
 	llofstream filtersFile(filterSaveName.str());
 	if(!LLSDSerialize::toPrettyXML(filterRoot, filtersFile))
 	{
diff --git a/indra/newview/llpanelobject.cpp b/indra/newview/llpanelobject.cpp
index 6a61e0f02fe..d17c287cc75 100644
--- a/indra/newview/llpanelobject.cpp
+++ b/indra/newview/llpanelobject.cpp
@@ -73,7 +73,7 @@
 #include "pipeline.h"
 #include "llviewercontrol.h"
 #include "lluictrlfactory.h"
-#include "llfirstuse.h"
+//#include "llfirstuse.h"
 
 #include "lldrawpool.h"
 
@@ -682,7 +682,7 @@ void LLPanelObject::getState( )
 		if (objectp->getParameterEntryInUse(LLNetworkData::PARAMS_SCULPT))
 		{
 			selected_item = MI_SCULPT;
-			LLFirstUse::useSculptedPrim();
+			//LLFirstUse::useSculptedPrim();
 		}
 
 		
diff --git a/indra/newview/llpanelobjectinventory.cpp b/indra/newview/llpanelobjectinventory.cpp
index 43366ef8140..d4376550d6c 100644
--- a/indra/newview/llpanelobjectinventory.cpp
+++ b/indra/newview/llpanelobjectinventory.cpp
@@ -445,7 +445,7 @@ bool remove_task_inventory_callback(const LLSD& notification, const LLSD& respon
 }
 
 // helper for remove
-// ! REFACTOR ! two_uuids_list_t is also defined in llinevntorybridge.h, but differently.
+// ! REFACTOR ! two_uuids_list_t is also defined in llinventorybridge.h, but differently.
 typedef std::pair<LLUUID, std::list<LLUUID> > panel_two_uuids_list_t;
 typedef std::pair<LLPanelObjectInventory*, panel_two_uuids_list_t> remove_data_t;
 BOOL LLTaskInvFVBridge::removeItem()
diff --git a/indra/newview/llpaneloutfitsinventory.cpp b/indra/newview/llpaneloutfitsinventory.cpp
index 8e14074de16..fd5ce7a46d3 100644
--- a/indra/newview/llpaneloutfitsinventory.cpp
+++ b/indra/newview/llpaneloutfitsinventory.cpp
@@ -35,6 +35,7 @@
 
 #include "llagent.h"
 #include "llagentwearables.h"
+#include "llappearancemgr.h"
 
 #include "llbutton.h"
 #include "llfloaterreg.h"
@@ -44,6 +45,8 @@
 #include "llinventoryfunctions.h"
 #include "llinventorypanel.h"
 #include "lllandmark.h"
+#include "lllineeditor.h"
+#include "llmodaldialog.h"
 #include "llsidepanelappearance.h"
 #include "llsidetray.h"
 #include "lltabcontainer.h"
@@ -61,12 +64,75 @@
 static LLRegisterPanelClassWrapper<LLPanelOutfitsInventory> t_inventory("panel_outfits_inventory");
 bool LLPanelOutfitsInventory::sShowDebugEditor = false;
 
+class LLOutfitSaveAsDialog : public LLModalDialog
+{
+private:
+	std::string	mItemName;
+	std::string mTempItemName;
+	
+	boost::signals2::signal<void (const std::string&)> mSaveAsSignal;
+
+public:
+	LLOutfitSaveAsDialog( const LLSD& key )
+		: LLModalDialog( key ),
+		  mTempItemName(key.asString())
+	{
+	}
+		
+	BOOL postBuild()
+	{
+		getChild<LLUICtrl>("Save")->setCommitCallback(boost::bind(&LLOutfitSaveAsDialog::onSave, this ));
+		getChild<LLUICtrl>("Cancel")->setCommitCallback(boost::bind(&LLOutfitSaveAsDialog::onCancel, this ));
+		
+		childSetTextArg("name ed", "[DESC]", mTempItemName);
+		return TRUE;
+	}
+
+	void setSaveAsCommit( const boost::signals2::signal<void (const std::string&)>::slot_type& cb )
+	{
+		mSaveAsSignal.connect(cb);
+	}
+
+	virtual void onOpen(const LLSD& key)
+	{
+		LLLineEditor* edit = getChild<LLLineEditor>("name ed");
+		if (edit)
+		{
+			edit->setFocus(TRUE);
+			edit->selectAll();
+		}
+	}
+
+	void onSave()
+	{
+		mItemName = childGetValue("name ed").asString();
+		LLStringUtil::trim(mItemName);
+		if( !mItemName.empty() )
+		{
+			mSaveAsSignal(mItemName);
+			closeFloater(); // destroys this object
+		}
+	}
+
+	void onCancel()
+	{
+		closeFloater(); // destroys this object
+	}
+};
+	
 LLPanelOutfitsInventory::LLPanelOutfitsInventory() :
 	mActivePanel(NULL),
 	mParent(NULL)
 {
 	mSavedFolderState = new LLSaveFolderState();
 	mSavedFolderState->setApply(FALSE);
+
+	static bool registered_dialog = false;
+	if (!registered_dialog)
+	{
+		LLFloaterReg::add("outfit_save_as", "floater_outfit_save_as.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLOutfitSaveAsDialog>);
+		registered_dialog = true;
+	}
 }
 
 LLPanelOutfitsInventory::~LLPanelOutfitsInventory()
@@ -84,6 +150,14 @@ BOOL LLPanelOutfitsInventory::postBuild()
 	return TRUE;
 }
 
+// virtual
+void LLPanelOutfitsInventory::onOpen(const LLSD& key)
+{
+	// Make sure we know which tab is selected, update the filter,
+	// and update verbs.
+	onTabChange();
+}
+
 void LLPanelOutfitsInventory::updateVerbs()
 {
 	if (mParent)
@@ -94,6 +168,7 @@ void LLPanelOutfitsInventory::updateVerbs()
 	if (mListCommands)
 	{
 		mListCommands->childSetVisible("look_edit_btn",sShowDebugEditor);
+		updateListCommands();
 	}
 }
 
@@ -168,15 +243,36 @@ void LLPanelOutfitsInventory::onEdit()
 {
 }
 
-void LLPanelOutfitsInventory::onNew()
+void LLPanelOutfitsInventory::onSave()
+{
+	std::string outfit_name;
+
+	if (!LLAppearanceManager::getInstance()->getBaseOutfitName(outfit_name))
+	{
+		outfit_name = LLViewerFolderType::lookupNewCategoryName(LLFolderType::FT_OUTFIT);
+	}
+
+	LLOutfitSaveAsDialog* save_as_dialog = LLFloaterReg::showTypedInstance<LLOutfitSaveAsDialog>("outfit_save_as", LLSD(outfit_name), TRUE);
+	if (save_as_dialog)
+	{
+		save_as_dialog->setSaveAsCommit(boost::bind(&LLPanelOutfitsInventory::onSaveCommit, this, _1 ));
+	}
+}
+
+void LLPanelOutfitsInventory::onSaveCommit(const std::string& outfit_name)
 {
-	const std::string& outfit_name = LLViewerFolderType::lookupNewCategoryName(LLFolderType::FT_OUTFIT);
 	LLUUID outfit_folder = gAgentWearables.makeNewOutfitLinks(outfit_name);
+	LLSD key;
+	LLSideTray::getInstance()->showPanel("panel_outfits_inventory", key);
+
+	if (mAppearanceTabs)
+	{
+		mAppearanceTabs->selectTabByName("outfitslist_tab");
+	}
 }
 
 void LLPanelOutfitsInventory::onSelectionChange(const std::deque<LLFolderViewItem*> &items, BOOL user_action)
 {
-	updateListCommands();
 	updateVerbs();
 	if (getRootFolder()->needsAutoRename() && items.size())
 	{
@@ -264,9 +360,12 @@ void LLPanelOutfitsInventory::updateListCommands()
 {
 	bool trash_enabled = isActionEnabled("delete");
 	bool wear_enabled = isActionEnabled("wear");
+	bool make_outfit_enabled = isActionEnabled("make_outfit");
 
 	mListCommands->childSetEnabled("trash_btn", trash_enabled);
 	mListCommands->childSetEnabled("wear_btn", wear_enabled);
+	mListCommands->childSetVisible("wear_btn", wear_enabled);
+	mListCommands->childSetEnabled("make_outfit_btn", make_outfit_enabled);
 }
 
 void LLPanelOutfitsInventory::onGearButtonClick()
@@ -276,7 +375,7 @@ void LLPanelOutfitsInventory::onGearButtonClick()
 
 void LLPanelOutfitsInventory::onAddButtonClick()
 {
-	onNew();
+	onSave();
 }
 
 void LLPanelOutfitsInventory::showActionMenu(LLMenuGL* menu, std::string spawning_view_name)
@@ -303,6 +402,8 @@ void LLPanelOutfitsInventory::onClipboardAction(const LLSD& userdata)
 {
 	std::string command_name = userdata.asString();
 	getActivePanel()->getRootFolder()->doToSelected(getActivePanel()->getModel(),command_name);
+	updateListCommands();
+	updateVerbs();
 }
 
 void LLPanelOutfitsInventory::onCustomAction(const LLSD& userdata)
@@ -313,7 +414,7 @@ void LLPanelOutfitsInventory::onCustomAction(const LLSD& userdata)
 	const std::string command_name = userdata.asString();
 	if (command_name == "new")
 	{
-		onNew();
+		onSave();
 	}
 	if (command_name == "edit")
 	{
@@ -323,6 +424,7 @@ void LLPanelOutfitsInventory::onCustomAction(const LLSD& userdata)
 	{
 		onWearButtonClick();
 	}
+	// Note: This option has been removed from the gear menu.
 	if (command_name == "add")
 	{
 		onAdd();
@@ -343,20 +445,22 @@ void LLPanelOutfitsInventory::onCustomAction(const LLSD& userdata)
 	{
 		onClipboardAction("delete");
 	}
+	updateListCommands();
+	updateVerbs();
 }
 
 BOOL LLPanelOutfitsInventory::isActionEnabled(const LLSD& userdata)
 {
 	const std::string command_name = userdata.asString();
-	if (command_name == "delete")
+	if (command_name == "delete" || command_name == "remove")
 	{
 		BOOL can_delete = FALSE;
 		LLFolderView *folder = getActivePanel()->getRootFolder();
 		if (folder)
 		{
-			can_delete = TRUE;
 			std::set<LLUUID> selection_set;
 			folder->getSelectionList(selection_set);
+			can_delete = (selection_set.size() > 0);
 			for (std::set<LLUUID>::iterator iter = selection_set.begin();
 				 iter != selection_set.end();
 				 ++iter)
@@ -375,9 +479,9 @@ BOOL LLPanelOutfitsInventory::isActionEnabled(const LLSD& userdata)
 		LLFolderView *folder = getActivePanel()->getRootFolder();
 		if (folder)
 		{
-			can_delete = TRUE;
 			std::set<LLUUID> selection_set;
 			folder->getSelectionList(selection_set);
+			can_delete = (selection_set.size() > 0);
 			for (std::set<LLUUID>::iterator iter = selection_set.begin();
 				 iter != selection_set.end();
 				 ++iter)
@@ -391,10 +495,27 @@ BOOL LLPanelOutfitsInventory::isActionEnabled(const LLSD& userdata)
 		}
 		return FALSE;
 	}
+	if (command_name == "rename" ||
+		command_name == "delete_outfit")
+	{
+		return (getCorrectListenerForAction() != NULL) && hasItemsSelected();
+	}
+	
+	if (command_name == "wear")
+	{
+		const BOOL is_my_outfits = (mActivePanel->getName() == "outfitslist_tab");
+		if (!is_my_outfits)
+		{
+			return FALSE;
+		}
+	}
+	if (command_name == "make_outfit")
+	{
+		return TRUE;
+	}
+   
 	if (command_name == "edit" || 
-		command_name == "wear" ||
-		command_name == "add" ||
-		command_name == "remove"
+		command_name == "add"
 		)
 	{
 		return (getCorrectListenerForAction() != NULL);
@@ -402,6 +523,19 @@ BOOL LLPanelOutfitsInventory::isActionEnabled(const LLSD& userdata)
 	return TRUE;
 }
 
+bool LLPanelOutfitsInventory::hasItemsSelected()
+{
+	bool has_items_selected = false;
+	LLFolderView *folder = getActivePanel()->getRootFolder();
+	if (folder)
+	{
+		std::set<LLUUID> selection_set;
+		folder->getSelectionList(selection_set);
+		has_items_selected = (selection_set.size() > 0);
+	}
+	return has_items_selected;
+}
+
 bool LLPanelOutfitsInventory::handleDragAndDropToTrash(BOOL drop, EDragAndDropType cargo_type, EAcceptance* accept)
 {
 	*accept = ACCEPT_NO;
@@ -425,17 +559,15 @@ bool LLPanelOutfitsInventory::handleDragAndDropToTrash(BOOL drop, EDragAndDropTy
 void LLPanelOutfitsInventory::initTabPanels()
 {
 	mTabPanels.resize(2);
+
+	LLInventoryPanel *cof_panel = getChild<LLInventoryPanel>("cof_tab");
+	cof_panel->setShowFolderState(LLInventoryFilter::SHOW_NON_EMPTY_FOLDERS);
+	mTabPanels[0] = cof_panel;
 	
-	LLInventoryPanel *myoutfits_panel = getChild<LLInventoryPanel>("outfitslist_accordionpanel");
+	LLInventoryPanel *myoutfits_panel = getChild<LLInventoryPanel>("outfitslist_tab");
 	myoutfits_panel->setFilterTypes(1LL << LLFolderType::FT_OUTFIT, LLInventoryFilter::FILTERTYPE_CATEGORY);
 	myoutfits_panel->setShowFolderState(LLInventoryFilter::SHOW_NON_EMPTY_FOLDERS);
-	mTabPanels[0] = myoutfits_panel;
-	mActivePanel = myoutfits_panel;
-
-
-	LLInventoryPanel *cof_panel = getChild<LLInventoryPanel>("cof_accordionpanel");
-	cof_panel->setShowFolderState(LLInventoryFilter::SHOW_NON_EMPTY_FOLDERS);
-	mTabPanels[1] = cof_panel;
+	mTabPanels[1] = myoutfits_panel;
 
 	for (tabpanels_vec_t::iterator iter = mTabPanels.begin();
 		 iter != mTabPanels.end();
@@ -447,6 +579,7 @@ void LLPanelOutfitsInventory::initTabPanels()
 
 	mAppearanceTabs = getChild<LLTabContainer>("appearance_tabs");
 	mAppearanceTabs->setCommitCallback(boost::bind(&LLPanelOutfitsInventory::onTabChange, this));
+	mActivePanel = (LLInventoryPanel*)mAppearanceTabs->getCurrentPanel();
 }
 
 void LLPanelOutfitsInventory::onTabSelectionChange(LLInventoryPanel* tab_panel, const std::deque<LLFolderViewItem*> &items, BOOL user_action)
@@ -479,9 +612,7 @@ void LLPanelOutfitsInventory::onTabChange()
 		return;
 	}
 	mActivePanel->setFilterSubString(mFilterSubString);
-
-	bool is_my_outfits = (mActivePanel->getName() == "outfitslist_accordionpanel");
-	mListCommands->childSetEnabled("make_outfit_btn", is_my_outfits);
+	updateVerbs();
 }
 
 LLInventoryPanel* LLPanelOutfitsInventory::getActivePanel()
diff --git a/indra/newview/llpaneloutfitsinventory.h b/indra/newview/llpaneloutfitsinventory.h
index 1e084750a09..76110e2a3f7 100644
--- a/indra/newview/llpaneloutfitsinventory.h
+++ b/indra/newview/llpaneloutfitsinventory.h
@@ -53,12 +53,15 @@ class LLPanelOutfitsInventory : public LLPanel
 	virtual ~LLPanelOutfitsInventory();
 
 	/*virtual*/ BOOL postBuild();
+	/*virtual*/ void onOpen(const LLSD& key);
 	
 	void onSearchEdit(const std::string& string);
 	void onAdd();
 	void onRemove();
 	void onEdit();
-	void onNew();
+	void onSave();
+	
+	void onSaveCommit(const std::string& item_name);
 
 	void onSelectionChange(const std::deque<LLFolderViewItem*> &items, BOOL user_action);
 	void onSelectorButtonClicked();
@@ -114,6 +117,7 @@ class LLPanelOutfitsInventory : public LLPanel
 	BOOL isActionEnabled(const LLSD& command_name);
 	void onCustomAction(const LLSD& command_name);
 	bool handleDragAndDropToTrash(BOOL drop, EDragAndDropType cargo_type, EAcceptance* accept);
+	bool hasItemsSelected();
 private:
 	LLPanel*					mListCommands;
 	LLMenuGL*					mMenuGearDefault;
diff --git a/indra/newview/llpanelpeople.cpp b/indra/newview/llpanelpeople.cpp
index e14a5778adc..c14b282488c 100644
--- a/indra/newview/llpanelpeople.cpp
+++ b/indra/newview/llpanelpeople.cpp
@@ -35,6 +35,7 @@
 // libs
 #include "llfloaterreg.h"
 #include "llmenugl.h"
+#include "llnotificationsutil.h"
 #include "llfiltereditor.h"
 #include "lltabcontainer.h"
 #include "lluictrlfactory.h"
@@ -531,10 +532,10 @@ BOOL LLPanelPeople::postBuild()
 	friends_panel->childSetAction("add_btn",	boost::bind(&LLPanelPeople::onAddFriendWizButtonClicked,	this));
 	friends_panel->childSetAction("del_btn",	boost::bind(&LLPanelPeople::onDeleteFriendButtonClicked,	this));
 
-	mOnlineFriendList->setDoubleClickCallback(boost::bind(&LLPanelPeople::onAvatarListDoubleClicked, this, mOnlineFriendList));
-	mAllFriendList->setDoubleClickCallback(boost::bind(&LLPanelPeople::onAvatarListDoubleClicked, this, mAllFriendList));
-	mNearbyList->setDoubleClickCallback(boost::bind(&LLPanelPeople::onAvatarListDoubleClicked, this, mNearbyList));
-	mRecentList->setDoubleClickCallback(boost::bind(&LLPanelPeople::onAvatarListDoubleClicked, this, mRecentList));
+	mOnlineFriendList->setItemDoubleClickCallback(boost::bind(&LLPanelPeople::onAvatarListDoubleClicked, this, _1));
+	mAllFriendList->setItemDoubleClickCallback(boost::bind(&LLPanelPeople::onAvatarListDoubleClicked, this, _1));
+	mNearbyList->setItemDoubleClickCallback(boost::bind(&LLPanelPeople::onAvatarListDoubleClicked, this, _1));
+	mRecentList->setItemDoubleClickCallback(boost::bind(&LLPanelPeople::onAvatarListDoubleClicked, this, _1));
 
 	mOnlineFriendList->setCommitCallback(boost::bind(&LLPanelPeople::onAvatarListCommitted, this, mOnlineFriendList));
 	mAllFriendList->setCommitCallback(boost::bind(&LLPanelPeople::onAvatarListCommitted, this, mAllFriendList));
@@ -750,7 +751,6 @@ void LLPanelPeople::updateButtons()
 
 		LLPanel* groups_panel = mTabContainer->getCurrentPanel();
 		groups_panel->childSetEnabled("activate_btn",	item_selected && !cur_group_active); // "none" or a non-active group selected
-		groups_panel->childSetEnabled("plus_btn",		item_selected);
 		groups_panel->childSetEnabled("minus_btn",		item_selected && selected_id.notNull());
 	}
 	else
@@ -1005,12 +1005,15 @@ void LLPanelPeople::onTabSelected(const LLSD& param)
 		mFilterEditor->setLabel(getString("people_filter_label"));
 }
 
-void LLPanelPeople::onAvatarListDoubleClicked(LLAvatarList* list)
+void LLPanelPeople::onAvatarListDoubleClicked(LLUICtrl* ctrl)
 {
-	LLUUID clicked_id = list->getSelectedUUID();
-
-	if (clicked_id.isNull())
+	LLAvatarListItem* item = dynamic_cast<LLAvatarListItem*>(ctrl);
+	if(!item)
+	{
 		return;
+	}
+
+	LLUUID clicked_id = item->getAvatarId();
 	
 #if 0 // SJB: Useful for testing, but not currently functional or to spec
 	LLAvatarActions::showProfile(clicked_id);
@@ -1138,6 +1141,12 @@ void LLPanelPeople::onAvatarPicked(
 
 void LLPanelPeople::onGroupPlusButtonClicked()
 {
+	if (!gAgent.canJoinGroups())
+	{
+		LLNotificationsUtil::add("JoinedTooManyGroups");
+		return;
+	}
+
 	LLMenuGL* plus_menu = (LLMenuGL*)mGroupPlusMenuHandle.get();
 	if (!plus_menu)
 		return;
diff --git a/indra/newview/llpanelpeople.h b/indra/newview/llpanelpeople.h
index da2c0e368ca..7580fdbeeff 100644
--- a/indra/newview/llpanelpeople.h
+++ b/indra/newview/llpanelpeople.h
@@ -109,7 +109,7 @@ class LLPanelPeople : public LLPanel
 	void					onNearbyViewSortButtonClicked();
 	void					onFriendsViewSortButtonClicked();
 	void					onGroupsViewSortButtonClicked();
-	void					onAvatarListDoubleClicked(LLAvatarList* list);
+	void					onAvatarListDoubleClicked(LLUICtrl* ctrl);
 	void					onAvatarListCommitted(LLAvatarList* list);
 	void					onGroupPlusButtonClicked();
 	void					onGroupMinusButtonClicked();
diff --git a/indra/newview/llpanelpick.cpp b/indra/newview/llpanelpick.cpp
index 7a4dd3569d5..5ac05875505 100644
--- a/indra/newview/llpanelpick.cpp
+++ b/indra/newview/llpanelpick.cpp
@@ -35,24 +35,30 @@
 // profile.
 
 #include "llviewerprecompiledheaders.h"
-#include "llpanel.h"
+
+#include "llpanelpick.h"
+
 #include "message.h"
-#include "llagent.h"
-#include "llagentpicksinfo.h"
+
+#include "llparcel.h"
+
 #include "llbutton.h"
+#include "llfloaterreg.h"
 #include "lliconctrl.h"
 #include "lllineeditor.h"
-#include "llparcel.h"
-#include "llviewerparcelmgr.h"
+#include "llpanel.h"
+#include "llscrollcontainer.h"
 #include "lltexteditor.h"
+
+#include "llagent.h"
+#include "llagentpicksinfo.h"
+#include "llavatarpropertiesprocessor.h"
+#include "llfloaterworldmap.h"
 #include "lltexturectrl.h"
 #include "lluiconstants.h"
+#include "llviewerparcelmgr.h"
 #include "llviewerregion.h"
 #include "llworldmap.h"
-#include "llfloaterworldmap.h"
-#include "llfloaterreg.h"
-#include "llavatarpropertiesprocessor.h"
-#include "llpanelpick.h"
 
 
 #define XML_PANEL_EDIT_PICK "panel_edit_pick.xml"
@@ -93,6 +99,10 @@ LLPanelPickInfo::LLPanelPickInfo()
  , mPickId(LLUUID::null)
  , mParcelId(LLUUID::null)
  , mRequestedId(LLUUID::null)
+ , mScrollingPanelMinHeight(0)
+ , mScrollingPanelWidth(0)
+ , mScrollingPanel(NULL)
+ , mScrollContainer(NULL)
 {
 }
 
@@ -146,9 +156,35 @@ BOOL LLPanelPickInfo::postBuild()
 	childSetAction("show_on_map_btn", boost::bind(&LLPanelPickInfo::onClickMap, this));
 	childSetAction("back_btn", boost::bind(&LLPanelPickInfo::onClickBack, this));
 
+	mScrollingPanel = getChild<LLPanel>("scroll_content_panel");
+	mScrollContainer = getChild<LLScrollContainer>("profile_scroll");
+
+	mScrollingPanelMinHeight = mScrollContainer->getScrolledViewRect().getHeight();
+	mScrollingPanelWidth = mScrollingPanel->getRect().getWidth();
+
 	return TRUE;
 }
 
+void LLPanelPickInfo::reshape(S32 width, S32 height, BOOL called_from_parent)
+{
+	LLPanel::reshape(width, height, called_from_parent);
+
+	if (!mScrollContainer || !mScrollingPanel)
+		return;
+
+	static LLUICachedControl<S32> scrollbar_size ("UIScrollbarSize", 0);
+
+	S32 scroll_height = mScrollContainer->getRect().getHeight();
+	if (mScrollingPanelMinHeight >= scroll_height)
+	{
+		mScrollingPanel->reshape(mScrollingPanelWidth, mScrollingPanelMinHeight);
+	}
+	else
+	{
+		mScrollingPanel->reshape(mScrollingPanelWidth + scrollbar_size, scroll_height);
+	}
+}
+
 void LLPanelPickInfo::processProperties(void* data, EAvatarProcessorType type)
 {
 	if(APT_PICK_INFO != type)
@@ -284,7 +320,6 @@ void LLPanelPickInfo::setPickName(const std::string& name)
 void LLPanelPickInfo::setPickDesc(const std::string& desc)
 {
 	childSetValue(XML_DESC, desc);
-	updateContentPanelRect();
 }
 
 void LLPanelPickInfo::setPickLocation(const std::string& location)
@@ -292,31 +327,6 @@ void LLPanelPickInfo::setPickLocation(const std::string& location)
 	childSetValue(XML_LOCATION, location);
 }
 
-void LLPanelPickInfo::updateContentPanelRect()
-{
-	LLTextBox* desc = getChild<LLTextBox>(XML_DESC);
-
-	S32 text_height = desc->getTextPixelHeight();
-	LLRect text_rect = desc->getRect();
-
-	// let text-box height fit text height
-	text_rect.set(text_rect.mLeft, text_rect.mTop, text_rect.mRight, text_rect.mTop - text_height);
-	desc->setRect(text_rect);
-	desc->reshape(text_rect.getWidth(), text_rect.getHeight());
-	// force reflow
-	desc->setText(desc->getText());
-
-	// bottom of description text-box will be bottom of content panel
-	desc->localRectToOtherView(desc->getLocalRect(), &text_rect, getChild<LLView>("profile_scroll"));
-
-	LLPanel* content_panel = getChild<LLPanel>("scroll_content_panel");
-	LLRect content_rect = content_panel->getRect();
-	content_rect.set(content_rect.mLeft, content_rect.mTop, content_rect.mRight, text_rect.mBottom);
-	// Somehow setRect moves all elements down.
-	// Single reshape() updates rect and does not move anything.
-	content_panel->reshape(content_rect.getWidth(), content_rect.getHeight());
-}
-
 void LLPanelPickInfo::onClickMap()
 {
 	LLFloaterWorldMap::getInstance()->trackLocation(getPosGlobal());
@@ -438,7 +448,7 @@ BOOL LLPanelPickEdit::postBuild()
 {
 	LLPanelPickInfo::postBuild();
 
-	mSnapshotCtrl->setOnSelectCallback(boost::bind(&LLPanelPickEdit::onPickChanged, this, _1));
+	mSnapshotCtrl->setCommitCallback(boost::bind(&LLPanelPickEdit::onSnapshotChanged, this));
 
 	LLLineEditor* line_edit = getChild<LLLineEditor>("pick_name");
 	line_edit->setKeystrokeCallback(boost::bind(&LLPanelPickEdit::onPickChanged, this, _1), NULL);
@@ -527,16 +537,14 @@ void LLPanelPickEdit::sendUpdate()
 	}
 }
 
+void LLPanelPickEdit::onSnapshotChanged()
+{
+	enableSaveButton(true);
+}
+
 void LLPanelPickEdit::onPickChanged(LLUICtrl* ctrl)
 {
-	if(isDirty())
-	{
-		enableSaveButton(true);
-	}
-	else
-	{
-		enableSaveButton(false);
-	}
+	enableSaveButton(isDirty());
 }
 
 void LLPanelPickEdit::resetData()
@@ -603,10 +611,6 @@ void LLPanelPickEdit::initTexturePickerMouseEvents()
 	mSnapshotCtrl->setMouseEnterCallback(boost::bind(&LLPanelPickEdit::onTexturePickerMouseEnter, this, _1));
 	mSnapshotCtrl->setMouseLeaveCallback(boost::bind(&LLPanelPickEdit::onTexturePickerMouseLeave, this, _1));
 	
-	// *WORKAROUND: Needed for EXT-1625: enabling save button each time when picker is opened, even if 
-	// texture wasn't changed (see Steve's comment).
-	mSnapshotCtrl->setMouseDownCallback(boost::bind(&LLPanelPickEdit::enableSaveButton, this, true));
-	
 	text_icon->setVisible(FALSE);
 }
 		
diff --git a/indra/newview/llpanelpick.h b/indra/newview/llpanelpick.h
index 12b5a116b48..4f27760a8de 100644
--- a/indra/newview/llpanelpick.h
+++ b/indra/newview/llpanelpick.h
@@ -43,6 +43,7 @@
 
 class LLIconCtrl;
 class LLTextureCtrl;
+class LLScrollContainer;
 class LLMessageSystem;
 class LLAvatarPropertiesObserver;
 
@@ -69,6 +70,8 @@ class LLPanelPickInfo : public LLPanel, public LLAvatarPropertiesObserver, LLRem
 
 	/*virtual*/ BOOL postBuild();
 
+	/*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE);
+
 	/*virtual*/ void processProperties(void* data, EAvatarProcessorType type);
 
 	/**
@@ -139,15 +142,6 @@ class LLPanelPickInfo : public LLPanel, public LLAvatarPropertiesObserver, LLRem
 	virtual void setPosGlobal(const LLVector3d& pos) { mPosGlobal = pos; }
 	virtual LLVector3d& getPosGlobal() { return mPosGlobal; }
 
-	/**
-	 * Reshapes content panel to fit all elements.
-	 *
-	 * Assume that description text-box is the last element of panel.
-	 * Reshape text-box to fit text height and then reshape content panel to fit 
-	 * text-box bottom. EXT-1326
-	 */
-	void updateContentPanelRect();
-
 	/**
 	 * Callback for "Map" button, opens Map
 	 */
@@ -162,7 +156,11 @@ class LLPanelPickInfo : public LLPanel, public LLAvatarPropertiesObserver, LLRem
 
 protected:
 
-	LLTextureCtrl* mSnapshotCtrl;
+	S32						mScrollingPanelMinHeight;
+	S32						mScrollingPanelWidth;
+	LLScrollContainer*		mScrollContainer;
+	LLPanel*				mScrollingPanel;
+	LLTextureCtrl*			mSnapshotCtrl;
 
 	LLUUID mAvatarId;
 	LLVector3d mPosGlobal;
@@ -223,6 +221,11 @@ class LLPanelPickEdit : public LLPanelPickInfo
 	 */
 	void sendUpdate();
 
+	/**
+	 * Called when snapshot image changes.
+	 */
+	void onSnapshotChanged();
+	
 	/**
 	 * Callback for Pick snapshot, name and description changed event.
 	 */
diff --git a/indra/newview/llpanelpicks.cpp b/indra/newview/llpanelpicks.cpp
index 751705dd577..ada65c98a49 100644
--- a/indra/newview/llpanelpicks.cpp
+++ b/indra/newview/llpanelpicks.cpp
@@ -411,6 +411,7 @@ BOOL LLPanelPicks::postBuild()
 
 	LLUICtrl::CommitCallbackRegistry::ScopedRegistrar plus_registar;
 	plus_registar.add("Picks.Plus.Action", boost::bind(&LLPanelPicks::onPlusMenuItemClicked, this, _2));
+	mEnableCallbackRegistrar.add("Picks.Plus.Enable", boost::bind(&LLPanelPicks::isActionEnabled, this, _2));
 	mPlusMenu = LLUICtrlFactory::getInstance()->createFromFile<LLToggleableMenu>("menu_picks_plus.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
 	
 	return TRUE;
@@ -430,6 +431,18 @@ void LLPanelPicks::onPlusMenuItemClicked(const LLSD& param)
 	}
 }
 
+bool LLPanelPicks::isActionEnabled(const LLSD& userdata) const
+{
+	std::string command_name = userdata.asString();
+
+	if (command_name == "new_pick" && LLAgentPicksInfo::getInstance()->isPickLimitReached())
+	{
+		return false;
+	}
+
+	return true;
+}
+
 void LLPanelPicks::onAccordionStateChanged(const LLAccordionCtrlTab* acc_tab)
 {
 	if(!mPicksAccTab->getDisplayChildren())
@@ -652,7 +665,6 @@ void LLPanelPicks::updateButtons()
 
 	if (getAvatarId() == gAgentID)
 	{
-		childSetEnabled(XML_BTN_NEW, !LLAgentPicksInfo::getInstance()->isPickLimitReached());
 		childSetEnabled(XML_BTN_DELETE, has_selected);
 	}
 
diff --git a/indra/newview/llpanelpicks.h b/indra/newview/llpanelpicks.h
index 1b2e35ca468..3f757e482e1 100644
--- a/indra/newview/llpanelpicks.h
+++ b/indra/newview/llpanelpicks.h
@@ -97,6 +97,7 @@ class LLPanelPicks
 	void onClickMap();
 
 	void onPlusMenuItemClicked(const LLSD& param);
+	bool isActionEnabled(const LLSD& userdata) const;
 
 	void onListCommit(const LLFlatListView* f_list);
 	void onAccordionStateChanged(const LLAccordionCtrlTab* acc_tab);
diff --git a/indra/newview/llpanelplaces.cpp b/indra/newview/llpanelplaces.cpp
index 685104a8b1f..b037674c374 100644
--- a/indra/newview/llpanelplaces.cpp
+++ b/indra/newview/llpanelplaces.cpp
@@ -449,6 +449,22 @@ void LLPanelPlaces::setItem(LLInventoryItem* item)
 	}
 }
 
+S32 LLPanelPlaces::notifyParent(const LLSD& info)
+{
+	if(info.has("update_verbs"))
+	{
+		if(mPosGlobal.isExactlyZero())
+		{
+			mPosGlobal.setVec(info["global_x"], info["global_y"], info["global_z"]);
+		}
+
+		updateVerbs();
+		
+		return 1;
+	}
+	return LLPanel::notifyParent(info);
+}
+
 void LLPanelPlaces::onLandmarkLoaded(LLLandmark* landmark)
 {
 	if (!mLandmarkInfo)
@@ -460,6 +476,8 @@ void LLPanelPlaces::onLandmarkLoaded(LLLandmark* landmark)
 	mLandmarkInfo->displayParcelInfo(region_id, mPosGlobal);
 
 	mSaveBtn->setEnabled(TRUE);
+
+	updateVerbs();
 }
 
 void LLPanelPlaces::onFilterEdit(const std::string& search_string, bool force_filter)
@@ -824,6 +842,19 @@ void LLPanelPlaces::togglePlaceInfoPanel(BOOL visible)
 
 			mPlaceProfile->setVisible(FALSE);
 		}
+		else
+		{
+			LLLandmarksPanel* landmarks_panel =
+					dynamic_cast<LLLandmarksPanel*>(mTabContainer->getPanelByName("Landmarks"));
+			if (landmarks_panel && mItem.notNull())
+			{
+				// If a landmark info is being closed we open the landmarks tab
+				// and set this landmark selected.
+				mTabContainer->selectTabPanel(landmarks_panel);
+
+				landmarks_panel->setItemSelected(mItem->getUUID(), TRUE);
+			}
+		}
 	}
 }
 
diff --git a/indra/newview/llpanelplaces.h b/indra/newview/llpanelplaces.h
index 5ee87049926..27b5911ebb0 100644
--- a/indra/newview/llpanelplaces.h
+++ b/indra/newview/llpanelplaces.h
@@ -71,6 +71,12 @@ class LLPanelPlaces : public LLPanel
 
 	void setItem(LLInventoryItem* item);
 
+	LLInventoryItem* getItem() { return mItem; }
+
+	std::string getPlaceInfoType() { return mPlaceInfoType; }
+
+	/*virtual*/ S32 notifyParent(const LLSD& info);
+
 private:
 	void onLandmarkLoaded(LLLandmark* landmark);
 	void onFilterEdit(const std::string& search_string, bool force_filter);
diff --git a/indra/newview/llpanelprimmediacontrols.cpp b/indra/newview/llpanelprimmediacontrols.cpp
index 5cc9c1951b5..2dc3a626376 100644
--- a/indra/newview/llpanelprimmediacontrols.cpp
+++ b/indra/newview/llpanelprimmediacontrols.cpp
@@ -127,7 +127,11 @@ LLPanelPrimMediaControls::LLPanelPrimMediaControls() :
 	mScrollState = SCROLL_NONE;
 
 	mPanelHandle.bind(this);
+	
+	mInactiveTimeout = gSavedSettings.getF32("MediaControlTimeout");
+	mControlFadeTime = gSavedSettings.getF32("MediaControlFadeTime");
 }
+
 LLPanelPrimMediaControls::~LLPanelPrimMediaControls()
 {
 }
@@ -156,8 +160,6 @@ BOOL LLPanelPrimMediaControls::postBuild()
 	mSkipBackCtrl			= getChild<LLUICtrl>("skip_back");
 	mVolumeCtrl				= getChild<LLUICtrl>("media_volume");
 	mMuteBtn				= getChild<LLButton>("media_mute_button");
-	mVolumeUpCtrl			= getChild<LLUICtrl>("volume_up");
-	mVolumeDownCtrl			= getChild<LLUICtrl>("volume_down");
 	mVolumeSliderCtrl       = getChild<LLSliderCtrl>("volume_slider");
 	mWhitelistIcon			= getChild<LLIconCtrl>("media_whitelist_flag");
 	mSecureLockIcon			= getChild<LLIconCtrl>("media_secure_lock_flag");
@@ -172,6 +174,7 @@ BOOL LLPanelPrimMediaControls::postBuild()
 	LLStringUtil::convertToF32(getString("zoom_near_padding"), mZoomNearPadding);
 	LLStringUtil::convertToF32(getString("zoom_medium_padding"), mZoomMediumPadding);
 	LLStringUtil::convertToF32(getString("zoom_far_padding"), mZoomFarPadding);
+	LLStringUtil::convertToS32(getString("top_world_view_avoid_zone"), mTopWorldViewAvoidZone);
 
 	// These are currently removed...but getChild creates a "dummy" widget.
 	// This class handles them missing.
@@ -207,11 +210,9 @@ BOOL LLPanelPrimMediaControls::postBuild()
 	}
 		
 	mMediaAddress->setFocusReceivedCallback(boost::bind(&LLPanelPrimMediaControls::onInputURL, _1, this ));
-	mInactiveTimeout = gSavedSettings.getF32("MediaControlTimeout");
-	mControlFadeTime = gSavedSettings.getF32("MediaControlFadeTime");
-
+	
 	mCurrentZoom = ZOOM_NONE;
-	// clicks on HUD buttons do not remove keyboard focus from media
+	// clicks on buttons do not remove keyboard focus from media
 	setIsChrome(TRUE);
 	return TRUE;
 }
@@ -336,8 +337,6 @@ void LLPanelPrimMediaControls::updateShape()
 		mMediaAddressCtrl->setVisible(has_focus && !mini_controls);
 		mMediaPlaySliderPanel->setVisible(has_focus && !mini_controls);
 		mVolumeCtrl->setVisible(false);
-		mVolumeUpCtrl->setVisible(false);
-		mVolumeDownCtrl->setVisible(false);
 		
 		mWhitelistIcon->setVisible(!mini_controls && (media_data)?media_data->getWhiteListEnable():false);
 		// Disable zoom if HUD
@@ -370,11 +369,9 @@ void LLPanelPrimMediaControls::updateShape()
 			mSkipBackCtrl->setEnabled(has_focus && !mini_controls);
 			
 			mVolumeCtrl->setVisible(has_focus);
-			mVolumeUpCtrl->setVisible(has_focus);
-			mVolumeDownCtrl->setVisible(has_focus);
 			mVolumeCtrl->setEnabled(has_focus);
-			mVolumeSliderCtrl->setEnabled(has_focus && mVolumeSliderVisible > 0);
-			mVolumeSliderCtrl->setVisible(has_focus && mVolumeSliderVisible > 0);
+			mVolumeSliderCtrl->setEnabled(has_focus && shouldVolumeSliderBeVisible());
+			mVolumeSliderCtrl->setVisible(has_focus && shouldVolumeSliderBeVisible());
 			
 			mWhitelistIcon->setVisible(false);
 			mSecureLockIcon->setVisible(false);
@@ -414,21 +411,15 @@ void LLPanelPrimMediaControls::updateShape()
 			// video vloume
 			if(volume <= 0.0)
 			{
-				mVolumeUpCtrl->setEnabled(TRUE);
-				mVolumeDownCtrl->setEnabled(FALSE);
 				mMuteBtn->setToggleState(true);
 			}
 			else if (volume >= 1.0)
 			{
-				mVolumeUpCtrl->setEnabled(FALSE);
-				mVolumeDownCtrl->setEnabled(TRUE);
 				mMuteBtn->setToggleState(false);
 			}
 			else
 			{
 				mMuteBtn->setToggleState(false);
-				mVolumeUpCtrl->setEnabled(TRUE);
-				mVolumeDownCtrl->setEnabled(TRUE);
 			}
 			
 			switch(result)
@@ -473,12 +464,8 @@ void LLPanelPrimMediaControls::updateShape()
 			mSkipBackCtrl->setEnabled(FALSE);
 			
 			mVolumeCtrl->setVisible(FALSE);
-			mVolumeUpCtrl->setVisible(FALSE);
-			mVolumeDownCtrl->setVisible(FALSE);
 			mVolumeSliderCtrl->setVisible(FALSE);
 			mVolumeCtrl->setEnabled(FALSE);
-			mVolumeUpCtrl->setEnabled(FALSE);
-			mVolumeDownCtrl->setEnabled(FALSE);
 			mVolumeSliderCtrl->setEnabled(FALSE);
 			
 			if (mMediaPanelScroll)
@@ -627,36 +614,45 @@ void LLPanelPrimMediaControls::updateShape()
 			update_min_max(min, max, LLVector3(screen_vert.v));
 		}
 		
+		// convert screenspace bbox to pixels (in screen coords)
+		LLRect window_rect = gViewerWindow->getWorldViewRectScaled();
 		LLCoordGL screen_min;
-		screen_min.mX = llround((F32)gViewerWindow->getWorldViewWidthScaled() * (min.mV[VX] + 1.f) * 0.5f);
-		screen_min.mY = llround((F32)gViewerWindow->getWorldViewHeightScaled() * (min.mV[VY] + 1.f) * 0.5f);
+		screen_min.mX = llround((F32)window_rect.getWidth() * (min.mV[VX] + 1.f) * 0.5f);
+		screen_min.mY = llround((F32)window_rect.getHeight() * (min.mV[VY] + 1.f) * 0.5f);
 		
 		LLCoordGL screen_max;
-		screen_max.mX = llround((F32)gViewerWindow->getWorldViewWidthScaled() * (max.mV[VX] + 1.f) * 0.5f);
-		screen_max.mY = llround((F32)gViewerWindow->getWorldViewHeightScaled() * (max.mV[VY] + 1.f) * 0.5f);
+		screen_max.mX = llround((F32)window_rect.getWidth() * (max.mV[VX] + 1.f) * 0.5f);
+		screen_max.mY = llround((F32)window_rect.getHeight() * (max.mV[VY] + 1.f) * 0.5f);
 		
-		// grow panel so that screenspace bounding box fits inside "media_region" element of HUD
-		LLRect media_controls_rect;
-		S32 volume_slider_height = mVolumeSliderCtrl->getRect().getHeight() - /*fudge*/ 2;
-		getParent()->screenRectToLocal(LLRect(screen_min.mX, screen_max.mY, screen_max.mX, screen_min.mY), &media_controls_rect);
-		media_controls_rect.mLeft -= mMediaRegion->getRect().mLeft;
-		media_controls_rect.mBottom -= mMediaRegion->getRect().mBottom - volume_slider_height;
-		media_controls_rect.mTop += getRect().getHeight() - mMediaRegion->getRect().mTop;
-		media_controls_rect.mRight += getRect().getWidth() - mMediaRegion->getRect().mRight;
+		// grow panel so that screenspace bounding box fits inside "media_region" element of panel
+		LLRect media_panel_rect;
+		// Get the height of the controls (less the volume slider)
+		S32 controls_height = mMediaControlsStack->getRect().getHeight() - mVolumeSliderCtrl->getRect().getHeight();
+		getParent()->screenRectToLocal(LLRect(screen_min.mX, screen_max.mY, screen_max.mX, screen_min.mY), &media_panel_rect);
+		media_panel_rect.mTop += controls_height;
 		
-		// keep all parts of HUD on-screen
-		LLRect window_rect = getParent()->getLocalRect();
-		media_controls_rect.intersectWith(window_rect);
+		// keep all parts of panel on-screen
+		// Area of the top of the world view to avoid putting the controls
+		window_rect.mTop -= mTopWorldViewAvoidZone;
+		// Don't include "spacing" bookends on left & right of the media controls
+		window_rect.mLeft -= mLeftBookend->getRect().getWidth();
+		window_rect.mRight += mRightBookend->getRect().getWidth();
+		// Don't include the volume slider
+		window_rect.mBottom -= mVolumeSliderCtrl->getRect().getHeight();
+		media_panel_rect.intersectWith(window_rect);
 		
 		// clamp to minimum size, keeping rect inside window
-		S32 centerX = media_controls_rect.getCenterX();
-		S32 centerY = media_controls_rect.getCenterY();
+		S32 centerX = media_panel_rect.getCenterX();
+		S32 centerY = media_panel_rect.getCenterY();
+		// Shrink screen rect by min width and height, to ensure containment
 		window_rect.stretch(-mMinWidth/2, -mMinHeight/2);
 		window_rect.clampPointToRect(centerX, centerY);
-		media_controls_rect.setCenterAndSize(centerX, centerY,
-											 llmax(mMinWidth, media_controls_rect.getWidth()), llmax(mMinHeight, media_controls_rect.getHeight()));
+		media_panel_rect.setCenterAndSize(centerX, centerY, 
+										  llmax(mMinWidth, media_panel_rect.getWidth()),
+										  llmax(mMinHeight, media_panel_rect.getHeight()));
 		
-		setShape(media_controls_rect, true);
+		// Finally set the size of the panel
+		setShape(media_panel_rect, true);
 		
 		// Test mouse position to see if the cursor is stationary
 		LLCoordWindow cursor_pos_window;
@@ -699,13 +695,13 @@ void LLPanelPrimMediaControls::updateShape()
 /*virtual*/
 void LLPanelPrimMediaControls::draw()
 {
-	F32 alpha = 1.f;
+	F32 alpha = getDrawContext().mAlpha;
 	if(mFadeTimer.getStarted())
 	{
 		F32 time = mFadeTimer.getElapsedTimeF32();
-		alpha = llmax(lerp(1.0, 0.0, time / mControlFadeTime), 0.0f);
+		alpha *= llmax(lerp(1.0, 0.0, time / mControlFadeTime), 0.0f);
 
-		if(mFadeTimer.getElapsedTimeF32() >= mControlFadeTime)
+		if(time >= mControlFadeTime)
 		{
 			if(mClearFaceOnFade)
 			{
@@ -726,27 +722,30 @@ void LLPanelPrimMediaControls::draw()
 	// Build rect for icon area in coord system of this panel
 	// Assumes layout_stack is a direct child of this panel
 	mMediaControlsStack->updateLayout();
-	LLRect icon_area = mMediaControlsStack->getRect();
-
+	
+	// adjust for layout stack spacing
+	S32 space = mMediaControlsStack->getPanelSpacing() + 1;
+	LLRect controls_bg_area = mMediaControlsStack->getRect();
+	
+	controls_bg_area.mTop += space;
+	
 	// adjust to ignore space from volume slider
-	icon_area.mTop -= mVolumeSliderCtrl->getRect().getHeight();
+	controls_bg_area.mBottom += mVolumeSliderCtrl->getRect().getHeight();
 	
 	// adjust to ignore space from left bookend padding
-	icon_area.mLeft += mLeftBookend->getRect().getWidth();
+	controls_bg_area.mLeft += mLeftBookend->getRect().getWidth() - space;
 	
 	// ignore space from right bookend padding
-	icon_area.mRight -= mRightBookend->getRect().getWidth();
+	controls_bg_area.mRight -= mRightBookend->getRect().getWidth() - space;
 		
 	// draw control background UI image
-	mBackgroundImage->draw( icon_area, UI_VERTEX_COLOR % alpha);
+	mBackgroundImage->draw( controls_bg_area, UI_VERTEX_COLOR % alpha);
 	
 	// draw volume slider background UI image
 	if (mVolumeSliderCtrl->getVisible())
 	{
-		LLRect volume_slider_rect = mVolumeSliderCtrl->getRect();
-		// For some reason the rect is not in the right place (??)
-		// This translates the bg to under the slider
-		volume_slider_rect.translate(mVolumeSliderCtrl->getParent()->getRect().mLeft, icon_area.getHeight());
+		LLRect volume_slider_rect;
+		screenRectToLocal(mVolumeSliderCtrl->calcScreenRect(), &volume_slider_rect);
 		mVolumeSliderBackgroundImage->draw(volume_slider_rect, UI_VERTEX_COLOR % alpha);
 	}
 	
@@ -1259,6 +1258,11 @@ void LLPanelPrimMediaControls::onToggleMute()
 		{
 			media_impl->setVolume(0.0);
 		}
+		else if (mVolumeSliderCtrl->getValueF32() == 0.0)
+		{
+			media_impl->setVolume(1.0);
+			mVolumeSliderCtrl->setValue(1.0);
+		}
 		else 
 		{
 			media_impl->setVolume(mVolumeSliderCtrl->getValueF32());
@@ -1271,8 +1275,12 @@ void LLPanelPrimMediaControls::showVolumeSlider()
 	mVolumeSliderVisible++;
 }
 
-
 void LLPanelPrimMediaControls::hideVolumeSlider()
 {
 	mVolumeSliderVisible--;
 }
+
+bool LLPanelPrimMediaControls::shouldVolumeSliderBeVisible()
+{
+	return mVolumeSliderVisible > 0;
+}
diff --git a/indra/newview/llpanelprimmediacontrols.h b/indra/newview/llpanelprimmediacontrols.h
index d899ee4473b..743cec70a14 100644
--- a/indra/newview/llpanelprimmediacontrols.h
+++ b/indra/newview/llpanelprimmediacontrols.h
@@ -111,6 +111,7 @@ class LLPanelPrimMediaControls : public LLPanel
 	void onToggleMute();
 	void showVolumeSlider();
 	void hideVolumeSlider();
+	bool shouldVolumeSliderBeVisible();
 	
 	static void onScrollUp(void* user_data);
 	static void onScrollUpHeld(void* user_data);
@@ -155,8 +156,6 @@ class LLPanelPrimMediaControls : public LLPanel
 	LLUICtrl *mMediaPlaySliderCtrl;
 	LLUICtrl *mVolumeCtrl;
 	LLButton *mMuteBtn;
-	LLUICtrl *mVolumeUpCtrl;
-	LLUICtrl *mVolumeDownCtrl;
 	LLSliderCtrl *mVolumeSliderCtrl;
 	LLIconCtrl *mWhitelistIcon;
 	LLIconCtrl *mSecureLockIcon;
@@ -171,6 +170,7 @@ class LLPanelPrimMediaControls : public LLPanel
 	F32 mZoomNearPadding;
 	F32 mZoomMediumPadding;
 	F32 mZoomFarPadding;
+	S32 mTopWorldViewAvoidZone;
 	
 	LLUICtrl *mMediaPanelScroll;
 	LLButton *mScrollUpCtrl;
diff --git a/indra/newview/llpanelteleporthistory.cpp b/indra/newview/llpanelteleporthistory.cpp
index 245f694ac6a..1b8fb496418 100644
--- a/indra/newview/llpanelteleporthistory.cpp
+++ b/indra/newview/llpanelteleporthistory.cpp
@@ -550,7 +550,7 @@ void LLTeleportHistoryPanel::updateVerbs()
 
 	LLTeleportHistoryFlatItem* itemp = dynamic_cast<LLTeleportHistoryFlatItem *> (mLastSelectedFlatlList->getSelectedItem());
 
-	mTeleportBtn->setEnabled(NULL != itemp && itemp->getIndex() < (S32)mTeleportHistory->getItems().size() - 1);
+	mTeleportBtn->setEnabled(NULL != itemp);
 	mShowOnMapBtn->setEnabled(NULL != itemp);
 }
 
@@ -723,7 +723,10 @@ void LLTeleportHistoryPanel::onTeleportHistoryChange(S32 removed_index)
 	if (-1 == removed_index)
 		showTeleportHistory(); // recreate all items
 	else
+	{
 		replaceItem(removed_index); // replace removed item by most recent
+		updateVerbs();
+	}
 }
 
 void LLTeleportHistoryPanel::replaceItem(S32 removed_index)
@@ -1033,7 +1036,7 @@ void LLTeleportHistoryPanel::setAccordionCollapsedByUser(LLUICtrl* acc_tab, bool
 bool LLTeleportHistoryPanel::isAccordionCollapsedByUser(LLUICtrl* acc_tab)
 {
 	LLSD param = acc_tab->getValue();
-	if(!param.has("acc_collapsed"))
+	if(!param.has(COLLAPSED_BY_USER))
 	{
 		return false;
 	}
@@ -1045,4 +1048,11 @@ void LLTeleportHistoryPanel::onAccordionExpand(LLUICtrl* ctrl, const LLSD& param
 	bool expanded = param.asBoolean();
 	// Save accordion tab state to restore it in refresh()
 	setAccordionCollapsedByUser(ctrl, !expanded);
+
+	// Reset selection upon accordion being collapsed
+	// to disable "Teleport" and "Map" buttons for hidden item.
+	if (!expanded && mLastSelectedFlatlList)
+	{
+		mLastSelectedFlatlList->resetSelection();
+	}
 }
diff --git a/indra/newview/llpanelvolume.cpp b/indra/newview/llpanelvolume.cpp
index 5a70842a733..fbe68b4d92f 100644
--- a/indra/newview/llpanelvolume.cpp
+++ b/indra/newview/llpanelvolume.cpp
@@ -54,7 +54,7 @@
 #include "llcolorswatch.h"
 #include "lltexturectrl.h"
 #include "llcombobox.h"
-#include "llfirstuse.h"
+//#include "llfirstuse.h"
 #include "llfocusmgr.h"
 #include "llmanipscale.h"
 #include "llpreviewscript.h"
@@ -470,7 +470,7 @@ void LLPanelVolume::sendIsFlexible()
 
 	if (is_flexible)
 	{
-		LLFirstUse::useFlexible();
+		//LLFirstUse::useFlexible();
 
 		if (objectp->getClickAction() == CLICK_ACTION_SIT)
 		{
diff --git a/indra/newview/llparticipantlist.cpp b/indra/newview/llparticipantlist.cpp
index e2da4c44758..b049f914ad8 100644
--- a/indra/newview/llparticipantlist.cpp
+++ b/indra/newview/llparticipantlist.cpp
@@ -70,7 +70,7 @@ LLParticipantList::LLParticipantList(LLSpeakerMgr* data_source, LLAvatarList* av
 	mSpeakerMgr->addListener(mSpeakerModeratorListener, "update_moderator");
 
 	mAvatarList->setNoItemsCommentText(LLTrans::getString("LoadingData"));
-	mAvatarListDoubleClickConnection = mAvatarList->setDoubleClickCallback(boost::bind(&LLParticipantList::onAvatarListDoubleClicked, this, mAvatarList));
+	mAvatarListDoubleClickConnection = mAvatarList->setItemDoubleClickCallback(boost::bind(&LLParticipantList::onAvatarListDoubleClicked, this, _1));
 	mAvatarListRefreshConnection = mAvatarList->setRefreshCompleteCallback(boost::bind(&LLParticipantList::onAvatarListRefreshed, this, _1, _2));
     // Set onAvatarListDoubleClicked as default on_return action.
 	mAvatarListReturnConnection = mAvatarList->setReturnCallback(boost::bind(&LLParticipantList::onAvatarListDoubleClicked, this, mAvatarList));
@@ -132,10 +132,15 @@ void LLParticipantList::setSpeakingIndicatorsVisible(BOOL visible)
 	mAvatarList->setSpeakingIndicatorsVisible(visible);
 };
 
-void LLParticipantList::onAvatarListDoubleClicked(LLAvatarList* list)
+void LLParticipantList::onAvatarListDoubleClicked(LLUICtrl* ctrl)
 {
-	// NOTE(EM): Should we check if there is multiple selection and start conference if it is so?
-	LLUUID clicked_id = list->getSelectedUUID();
+	LLAvatarListItem* item = dynamic_cast<LLAvatarListItem*>(ctrl);
+	if(!item)
+	{
+		return;
+	}
+
+	LLUUID clicked_id = item->getAvatarId();
 
 	if (clicked_id.isNull() || clicked_id == gAgent.getID())
 		return;
@@ -166,7 +171,6 @@ void LLParticipantList::onAvatarListRefreshed(LLUICtrl* ctrl, const LLSD& param)
 				{
 					name.erase(found, moderator_indicator_len);
 					item->setName(name);
-					item->reshapeAvatarName();
 				}
 			}
 		}
@@ -188,7 +192,6 @@ void LLParticipantList::onAvatarListRefreshed(LLUICtrl* ctrl, const LLSD& param)
 					name += " ";
 					name += moderator_indicator;
 					item->setName(name);
-					item->reshapeAvatarName();
 				}
 			}
 		}
@@ -279,6 +282,9 @@ bool LLParticipantList::onModeratorUpdateEvent(LLPointer<LLOldEvents::LLEvent> e
 					mModeratorList.erase(id);
 				}
 			}
+
+			// apply changes immediately
+			onAvatarListRefreshed(mAvatarList, LLSD());
 		}
 	}
 	return true;
@@ -576,7 +582,7 @@ void LLParticipantList::LLParticipantListMenu::moderateVoiceOtherParticipants(co
 bool LLParticipantList::LLParticipantListMenu::enableContextMenuItem(const LLSD& userdata)
 {
 	std::string item = userdata.asString();
-	if (item == "can_mute_text" || "can_block" == item)
+	if (item == "can_mute_text" || "can_block" == item || "can_share" == item || "can_im" == item)
 	{
 		return mUUIDs.front() != gAgentID;
 	}
@@ -592,8 +598,7 @@ bool LLParticipantList::LLParticipantListMenu::enableContextMenuItem(const LLSD&
 			if (speakerp.notNull())
 			{
 				// not in voice participants can not be moderated
-				return speakerp->mStatus == LLSpeaker::STATUS_VOICE_ACTIVE
-					|| speakerp->mStatus == LLSpeaker::STATUS_MUTED;
+				return speakerp->isInVoiceChannel();
 			}
 		}
 		return false;
diff --git a/indra/newview/llparticipantlist.h b/indra/newview/llparticipantlist.h
index 70badbc40d2..e1b1b5af002 100644
--- a/indra/newview/llparticipantlist.h
+++ b/indra/newview/llparticipantlist.h
@@ -232,7 +232,7 @@ class LLParticipantList
 		};
 
 	private:
-		void onAvatarListDoubleClicked(LLAvatarList* list);
+		void onAvatarListDoubleClicked(LLUICtrl* ctrl);
 		void onAvatarListRefreshed(LLUICtrl* ctrl, const LLSD& param);
 
 		/**
diff --git a/indra/newview/llpreviewgesture.cpp b/indra/newview/llpreviewgesture.cpp
index 2a40cbaba00..84bdaafacf3 100644
--- a/indra/newview/llpreviewgesture.cpp
+++ b/indra/newview/llpreviewgesture.cpp
@@ -364,6 +364,12 @@ BOOL LLPreviewGesture::postBuild()
 	LLTextBox* text;
 	LLCheckBoxCtrl* check;
 
+	edit = getChild<LLLineEditor>("name");
+	edit->setKeystrokeCallback(onKeystrokeCommit, this);
+
+	edit = getChild<LLLineEditor>("desc");
+	edit->setKeystrokeCallback(onKeystrokeCommit, this);
+
 	edit = getChild<LLLineEditor>("trigger_editor");
 	edit->setKeystrokeCallback(onKeystrokeCommit, this);
 	edit->setCommitCallback(onCommitSetDirty, this);
diff --git a/indra/newview/llpreviewnotecard.cpp b/indra/newview/llpreviewnotecard.cpp
index 95756ac5f3d..cc703605282 100644
--- a/indra/newview/llpreviewnotecard.cpp
+++ b/indra/newview/llpreviewnotecard.cpp
@@ -55,7 +55,6 @@
 #include "llviewerobjectlist.h"
 #include "llviewerregion.h"
 #include "lldir.h"
-//#include "llfloaterchat.h"
 #include "llviewerstats.h"
 #include "llviewercontrol.h"		// gSavedSettings
 #include "llappviewer.h"		// app_abort_quit()
diff --git a/indra/newview/llpreviewscript.cpp b/indra/newview/llpreviewscript.cpp
index 646c9fb6a4c..fccf71f3cba 100644
--- a/indra/newview/llpreviewscript.cpp
+++ b/indra/newview/llpreviewscript.cpp
@@ -79,7 +79,6 @@
 #include "llslider.h"
 #include "lldir.h"
 #include "llcombobox.h"
-//#include "llfloaterchat.h"
 #include "llviewerstats.h"
 #include "llviewertexteditor.h"
 #include "llviewerwindow.h"
-- 
GitLab