diff --git a/.hgtags b/.hgtags
index 0f6c5a94d85ecf3e5f8356f85a6da7f39a774fb3..58b5f41a3b290b5143aa30ef032b3f8ec17d2424 100644
--- a/.hgtags
+++ b/.hgtags
@@ -29,6 +29,7 @@ c6e6324f5be1401f077ad18a4a0f6b46451c2f7b last_sprint
 9822eb3e25f7fe0c28ffd8aba45c507caa383cbc 2.2.0-beta2
 b0cd7e150009809a0b5b0a9d5785cd4bb230413a 2.2.0-beta3
 00a831292231faad7e44c69f76cb96f175b8dfad 2.2.0-beta4
+98e0d6df638429fd2f0476667504bd5a6b298def 2.3.0-beta1
 1415e6538d54fd5d568ee88343424d57c6803c2c 2.2.0-release
 98e0d6df638429fd2f0476667504bd5a6b298def 2.3.0-start
 a3c12342b1af0951b8aa3b828aacef17fcea8178 2.3.0-beta1
diff --git a/build.sh b/build.sh
index b372168f982dc4848ec24a719b15d034fb2d79f8..f9c6beefeded66430d40c4d0d7cd9c5c6be66bed 100755
--- a/build.sh
+++ b/build.sh
@@ -228,7 +228,7 @@ do
       fi
     else
       begin_section "Build$variant"
-      build "$variant" "$build_dir" > "$build_log" 2>&1
+      build "$variant" "$build_dir" >> "$build_log" 2>&1
       begin_section Tests
       grep --line-buffered "^##teamcity" "$build_log"
       end_section Tests
diff --git a/doc/contributions.txt b/doc/contributions.txt
index bcf714b29a796e98fd0a62f53775d82d1d2b1578..5d9a971b1e42e319278c98f8b3184ff4c7dbc5a7 100644
--- a/doc/contributions.txt
+++ b/doc/contributions.txt
@@ -62,20 +62,25 @@ Alejandro Rosenthal
 	VWR-1184
 Aleric Inglewood
 	SNOW-522
+	SNOW-626
 	SNOW-756
 	SNOW-764
 	VWR-10001
 	VWR-10759
 	VWR-10837
 	VWR-12691
+	VWR-12984
 	VWR-13996
 	VWR-14426
 	SNOW-84
+	SNOW-477
 	SNOW-766
 	STORM-163
 Ales Beaumont
 	VWR-9352
 	SNOW-240
+Alexandrea Fride
+    STORM-255
 Alissa Sabre
 	VWR-81
 	VWR-83
@@ -124,6 +129,7 @@ Alissa Sabre
 	VWR-12617
 	VWR-12620
 	VWR-12789
+	SNOW-322
 Angus Boyd
 	VWR-592
 Ann Congrejo
@@ -140,6 +146,7 @@ Asuka Neely
 Balp Allen
 	VWR-4157
 Be Holder
+	SNOW-322
 	SNOW-397
 Benja Kepler
 	VWR-746
@@ -173,6 +180,7 @@ Boroondas Gupte
 	VWR-233
 	VWR-20583
 	VWR-20891
+	VWR-23455
 	WEB-262
 Bulli Schumann
 	CT-218
@@ -202,6 +210,8 @@ Catherine Pfeffer
 Celierra Darling
 	VWR-1274
 	VWR-6975
+Cypren Christenson
+	STORM-417
 Dale Glass
 	VWR-120
 	VWR-560
@@ -381,6 +391,8 @@ Malwina Dollinger
 	CT-138
 march Korda
 	SVC-1020
+Marine Kelley
+    STORM-281
 Matthew Dowd
 	VWR-1344
 	VWR-1651
@@ -529,6 +541,7 @@ Pf Shan
 	CT-230
 	CT-231
 	CT-321
+	SNOW-422
 princess niven
 	VWR-5733
 	CT-85
@@ -562,6 +575,7 @@ Robin Cornelius
 	SNOW-585
 	SNOW-599
 	SNOW-747
+	STORM-422
 	VWR-2488
 	VWR-9557
 	VWR-11128
@@ -585,6 +599,8 @@ Salahzar Stenvaag
 	CT-321
 Sammy Frederix
 	VWR-6186
+Satomi Ahn
+	STORM-501
 Scrippy Scofield
 	VWR-3748
 Seg Baphomet
@@ -643,6 +659,7 @@ Strife Onizuka
 	VWR-183
 	VWR-2265
 	VWR-4111
+	SNOW-691
 Tayra Dagostino
 	SNOW-517
 	SNOW-543
@@ -742,6 +759,9 @@ Wilton Lundquist
 	VWR-7682
 Zai Lynch
 	VWR-19505
+Wolfpup Lowenhar
+	STORM-255
+	STORM-256
 Zarkonnen Decosta
 	VWR-253
 Zi Ree
diff --git a/indra/cmake/FMOD.cmake b/indra/cmake/FMOD.cmake
index 96434e38fadfef1662dcf42f1f083d6174b052fb..dcf44cd64237b3e49e94be3c5932eef2142f6d77 100644
--- a/indra/cmake/FMOD.cmake
+++ b/indra/cmake/FMOD.cmake
@@ -7,8 +7,10 @@ if (FMOD)
     set(FMOD_FIND_REQUIRED ON)
     include(FindFMOD)
   else (STANDALONE)
-    include(Prebuilt)
-    use_prebuilt_binary(fmod)
+    if (INSTALL_PROPRIETARY)
+      include(Prebuilt)
+      use_prebuilt_binary(fmod)
+    endif (INSTALL_PROPRIETARY)
     
     if (WINDOWS)
       set(FMOD_LIBRARY fmod)
diff --git a/indra/llaudio/CMakeLists.txt b/indra/llaudio/CMakeLists.txt
index e869b9717c3ddcef4e98e6a957281fd2c21cf64d..21ec6228197fd118f25cc3e0a448e864f8829693 100644
--- a/indra/llaudio/CMakeLists.txt
+++ b/indra/llaudio/CMakeLists.txt
@@ -14,7 +14,6 @@ include(LLVFS)
 
 include_directories(
     ${LLAUDIO_INCLUDE_DIRS}
-    ${FMOD_INCLUDE_DIR}
     ${LLCOMMON_INCLUDE_DIRS}
     ${LLMATH_INCLUDE_DIRS}
     ${LLMESSAGE_INCLUDE_DIRS}
@@ -45,6 +44,10 @@ set(llaudio_HEADER_FILES
     )
 
 if (FMOD)
+    include_directories(
+        ${FMOD_INCLUDE_DIR}
+        )
+
     list(APPEND llaudio_SOURCE_FILES
          llaudioengine_fmod.cpp
          lllistener_fmod.cpp
diff --git a/indra/llaudio/llvorbisencode.cpp b/indra/llaudio/llvorbisencode.cpp
index 9f479189d7cf4c9d529e376f4285b2948c4ddec3..0e0c80a45675b6aad361fb49fd563645cf3409d8 100644
--- a/indra/llaudio/llvorbisencode.cpp
+++ b/indra/llaudio/llvorbisencode.cpp
@@ -120,6 +120,13 @@ S32 check_for_invalid_wav_formats(const std::string& in_fname, std::string& erro
 			+ ((U32) wav_header[5] << 8) 
 			+ wav_header[4];
 
+		if (chunk_length > physical_file_size - file_pos - 4)
+		{
+			infile.close();
+			error_msg = "SoundFileInvalidChunkSize";
+			return(LLVORBISENC_CHUNK_SIZE_ERR);
+		}
+
 //		llinfos << "chunk found: '" << wav_header[0] << wav_header[1] << wav_header[2] << wav_header[3] << "'" << llendl;
 
 		if (!(strncmp((char *)&(wav_header[0]),"fmt ",4)))
diff --git a/indra/llaudio/llvorbisencode.h b/indra/llaudio/llvorbisencode.h
index d33aacf1ea9a24a2887412d350d63c35c2f6d758..6b22a2cb5997996744613292f5f46bde7d33625d 100644
--- a/indra/llaudio/llvorbisencode.h
+++ b/indra/llaudio/llvorbisencode.h
@@ -38,6 +38,7 @@ const S32 LLVORBISENC_MULTICHANNEL_ERR             = 7; // can't do stereo
 const S32 LLVORBISENC_UNSUPPORTED_SAMPLE_RATE      = 8; // unsupported sample rate
 const S32 LLVORBISENC_UNSUPPORTED_WORD_SIZE        = 9; // unsupported word size
 const S32 LLVORBISENC_CLIP_TOO_LONG                = 10; // source file is too long
+const S32 LLVORBISENC_CHUNK_SIZE_ERR               = 11; // chunk size is wrong
 
 const F32 LLVORBIS_CLIP_MAX_TIME                               = 10.0f;
 const U8  LLVORBIS_CLIP_MAX_CHANNELS                   = 2;
diff --git a/indra/llcommon/llapp.cpp b/indra/llcommon/llapp.cpp
index eebd5ed0a6bbd647300fff96773e8f43b539f776..39daefd1ad63ce8b29827972473dadfab53d3c5c 100644
--- a/indra/llcommon/llapp.cpp
+++ b/indra/llcommon/llapp.cpp
@@ -90,6 +90,10 @@ S32 LL_HEARTBEAT_SIGNAL = (SIGRTMAX >= 0) ? (SIGRTMAX-0) : SIGUSR2;
 // the static application instance
 LLApp* LLApp::sApplication = NULL;
 
+// Allows the generation of core files for post mortem under gdb
+// and disables crashlogger
+BOOL LLApp::sDisableCrashlogger = FALSE; 
+
 // Local flag for whether or not to do logging in signal handlers.
 //static
 BOOL LLApp::sLogInSignal = FALSE;
@@ -461,11 +465,30 @@ bool LLApp::isQuitting()
 	return (APP_STATUS_QUITTING == sStatus);
 }
 
+// static
 bool LLApp::isExiting()
 {
 	return isQuitting() || isError();
 }
 
+void LLApp::disableCrashlogger()
+{
+	// Disable Breakpad exception handler.
+	if (mExceptionHandler != 0)
+	{
+		delete mExceptionHandler;
+		mExceptionHandler = 0;
+	}
+
+	sDisableCrashlogger = TRUE;
+}
+
+// static
+bool LLApp::isCrashloggerDisabled()
+{
+	return (sDisableCrashlogger == TRUE); 
+}
+
 #if !LL_WINDOWS
 // static
 U32 LLApp::getSigChildCount()
@@ -799,6 +822,15 @@ void default_unix_signal_handler(int signum, siginfo_t *info, void *)
 			{
 				llwarns << "Signal handler - Flagging error status and waiting for shutdown" << llendl;
 			}
+									
+			if (LLApp::isCrashloggerDisabled())	// Don't gracefully handle any signal, crash and core for a gdb post mortem
+			{
+				clear_signals();
+				llwarns << "Fatal signal received, not handling the crash here, passing back to operating system" << llendl;
+				raise(signum);
+				return;
+			}		
+			
 			// Flag status to ERROR, so thread_error does its work.
 			LLApp::setError();
 			// Block in the signal handler until somebody says that we're done.
diff --git a/indra/llcommon/llapp.h b/indra/llcommon/llapp.h
index ee1d69682953727296b1071fba2ce7cacd54b2d1..a536a06ea5ef1fc50b44e82d30634972be18dc8c 100644
--- a/indra/llcommon/llapp.h
+++ b/indra/llcommon/llapp.h
@@ -189,6 +189,11 @@ class LL_COMMON_API LLApp : public LLOptionInterface
 	//
 	virtual bool mainLoop() = 0; // Override for the application main loop.  Needs to at least gracefully notice the QUITTING state and exit.
 
+	//
+	// Crash logging
+	//
+	void disableCrashlogger();				// Let the OS handle the crashes
+	static bool isCrashloggerDisabled();	// Get the here above set value
 
 	//
 	// Application status
@@ -280,6 +285,7 @@ class LL_COMMON_API LLApp : public LLOptionInterface
 	static void setStatus(EAppStatus status);		// Use this to change the application status.
 	static EAppStatus sStatus; // Reflects current application status
 	static BOOL sErrorThreadRunning; // Set while the error thread is running
+	static BOOL sDisableCrashlogger; // Let the OS handle crashes for us.
 
 #if !LL_WINDOWS
 	static LLAtomicU32* sSigChildCount; // Number of SIGCHLDs received.
diff --git a/indra/llcommon/lldarray.h b/indra/llcommon/lldarray.h
index a8cd03b42a92f7b0d53bded21676c8149a8d73d4..131b819c99148f29c136c77012450ffe6a02de10 100644
--- a/indra/llcommon/lldarray.h
+++ b/indra/llcommon/lldarray.h
@@ -51,7 +51,7 @@ class LLDynamicArray : public std::vector<Type>
 	
 	LLDynamicArray(S32 size=0) : std::vector<Type>(size) { if (size < BlockSize) std::vector<Type>::reserve(BlockSize); }
 
-	void reset() { std::vector<Type>::resize(0); }
+	void reset() { std::vector<Type>::clear(); }
 
 	// ACCESSORS
 	const Type& get(S32 index) const	 			{ return std::vector<Type>::operator[](index); }
diff --git a/indra/llcommon/llsys.cpp b/indra/llcommon/llsys.cpp
index 00c94404d490f29503506f51240527d44ab59785..10cdc7087b3395a121c4b49a41988e63cc67ade8 100644
--- a/indra/llcommon/llsys.cpp
+++ b/indra/llcommon/llsys.cpp
@@ -635,6 +635,26 @@ U32 LLMemoryInfo::getPhysicalMemoryClamped() const
 	}
 }
 
+//static
+void LLMemoryInfo::getAvailableMemoryKB(U32& avail_physical_mem_kb, U32& avail_virtual_mem_kb)
+{
+#if LL_WINDOWS
+	MEMORYSTATUSEX state;
+	state.dwLength = sizeof(state);
+	GlobalMemoryStatusEx(&state);
+
+	avail_physical_mem_kb = (U32)(state.ullAvailPhys/1024) ;
+	avail_virtual_mem_kb = (U32)(state.ullAvailVirtual/1024) ;
+
+#else
+	//do not know how to collect available memory info for other systems.
+	//leave it blank here for now.
+
+	avail_physical_mem_kb = -1 ;
+	avail_virtual_mem_kb = -1 ;
+#endif
+}
+
 void LLMemoryInfo::stream(std::ostream& s) const
 {
 #if LL_WINDOWS
diff --git a/indra/llcommon/llsys.h b/indra/llcommon/llsys.h
index 39af74e5c8a9cb1d8f46cbbb35d658c52d07628d..41a4f2500064eed2cda8e289b1d986f8d202b7c5 100644
--- a/indra/llcommon/llsys.h
+++ b/indra/llcommon/llsys.h
@@ -114,6 +114,9 @@ class LL_COMMON_API LLMemoryInfo
 	**  be returned.
 	*/
 	U32 getPhysicalMemoryClamped() const; ///< Memory size in clamped bytes
+
+	//get the available memory infomation in KiloBytes.
+	static void getAvailableMemoryKB(U32& avail_physical_mem_kb, U32& avail_virtual_mem_kb);
 };
 
 
diff --git a/indra/llcommon/llversionviewer.h b/indra/llcommon/llversionviewer.h
index 12bddbfeedcac693bdf442f4731b85600b7dd88a..b209e4aa38bcecaad79cf122ad66aee09545ab87 100644
--- a/indra/llcommon/llversionviewer.h
+++ b/indra/llcommon/llversionviewer.h
@@ -28,10 +28,14 @@
 #define LL_LLVERSIONVIEWER_H
 
 const S32 LL_VERSION_MAJOR = 2;
-const S32 LL_VERSION_MINOR = 3;
+const S32 LL_VERSION_MINOR = 4;
 const S32 LL_VERSION_PATCH = 0;
 const S32 LL_VERSION_BUILD = 0;
 
 const char * const LL_CHANNEL = "Second Life Developer";
 
+#if LL_DARWIN
+const char * const LL_VERSION_BUNDLE_ID = "com.secondlife.snowglobe.viewer";
+#endif
+
 #endif
diff --git a/indra/llimage/llimagedimensionsinfo.cpp b/indra/llimage/llimagedimensionsinfo.cpp
index 5ea4a236b5ff3f15ccc30a01163c2edc75d1529a..835664c60ff403f36caf7d8c164e396ec7e7975a 100644
--- a/indra/llimage/llimagedimensionsinfo.cpp
+++ b/indra/llimage/llimagedimensionsinfo.cpp
@@ -30,6 +30,9 @@
 
 #include "llimagedimensionsinfo.h"
 
+// Value is true if one of Libjpeg's functions has encountered an error while working.
+static bool sJpegErrorEncountered = false;
+
 bool LLImageDimensionsInfo::load(const std::string& src_filename,U32 codec)
 {
 	clean();
@@ -101,9 +104,17 @@ bool LLImageDimensionsInfo::getImageDimensionsPng()
 	return true;
 }
 
+// Called instead of exit() if Libjpeg encounters an error.
+void on_jpeg_error(j_common_ptr cinfo)
+{
+	(void) cinfo;
+	sJpegErrorEncountered = true;
+	llwarns << "Libjpeg has encountered an error!" << llendl;
+}
 
 bool LLImageDimensionsInfo::getImageDimensionsJpeg()
 {
+	sJpegErrorEncountered = false;
 	clean();
 	FILE *fp = fopen (mSrcFilename.c_str(), "rb");
 	if (fp == NULL) 
@@ -115,6 +126,9 @@ bool LLImageDimensionsInfo::getImageDimensionsJpeg()
 	jpeg_error_mgr jerr;
 	jpeg_decompress_struct cinfo;
 	cinfo.err = jpeg_std_error(&jerr);
+	// Call our function instead of exit() if Libjpeg encounters an error.
+	// This is done to avoid crash in this case (STORM-472).
+	cinfo.err->error_exit = on_jpeg_error;
 
 	jpeg_create_decompress	(&cinfo);
 	jpeg_stdio_src		(&cinfo, fp);
@@ -128,6 +142,6 @@ bool LLImageDimensionsInfo::getImageDimensionsJpeg()
 	jpeg_destroy_decompress(&cinfo);
 	fclose(fp);
 
-	return true;
+	return !sJpegErrorEncountered;
 }
 
diff --git a/indra/llrender/llgl.cpp b/indra/llrender/llgl.cpp
index c0edd92bc117421a3501d71cd992f2f901c6cce8..6ea63809f85e65b8318ce18f03652acf0a2eb7fd 100644
--- a/indra/llrender/llgl.cpp
+++ b/indra/llrender/llgl.cpp
@@ -610,41 +610,46 @@ void LLGLManager::shutdownGL()
 void LLGLManager::initExtensions()
 {
 #if LL_MESA_HEADLESS
-# if GL_ARB_multitexture
+# ifdef GL_ARB_multitexture
 	mHasMultitexture = TRUE;
 # else
 	mHasMultitexture = FALSE;
 # endif
-# if GL_ARB_texture_env_combine
+# ifdef GL_ARB_texture_env_combine
 	mHasARBEnvCombine = TRUE;	
 # else
 	mHasARBEnvCombine = FALSE;
 # endif
-# if GL_ARB_texture_compression
+# ifdef GL_ARB_texture_compression
 	mHasCompressedTextures = TRUE;
 # else
 	mHasCompressedTextures = FALSE;
 # endif
-# if GL_ARB_vertex_buffer_object
+# ifdef GL_ARB_vertex_buffer_object
 	mHasVertexBufferObject = TRUE;
 # else
 	mHasVertexBufferObject = FALSE;
 # endif
-# if GL_EXT_framebuffer_object
+# ifdef GL_EXT_framebuffer_object
 	mHasFramebufferObject = TRUE;
 # else
 	mHasFramebufferObject = FALSE;
 # endif
-# if GL_EXT_framebuffer_multisample
+# ifdef GL_EXT_framebuffer_multisample
 	mHasFramebufferMultisample = TRUE;
 # else
 	mHasFramebufferMultisample = FALSE;
 # endif
-# if GL_ARB_draw_buffers
+# ifdef GL_ARB_draw_buffers
 	mHasDrawBuffers = TRUE;
 #else
 	mHasDrawBuffers = FALSE;
 # endif
+# if defined(GL_NV_depth_clamp) || defined(GL_ARB_depth_clamp)
+	mHasDepthClamp = TRUE;
+#else
+	mHasDepthClamp = FALSE;
+#endif
 # if GL_EXT_blend_func_separate
 	mHasBlendFuncSeparate = TRUE;
 #else
@@ -671,6 +676,7 @@ void LLGLManager::initExtensions()
 	mHasCompressedTextures = glh_init_extensions("GL_ARB_texture_compression");
 	mHasOcclusionQuery = ExtensionExists("GL_ARB_occlusion_query", gGLHExts.mSysExts);
 	mHasVertexBufferObject = ExtensionExists("GL_ARB_vertex_buffer_object", gGLHExts.mSysExts);
+	mHasDepthClamp = ExtensionExists("GL_ARB_depth_clamp", gGLHExts.mSysExts) || ExtensionExists("GL_NV_depth_clamp", gGLHExts.mSysExts);
 	// mask out FBO support when packed_depth_stencil isn't there 'cause we need it for LLRenderTarget -Brad
 	mHasFramebufferObject = ExtensionExists("GL_EXT_framebuffer_object", gGLHExts.mSysExts)
 		&& ExtensionExists("GL_EXT_packed_depth_stencil", gGLHExts.mSysExts);
@@ -694,6 +700,7 @@ void LLGLManager::initExtensions()
 	if (getenv("LL_GL_NOEXT"))
 	{
 		//mHasMultitexture = FALSE; // NEEDED!
+		mHasDepthClamp = FALSE;
 		mHasARBEnvCombine = FALSE;
 		mHasCompressedTextures = FALSE;
 		mHasVertexBufferObject = FALSE;
@@ -755,6 +762,7 @@ void LLGLManager::initExtensions()
 		if (strchr(blacklist,'s')) mHasFramebufferMultisample = FALSE;
 		if (strchr(blacklist,'t')) mHasTextureRectangle = FALSE;
 		if (strchr(blacklist,'u')) mHasBlendFuncSeparate = FALSE;//S
+		if (strchr(blacklist,'v')) mHasDepthClamp = FALSE;
 		
 	}
 #endif // LL_LINUX || LL_SOLARIS
@@ -1047,6 +1055,33 @@ void flush_glerror()
 	glGetError();
 }
 
+//this function outputs gl error to the log file, does not crash the code.
+void log_glerror()
+{
+	if (LL_UNLIKELY(!gGLManager.mInited))
+	{
+		return ;
+	}
+	//  Create or update texture to be used with this data 
+	GLenum error;
+	error = glGetError();
+	while (LL_UNLIKELY(error))
+	{
+		GLubyte const * gl_error_msg = gluErrorString(error);
+		if (NULL != gl_error_msg)
+		{
+			llwarns << "GL Error: " << error << " GL Error String: " << gl_error_msg << llendl ;			
+		}
+		else
+		{
+			// gluErrorString returns NULL for some extensions' error codes.
+			// you'll probably have to grep for the number in glext.h.
+			llwarns << "GL Error: UNKNOWN 0x" << std::hex << error << std::dec << llendl;
+		}
+		error = glGetError();
+	}
+}
+
 void do_assert_glerror()
 {
 	if (LL_UNLIKELY(!gGLManager.mInited))
@@ -2037,7 +2072,7 @@ void LLGLDepthTest::checkState()
 	}
 }
 
-LLGLClampToFarClip::LLGLClampToFarClip(glh::matrix4f P)
+LLGLSquashToFarClip::LLGLSquashToFarClip(glh::matrix4f P)
 {
 	for (U32 i = 0; i < 4; i++)
 	{
@@ -2050,7 +2085,7 @@ LLGLClampToFarClip::LLGLClampToFarClip(glh::matrix4f P)
 	glMatrixMode(GL_MODELVIEW);
 }
 
-LLGLClampToFarClip::~LLGLClampToFarClip()
+LLGLSquashToFarClip::~LLGLSquashToFarClip()
 {
 	glMatrixMode(GL_PROJECTION);
 	glPopMatrix();
diff --git a/indra/llrender/llgl.h b/indra/llrender/llgl.h
index 5e8965c06add464aa3d5bdedd1d39642ccf9b704..85fab7a0f82cfc1a3b0b80aa31f751c3b3caa886 100644
--- a/indra/llrender/llgl.h
+++ b/indra/llrender/llgl.h
@@ -92,6 +92,7 @@ class LLGLManager
 	BOOL mHasOcclusionQuery;
 	BOOL mHasPointParameters;
 	BOOL mHasDrawBuffers;
+	BOOL mHasDepthClamp;
 	BOOL mHasTextureRectangle;
 
 	// Other extensions.
@@ -157,6 +158,7 @@ void rotate_quat(LLQuaternion& rotation);
 
 void flush_glerror(); // Flush GL errors when we know we're handling them correctly.
 
+void log_glerror();
 void assert_glerror();
 
 void clear_glerror();
@@ -315,11 +317,11 @@ class LLGLUserClipPlane
   leaves this class.
   Does not stack.
 */
-class LLGLClampToFarClip
+class LLGLSquashToFarClip
 {
 public:
-	LLGLClampToFarClip(glh::matrix4f projection);
-	~LLGLClampToFarClip();
+	LLGLSquashToFarClip(glh::matrix4f projection);
+	~LLGLSquashToFarClip();
 };
 
 /*
diff --git a/indra/llrender/llglheaders.h b/indra/llrender/llglheaders.h
index 5a34b46d0cd3fc2d49c6494c1fc948f69f8a8f5d..576969b81ae0f6eeab173375280d7fc91e103470 100644
--- a/indra/llrender/llglheaders.h
+++ b/indra/llrender/llglheaders.h
@@ -829,5 +829,15 @@ extern void glGetBufferPointervARB (GLenum, GLenum, GLvoid* *);
 
 #endif // LL_MESA / LL_WINDOWS / LL_DARWIN
 
+// Even when GL_ARB_depth_clamp is available in the driver, the (correct)
+// headers, and therefore GL_DEPTH_CLAMP might not be defined.
+// In that case GL_DEPTH_CLAMP_NV should be defined, but why not just
+// use the known numeric.
+//
+// To avoid #ifdef's in the code. Just define this here.
+#ifndef GL_DEPTH_CLAMP
+// Probably (still) called GL_DEPTH_CLAMP_NV.
+#define GL_DEPTH_CLAMP 0x864F
+#endif
 
 #endif // LL_LLGLHEADERS_H
diff --git a/indra/llrender/llimagegl.cpp b/indra/llrender/llimagegl.cpp
index 72dd283bc7c6941952712576723079b00167ae19..65940cb0671927e00db801963b8be315c4c73424 100644
--- a/indra/llrender/llimagegl.cpp
+++ b/indra/llrender/llimagegl.cpp
@@ -1069,6 +1069,8 @@ BOOL LLImageGL::setSubImageFromFrameBuffer(S32 fb_x, S32 fb_y, S32 x_pos, S32 y_
 			checkTexSize(true) ;
 			llcallstacks << fb_x << " : " << fb_y << " : " << x_pos << " : " << y_pos << " : " << width << " : " << height <<
 				" : " << (S32)mComponents << llcallstacksendl ;
+
+			log_glerror() ;
 		}
 
 		glCopyTexSubImage2D(GL_TEXTURE_2D, 0, fb_x, fb_y, x_pos, y_pos, width, height);
diff --git a/indra/llrender/llrender.cpp b/indra/llrender/llrender.cpp
index e26acd53a33fb2281abe993637c1214c064e25fd..8eb160f4e78ea4402cbb2120d9d4efa421fe2c0b 100644
--- a/indra/llrender/llrender.cpp
+++ b/indra/llrender/llrender.cpp
@@ -431,6 +431,9 @@ void LLTexUnit::setTextureFilteringOption(LLTexUnit::eTextureFilterOptions optio
 			if (gGL.mMaxAnisotropy < 1.f)
 			{
 				glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &gGL.mMaxAnisotropy);
+
+				llinfos << "gGL.mMaxAnisotropy: " << gGL.mMaxAnisotropy << llendl ;
+				gGL.mMaxAnisotropy = llmax(1.f, gGL.mMaxAnisotropy) ;
 			}
 			glTexParameterf(sGLTextureType[mCurrTexType], GL_TEXTURE_MAX_ANISOTROPY_EXT, gGL.mMaxAnisotropy);
 		}
diff --git a/indra/llrender/llvertexbuffer.cpp b/indra/llrender/llvertexbuffer.cpp
index de4501dd0f76ea01aaac4bf56e3f2c1b2c9f867f..02160b09c4fcc21ca644fb2da60d182c791d9d7f 100644
--- a/indra/llrender/llvertexbuffer.cpp
+++ b/indra/llrender/llvertexbuffer.cpp
@@ -27,7 +27,7 @@
 #include "linden_common.h"
 
 #include <boost/static_assert.hpp>
-
+#include "llsys.h"
 #include "llvertexbuffer.h"
 // #include "llrender.h"
 #include "llglheaders.h"
@@ -854,6 +854,14 @@ U8* LLVertexBuffer::mapBuffer(S32 access)
 
 		if (!mMappedData)
 		{
+			log_glerror();
+
+			//check the availability of memory
+			U32 avail_phy_mem, avail_vir_mem;
+			LLMemoryInfo::getAvailableMemoryKB(avail_phy_mem, avail_vir_mem) ;
+			llinfos << "Available physical mwmory(KB): " << avail_phy_mem << llendl ; 
+			llinfos << "Available virtual memory(KB): " << avail_vir_mem << llendl;
+
 			//--------------------
 			//print out more debug info before crash
 			llinfos << "vertex buffer size: (num verts : num indices) = " << getNumVerts() << " : " << getNumIndices() << llendl ;
@@ -875,6 +883,8 @@ U8* LLVertexBuffer::mapBuffer(S32 access)
 
 		if (!mMappedIndexData)
 		{
+			log_glerror();
+
 			GLint buff;
 			glGetIntegerv(GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB, &buff);
 			if ((GLuint)buff != mGLIndices)
diff --git a/indra/llui/llaccordionctrltab.cpp b/indra/llui/llaccordionctrltab.cpp
index 179b32098a0b235c473149dc16106a8e9d1d928c..9d49c1a83144330929a0bbd7b6af5e65200620d4 100644
--- a/indra/llui/llaccordionctrltab.cpp
+++ b/indra/llui/llaccordionctrltab.cpp
@@ -456,8 +456,7 @@ BOOL LLAccordionCtrlTab::handleMouseDown(S32 x, S32 y, MASK mask)
 	{
 		if(y >= (getRect().getHeight() - HEADER_HEIGHT) )
 		{
-			LLAccordionCtrlTabHeader* header = getChild<LLAccordionCtrlTabHeader>(DD_HEADER_NAME);
-			header->setFocus(true);
+			mHeader->setFocus(true);
 			changeOpenClose(getDisplayChildren());
 
 			//reset stored state
@@ -509,10 +508,9 @@ void LLAccordionCtrlTab::setAccordionView(LLView* panel)
 
 std::string LLAccordionCtrlTab::getTitle() const
 {
-	LLAccordionCtrlTabHeader* header = findChild<LLAccordionCtrlTabHeader>(DD_HEADER_NAME);
-	if (header)
+	if (mHeader)
 	{
-		return header->getTitle();
+		return mHeader->getTitle();
 	}
 	else
 	{
@@ -522,57 +520,51 @@ std::string LLAccordionCtrlTab::getTitle() const
 
 void LLAccordionCtrlTab::setTitle(const std::string& title, const std::string& hl)
 {
-	LLAccordionCtrlTabHeader* header = findChild<LLAccordionCtrlTabHeader>(DD_HEADER_NAME);
-	if (header)
+	if (mHeader)
 	{
-		header->setTitle(title, hl);
+		mHeader->setTitle(title, hl);
 	}
 }
 
 void LLAccordionCtrlTab::setTitleFontStyle(std::string style)
 {
-	LLAccordionCtrlTabHeader* header = findChild<LLAccordionCtrlTabHeader>(DD_HEADER_NAME);
-	if (header)
+	if (mHeader)
 	{
-		header->setTitleFontStyle(style);
+		mHeader->setTitleFontStyle(style);
 	}
 }
 
 void LLAccordionCtrlTab::setTitleColor(LLUIColor color)
 {
-	LLAccordionCtrlTabHeader* header = findChild<LLAccordionCtrlTabHeader>(DD_HEADER_NAME);
-	if (header)
+	if (mHeader)
 	{
-		header->setTitleColor(color);
+		mHeader->setTitleColor(color);
 	}
 }
 
 boost::signals2::connection LLAccordionCtrlTab::setFocusReceivedCallback(const focus_signal_t::slot_type& cb)
 {
-	LLAccordionCtrlTabHeader* header = findChild<LLAccordionCtrlTabHeader>(DD_HEADER_NAME);
-	if (header)
+	if (mHeader)
 	{
-		return header->setFocusReceivedCallback(cb);
+		return mHeader->setFocusReceivedCallback(cb);
 	}
 	return boost::signals2::connection();
 }
 
 boost::signals2::connection LLAccordionCtrlTab::setFocusLostCallback(const focus_signal_t::slot_type& cb)
 {
-	LLAccordionCtrlTabHeader* header = findChild<LLAccordionCtrlTabHeader>(DD_HEADER_NAME);
-	if (header)
+	if (mHeader)
 	{
-		return header->setFocusLostCallback(cb);
+		return mHeader->setFocusLostCallback(cb);
 	}
 	return boost::signals2::connection();
 }
 
 void LLAccordionCtrlTab::setSelected(bool is_selected)
 {
-	LLAccordionCtrlTabHeader* header = findChild<LLAccordionCtrlTabHeader>(DD_HEADER_NAME);
-	if (header)
+	if (mHeader)
 	{
-		header->setSelected(is_selected);
+		mHeader->setSelected(is_selected);
 	}
 }
 
@@ -776,8 +768,7 @@ S32 LLAccordionCtrlTab::notify(const LLSD& info)
 
 BOOL LLAccordionCtrlTab::handleKey(KEY key, MASK mask, BOOL called_from_parent)
 {
-	LLAccordionCtrlTabHeader* header = getChild<LLAccordionCtrlTabHeader>(DD_HEADER_NAME);	
-	if( !header->hasFocus() )
+	if( !mHeader->hasFocus() )
 		return LLUICtrl::handleKey(key, mask, called_from_parent);
 
 	if ( (key == KEY_RETURN )&& mask == MASK_NONE)
@@ -830,15 +821,19 @@ BOOL LLAccordionCtrlTab::handleKey(KEY key, MASK mask, BOOL called_from_parent)
 
 void LLAccordionCtrlTab::showAndFocusHeader()
 {
-	LLAccordionCtrlTabHeader* header = getChild<LLAccordionCtrlTabHeader>(DD_HEADER_NAME);	
-	header->setFocus(true);
-	header->setSelected(mSelectionEnabled);
+	mHeader->setFocus(true);
+	mHeader->setSelected(mSelectionEnabled);
 
 	LLRect screen_rc;
-	LLRect selected_rc = header->getRect();
+	LLRect selected_rc = mHeader->getRect();
 	localRectToScreen(selected_rc, &screen_rc);
-	notifyParent(LLSD().with("scrollToShowRect",screen_rc.getValue()));
 
+	// This call to notifyParent() is intended to deliver "scrollToShowRect" command
+	// to the parent LLAccordionCtrl so by calling it from the direct parent of this
+	// accordion tab (assuming that the parent is an LLAccordionCtrl) the calls chain
+	// is shortened and messages from inside the collapsed tabs are avoided.
+	// See STORM-536.
+	getParent()->notifyParent(LLSD().with("scrollToShowRect",screen_rc.getValue()));
 }
 void    LLAccordionCtrlTab::storeOpenCloseState()
 {
diff --git a/indra/llui/llmenubutton.cpp b/indra/llui/llmenubutton.cpp
index 3df05f4d3f7f77701e924efd104effc2db16455c..ac568a83e4a32e4d0e6525ad427460ed8e95d0c6 100644
--- a/indra/llui/llmenubutton.cpp
+++ b/indra/llui/llmenubutton.cpp
@@ -29,7 +29,7 @@
 #include "llmenubutton.h"
 
 // Linden library includes
-#include "llmenugl.h"
+#include "lltoggleablemenu.h"
 #include "llstring.h"
 #include "v4color.h"
 
@@ -44,58 +44,77 @@ LLMenuButton::Params::Params()
 
 LLMenuButton::LLMenuButton(const LLMenuButton::Params& p)
 :	LLButton(p),
-	mMenu(NULL),
-	mMenuVisibleLastFrame(false)
+	mIsMenuShown(false),
+	mMenuPosition(MP_BOTTOM_LEFT)
 {
 	std::string menu_filename = p.menu_filename;
 
 	if (!menu_filename.empty())
 	{
-		mMenu = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>(menu_filename, LLMenuGL::sMenuContainer, LLMenuHolderGL::child_registry_t::instance());
-		if (!mMenu)
+		LLToggleableMenu* menu = LLUICtrlFactory::getInstance()->createFromFile<LLToggleableMenu>(menu_filename, LLMenuGL::sMenuContainer, LLMenuHolderGL::child_registry_t::instance());
+		if (!menu)
 		{
 			llwarns << "Error loading menu_button menu" << llendl;
+			return;
 		}
+
+		menu->setVisibilityChangeCallback(boost::bind(&LLMenuButton::onMenuVisibilityChange, this, _2));
+
+		mMenuHandle = menu->getHandle();
+
+		updateMenuOrigin();
 	}
 }
 
-void LLMenuButton::toggleMenu()
+boost::signals2::connection LLMenuButton::setMouseDownCallback( const mouse_signal_t::slot_type& cb )
 {
-    if(!mMenu)
-		return;
+	return LLUICtrl::setMouseDownCallback(cb);
+}
 
-	if (mMenu->getVisible() || mMenuVisibleLastFrame)
-	{
-		mMenu->setVisible(FALSE);
-	}
-	else
+void LLMenuButton::hideMenu()
+{
+	if(mMenuHandle.isDead()) return;
+
+	LLToggleableMenu* menu = dynamic_cast<LLToggleableMenu*>(mMenuHandle.get());
+	if (menu)
 	{
-	    LLRect rect = getRect();
-		//mMenu->needsArrange(); //so it recalculates the visible elements
-		LLMenuGL::showPopup(getParent(), mMenu, rect.mLeft, rect.mBottom);
+		menu->setVisible(FALSE);
 	}
 }
 
-
-void LLMenuButton::hideMenu() 
-{ 
-	if(!mMenu)
-		return;
-	mMenu->setVisible(FALSE); 
+LLToggleableMenu* LLMenuButton::getMenu()
+{
+	return dynamic_cast<LLToggleableMenu*>(mMenuHandle.get());
 }
 
+void LLMenuButton::setMenu(LLToggleableMenu* menu, EMenuPosition position /*MP_TOP_LEFT*/)
+{
+	if (!menu) return;
+
+	mMenuHandle = menu->getHandle();
+	mMenuPosition = position;
+
+	menu->setVisibilityChangeCallback(boost::bind(&LLMenuButton::onMenuVisibilityChange, this, _2));
+}
 
 BOOL LLMenuButton::handleKeyHere(KEY key, MASK mask )
 {
+	if (mMenuHandle.isDead()) return FALSE;
+
 	if( KEY_RETURN == key && mask == MASK_NONE && !gKeyboard->getKeyRepeated(key))
 	{
+		// *HACK: We emit the mouse down signal to fire the callback bound to the
+		// menu emerging event before actually displaying the menu. See STORM-263.
+		LLUICtrl::handleMouseDown(-1, -1, MASK_NONE);
+
 		toggleMenu();
 		return TRUE;
 	}
 
-	if (mMenu && mMenu->getVisible() && key == KEY_ESCAPE && mask == MASK_NONE)
+	LLToggleableMenu* menu = dynamic_cast<LLToggleableMenu*>(mMenuHandle.get());
+	if (menu && menu->getVisible() && key == KEY_ESCAPE && mask == MASK_NONE)
 	{
-		mMenu->setVisible(FALSE);
+		menu->setVisible(FALSE);
 		return TRUE;
 	}
 	
@@ -104,34 +123,77 @@ BOOL LLMenuButton::handleKeyHere(KEY key, MASK mask )
 
 BOOL LLMenuButton::handleMouseDown(S32 x, S32 y, MASK mask)
 {
-	if (hasTabStop() && !getIsChrome())
-	{
-		setFocus(TRUE);
-	}
+	LLButton::handleMouseDown(x, y, mask);
 
 	toggleMenu();
 	
-	if (getSoundFlags() & MOUSE_DOWN)
-	{
-		make_ui_sound("UISndClick");
-	}
-
 	return TRUE;
 }
 
-void LLMenuButton::draw()
+void LLMenuButton::toggleMenu()
 {
-	//we save this off so next frame when we try to close it by 
-	//button click, and it hides menus before we get to it, we know
-	mMenuVisibleLastFrame = mMenu && mMenu->getVisible();
-	
-	if (mMenuVisibleLastFrame)
+	if(mMenuHandle.isDead()) return;
+
+	LLToggleableMenu* menu = dynamic_cast<LLToggleableMenu*>(mMenuHandle.get());
+	if (!menu) return;
+
+	// Store the button rectangle to toggle menu visibility if a mouse event
+	// occurred inside or outside the button rect.
+	menu->setButtonRect(this);
+
+	if (!menu->toggleVisibility() && mIsMenuShown)
+	{
+		setForcePressedState(false);
+		mIsMenuShown = false;
+	}
+	else
 	{
+		menu->buildDrawLabels();
+		menu->arrangeAndClear();
+		menu->updateParent(LLMenuGL::sMenuContainer);
+
+		updateMenuOrigin();
+
+		LLMenuGL::showPopup(getParent(), menu, mX, mY);
+
 		setForcePressedState(true);
+		mIsMenuShown = true;
 	}
+}
+
+void LLMenuButton::updateMenuOrigin()
+{
+	if (mMenuHandle.isDead()) return;
 
-	LLButton::draw();
+	LLRect rect = getRect();
 
-	setForcePressedState(false);
+	switch (mMenuPosition)
+	{
+		case MP_TOP_LEFT:
+		{
+			mX = rect.mLeft;
+			mY = rect.mTop + mMenuHandle.get()->getRect().getHeight();
+			break;
+		}
+		case MP_BOTTOM_LEFT:
+		{
+			mX = rect.mLeft;
+			mY = rect.mBottom;
+			break;
+		}
+	}
 }
 
+void LLMenuButton::onMenuVisibilityChange(const LLSD& param)
+{
+	bool new_visibility = param["visibility"].asBoolean();
+	bool is_closed_by_button_click = param["closed_by_button_click"].asBoolean();
+
+	// Reset the button "pressed" state only if the menu is shown by this particular
+	// menu button (not any other control) and is not being closed by a click on the button.
+	if (!new_visibility && !is_closed_by_button_click && mIsMenuShown)
+	{
+		setForcePressedState(false);
+		mIsMenuShown = false;
+	}
+}
diff --git a/indra/llui/llmenubutton.h b/indra/llui/llmenubutton.h
index 81ca0e047ca6e242d0659ea3b0149c834c8f7aa6..9e91b9e99d3af9702e026e8bbfc086a88662b424 100644
--- a/indra/llui/llmenubutton.h
+++ b/indra/llui/llmenubutton.h
@@ -29,7 +29,7 @@
 
 #include "llbutton.h"
 
-class LLMenuGL;
+class LLToggleableMenu;
 
 class LLMenuButton
 : public LLButton
@@ -42,22 +42,41 @@ class LLMenuButton
 		Optional<std::string>	menu_filename;
 	
 		Params();
-	};	
+	};
+
+	typedef enum e_menu_position
+	{
+		MP_TOP_LEFT,
+		MP_BOTTOM_LEFT
+	} EMenuPosition;
 	
-	void toggleMenu();
-	/*virtual*/ void draw();
+	boost::signals2::connection setMouseDownCallback( const mouse_signal_t::slot_type& cb );
+
 	/*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask);
 	/*virtual*/ BOOL handleKeyHere(KEY key, MASK mask );
+
 	void hideMenu();
-	LLMenuGL* getMenu() { return mMenu; }
+
+	LLToggleableMenu* getMenu();
+	void setMenu(LLToggleableMenu* menu, EMenuPosition position = MP_TOP_LEFT);
+
+	void setMenuPosition(EMenuPosition position) { mMenuPosition = position; }
 
 protected:
 	friend class LLUICtrlFactory;
 	LLMenuButton(const Params&);
 
+	void toggleMenu();
+	void updateMenuOrigin();
+
+	void onMenuVisibilityChange(const LLSD& param);
+
 private:
-	LLMenuGL*	mMenu;
-	bool mMenuVisibleLastFrame;
+	LLHandle<LLView>		mMenuHandle;
+	bool					mIsMenuShown;
+	EMenuPosition			mMenuPosition;
+	S32						mX;
+	S32						mY;
 };
 
 
diff --git a/indra/llui/llmenugl.cpp b/indra/llui/llmenugl.cpp
index 6d590cf54e4739f9ee8f2f813ea7718b40af03a6..a6cf86d9b8de56e2e366f7a62106fd3f58975e8a 100644
--- a/indra/llui/llmenugl.cpp
+++ b/indra/llui/llmenugl.cpp
@@ -1848,89 +1848,104 @@ BOOL LLMenuGL::isOpen()
 	}
 }
 
-void LLMenuGL::scrollItemsUp()
+
+
+bool LLMenuGL::scrollItems(EScrollingDirection direction)
 {
-	// Slowing down the items scrolling when arrow button is held 
+	// Slowing down items scrolling when arrow button is held
 	if (mScrollItemsTimer.hasExpired() && NULL != mFirstVisibleItem)
 	{
 		mScrollItemsTimer.setTimerExpirySec(.033f);
 	}
 	else
 	{
-		return;
+		return false;
 	}
 
-	item_list_t::iterator cur_item_iter;
-	item_list_t::iterator prev_item_iter;
-	for (cur_item_iter = mItems.begin(), prev_item_iter = mItems.begin(); cur_item_iter != mItems.end(); cur_item_iter++)
+	switch (direction)
 	{
-		if( (*cur_item_iter) == mFirstVisibleItem)
+	case SD_UP:
+	{
+		item_list_t::iterator cur_item_iter;
+		item_list_t::iterator prev_item_iter;
+		for (cur_item_iter = mItems.begin(), prev_item_iter = mItems.begin(); cur_item_iter != mItems.end(); cur_item_iter++)
 		{
-			break;
+			if( (*cur_item_iter) == mFirstVisibleItem)
+			{
+				break;
+			}
+			if ((*cur_item_iter)->getVisible())
+			{
+				prev_item_iter = cur_item_iter;
+			}
 		}
-		if ((*cur_item_iter)->getVisible())
+
+		if ((*prev_item_iter)->getVisible())
 		{
-			prev_item_iter = cur_item_iter;
+			mFirstVisibleItem = *prev_item_iter;
 		}
+		break;
 	}
-
-	if ((*prev_item_iter)->getVisible())
-	{
-		mFirstVisibleItem = *prev_item_iter;
-	}
-	
-	mNeedsArrange = TRUE;
-	arrangeAndClear();
-}
-
-void LLMenuGL::scrollItemsDown()
-{
-	// Slowing down the items scrolling when arrow button is held 
-	if (mScrollItemsTimer.hasExpired())
-	{
-		mScrollItemsTimer.setTimerExpirySec(.033f);
-	}
-	else
-	{
-		return;
-	}
-	
-	if (NULL == mFirstVisibleItem)
-	{
-		mFirstVisibleItem = *mItems.begin();
-	}
-
-	item_list_t::iterator cur_item_iter;
-	
-	for (cur_item_iter = mItems.begin(); cur_item_iter != mItems.end(); cur_item_iter++)
+	case SD_DOWN:
 	{
-		if( (*cur_item_iter) == mFirstVisibleItem)
+		if (NULL == mFirstVisibleItem)
 		{
-			break;
+			mFirstVisibleItem = *mItems.begin();
 		}
-	}
 
-	item_list_t::iterator next_item_iter;
+		item_list_t::iterator cur_item_iter;
 
-	if (cur_item_iter != mItems.end())
-	{
-		for (next_item_iter = ++cur_item_iter; next_item_iter != mItems.end(); next_item_iter++)
+		for (cur_item_iter = mItems.begin(); cur_item_iter != mItems.end(); cur_item_iter++)
 		{
-			if( (*next_item_iter)->getVisible())
+			if( (*cur_item_iter) == mFirstVisibleItem)
 			{
 				break;
 			}
 		}
-		
-		if (next_item_iter != mItems.end() &&
-		    (*next_item_iter)->getVisible())
+
+		item_list_t::iterator next_item_iter;
+
+		if (cur_item_iter != mItems.end())
 		{
-			mFirstVisibleItem = *next_item_iter;
+			for (next_item_iter = ++cur_item_iter; next_item_iter != mItems.end(); next_item_iter++)
+			{
+				if( (*next_item_iter)->getVisible())
+				{
+					break;
+				}
+			}
+
+			if (next_item_iter != mItems.end() &&
+				(*next_item_iter)->getVisible())
+			{
+				mFirstVisibleItem = *next_item_iter;
+			}
 		}
+		break;
 	}
-	
+	case SD_BEGIN:
+	{
+		mFirstVisibleItem = *mItems.begin();
+		break;
+	}
+	case SD_END:
+	{
+		item_list_t::reverse_iterator first_visible_item_iter = mItems.rend();
+
+		// Advance by mMaxScrollableItems back from the end of the list
+		// to make the last item visible.
+		std::advance(first_visible_item_iter, mMaxScrollableItems);
+		mFirstVisibleItem = *first_visible_item_iter;
+		break;
+	}
+	default:
+		llwarns << "Unknown scrolling direction: " << direction << llendl;
+	}
+
 	mNeedsArrange = TRUE;
 	arrangeAndClear();
+
+	return true;
 }
 
 // rearrange the child rects so they fit the shape of the menu.
@@ -2162,7 +2177,7 @@ void LLMenuGL::arrange( void )
 					LLMenuScrollItem::Params item_params;
 					item_params.name(ARROW_UP);
 					item_params.arrow_type(LLMenuScrollItem::ARROW_UP);
-					item_params.scroll_callback.function(boost::bind(&LLMenuGL::scrollItemsUp, this));
+					item_params.scroll_callback.function(boost::bind(&LLMenuGL::scrollItems, this, SD_UP));
 
 					mArrowUpItem = LLUICtrlFactory::create<LLMenuScrollItem>(item_params);
 					LLUICtrl::addChild(mArrowUpItem);
@@ -2173,7 +2188,7 @@ void LLMenuGL::arrange( void )
 					LLMenuScrollItem::Params item_params;
 					item_params.name(ARROW_DOWN);
 					item_params.arrow_type(LLMenuScrollItem::ARROW_DOWN);
-					item_params.scroll_callback.function(boost::bind(&LLMenuGL::scrollItemsDown, this));
+					item_params.scroll_callback.function(boost::bind(&LLMenuGL::scrollItems, this, SD_DOWN));
 
 					mArrowDownItem = LLUICtrlFactory::create<LLMenuScrollItem>(item_params);
 					LLUICtrl::addChild(mArrowDownItem);				
@@ -2603,14 +2618,8 @@ LLMenuItemGL* LLMenuGL::highlightNextItem(LLMenuItemGL* cur_item, BOOL skip_disa
 		((LLFloater*)getParent())->setFocus(TRUE);
 	}
 
-	item_list_t::iterator cur_item_iter;
-	for (cur_item_iter = mItems.begin(); cur_item_iter != mItems.end(); ++cur_item_iter)
-	{
-		if( (*cur_item_iter) == cur_item)
-		{
-			break;
-		}
-	}
+	// Current item position in the items list
+	item_list_t::iterator cur_item_iter = std::find(mItems.begin(), mItems.end(), cur_item);
 
 	item_list_t::iterator next_item_iter;
 	if (cur_item_iter == mItems.end())
@@ -2621,9 +2630,37 @@ LLMenuItemGL* LLMenuGL::highlightNextItem(LLMenuItemGL* cur_item, BOOL skip_disa
 	{
 		next_item_iter = cur_item_iter;
 		next_item_iter++;
+
+		// First visible item position in the items list
+		item_list_t::iterator first_visible_item_iter = std::find(mItems.begin(), mItems.end(), mFirstVisibleItem);
+
 		if (next_item_iter == mItems.end())
 		{
 			next_item_iter = mItems.begin();
+
+			// If current item is the last in the list, the menu is scrolled to the beginning
+			// and the first item is highlighted.
+			if (mScrollable && !scrollItems(SD_BEGIN))
+			{
+				return NULL;
+			}
+		}
+		// If current item is the last visible, the menu is scrolled one item down
+		// and the next item is highlighted.
+		else if (mScrollable &&
+				 (U32)std::abs(std::distance(first_visible_item_iter, next_item_iter)) >= mMaxScrollableItems)
+		{
+			// Call highlightNextItem() recursively only if the menu was successfully scrolled down.
+			// If scroll timer hasn't expired yet the menu won't be scrolled and calling
+			// highlightNextItem() will result in an endless recursion.
+			if (scrollItems(SD_DOWN))
+			{
+				return highlightNextItem(cur_item, skip_disabled);
+			}
+			else
+			{
+				return NULL;
+			}
 		}
 	}
 
@@ -2681,14 +2718,8 @@ LLMenuItemGL* LLMenuGL::highlightPrevItem(LLMenuItemGL* cur_item, BOOL skip_disa
 		((LLFloater*)getParent())->setFocus(TRUE);
 	}
 
-	item_list_t::reverse_iterator cur_item_iter;
-	for (cur_item_iter = mItems.rbegin(); cur_item_iter != mItems.rend(); ++cur_item_iter)
-	{
-		if( (*cur_item_iter) == cur_item)
-		{
-			break;
-		}
-	}
+	// Current item reverse position from the end of the list
+	item_list_t::reverse_iterator cur_item_iter = std::find(mItems.rbegin(), mItems.rend(), cur_item);
 
 	item_list_t::reverse_iterator prev_item_iter;
 	if (cur_item_iter == mItems.rend())
@@ -2699,9 +2730,37 @@ LLMenuItemGL* LLMenuGL::highlightPrevItem(LLMenuItemGL* cur_item, BOOL skip_disa
 	{
 		prev_item_iter = cur_item_iter;
 		prev_item_iter++;
+
+		// First visible item reverse position in the items list
+		item_list_t::reverse_iterator first_visible_item_iter = std::find(mItems.rbegin(), mItems.rend(), mFirstVisibleItem);
+
 		if (prev_item_iter == mItems.rend())
 		{
 			prev_item_iter = mItems.rbegin();
+
+			// If current item is the first in the list, the menu is scrolled to the end
+			// and the last item is highlighted.
+			if (mScrollable && !scrollItems(SD_END))
+			{
+				return NULL;
+			}
+		}
+		// If current item is the first visible, the menu is scrolled one item up
+		// and the previous item is highlighted.
+		else if (mScrollable &&
+				 std::distance(first_visible_item_iter, cur_item_iter) <= 0)
+		{
+			// Call highlightNextItem() only if the menu was successfully scrolled up.
+			// If scroll timer hasn't expired yet the menu won't be scrolled and calling
+			// highlightNextItem() will result in an endless recursion.
+			if (scrollItems(SD_UP))
+			{
+				return highlightPrevItem(cur_item, skip_disabled);
+			}
+			else
+			{
+				return NULL;
+			}
 		}
 	}
 
@@ -2872,12 +2931,12 @@ BOOL LLMenuGL::handleScrollWheel( S32 x, S32 y, S32 clicks )
 	if( clicks > 0 )
 	{
 		while( clicks-- )
-			scrollItemsDown();
+			scrollItems(SD_DOWN);
 	}
 	else
 	{
 		while( clicks++ )
-			scrollItemsUp();
+			scrollItems(SD_UP);
 	}
 
 	return TRUE;
diff --git a/indra/llui/llmenugl.h b/indra/llui/llmenugl.h
index 19b738312e86700f2411858b60eaaa074ccd96c1..35544402f41b101a0d360ecd3838db770a461317 100644
--- a/indra/llui/llmenugl.h
+++ b/indra/llui/llmenugl.h
@@ -397,6 +397,15 @@ class LLMenuGL
 	static const std::string ARROW_UP;
 	static const std::string ARROW_DOWN;
 
+	// for scrollable menus
+	typedef enum e_scrolling_direction
+	{
+		SD_UP = 0,
+		SD_DOWN = 1,
+		SD_BEGIN = 2,
+		SD_END = 3
+	} EScrollingDirection;
+
 protected:
 	LLMenuGL(const LLMenuGL::Params& p);
 	friend class LLUICtrlFactory;
@@ -503,8 +512,7 @@ class LLMenuGL
 
 	S32 getShortcutPad() { return mShortcutPad; }
 
-	void scrollItemsUp();
-	void scrollItemsDown();
+	bool scrollItems(EScrollingDirection direction);
 	BOOL isScrollable() const { return mScrollable; }
 
 	static class LLMenuHolderGL* sMenuContainer;
diff --git a/indra/llui/llpanel.cpp b/indra/llui/llpanel.cpp
index c8e56630f1f301878b56670f5e2632fba575856e..900e2c789e28672b6d1130b0fb0c9634c31570bb 100644
--- a/indra/llui/llpanel.cpp
+++ b/indra/llui/llpanel.cpp
@@ -904,7 +904,7 @@ LLPanel *LLPanel::childGetVisiblePanelWithHelp()
 		child = *it;
 		// do we have a panel with a help topic?
 		LLPanel *panel = dynamic_cast<LLPanel *>(child);
-		if (panel && panel->getVisible() && !panel->getHelpTopic().empty())
+		if (panel && panel->isInVisibleChain() && !panel->getHelpTopic().empty())
 		{
 			return panel;
 		}
diff --git a/indra/llui/lltextbase.cpp b/indra/llui/lltextbase.cpp
index 9adeddca99635cf4801399a782d79c67989e3951..5721df6b3627c24281c164d6bb30b087d55175eb 100644
--- a/indra/llui/lltextbase.cpp
+++ b/indra/llui/lltextbase.cpp
@@ -1622,7 +1622,7 @@ void LLTextBase::appendTextImpl(const std::string &new_text, const LLStyle::Para
 	style_params.fillFrom(getDefaultStyleParams());
 
 	S32 part = (S32)LLTextParser::WHOLE;
-	if(mParseHTML)
+	if (mParseHTML && !style_params.is_link) // Don't search for URLs inside a link segment (STORM-358).
 	{
 		S32 start=0,end=0;
 		LLUrlMatch match;
@@ -2214,19 +2214,39 @@ bool LLTextBase::scrolledToEnd()
 	return mScroller->isAtBottom();
 }
 
-
 bool LLTextBase::setCursor(S32 row, S32 column)
 {
-	if (0 <= row && row < (S32)mLineInfoList.size())
+	if (row < 0 || column < 0) return false;
+
+	S32 n_lines = mLineInfoList.size();
+	for (S32 line = row; line < n_lines; ++line)
 	{
-		S32 doc_pos = mLineInfoList[row].mDocIndexStart;
-		column = llclamp(column, 0, mLineInfoList[row].mDocIndexEnd - mLineInfoList[row].mDocIndexStart - 1);
-		doc_pos += column;
-		updateCursorXPos();
+		const line_info& li = mLineInfoList[line];
+
+		if (li.mLineNum < row)
+		{
+			continue;
+		}
+		else if (li.mLineNum > row)
+		{
+			break; // invalid column specified
+		}
+
+		// Found the given row.
+		S32 line_length = li.mDocIndexEnd - li.mDocIndexStart;;
+		if (column >= line_length)
+		{
+			column -= line_length;
+			continue;
+		}
 
+		// Found the given column.
+		updateCursorXPos();
+		S32 doc_pos = li.mDocIndexStart + column;
 		return setCursorPos(doc_pos);
 	}
-	return false;
+
+	return false; // invalid row or column specified
 }
 
 
diff --git a/indra/llui/lltoggleablemenu.cpp b/indra/llui/lltoggleablemenu.cpp
index 0eb2dc138716556d490a6d1c188f7f5776d0319e..d29260750f88e1886a4162aa508eb04de5a81672 100644
--- a/indra/llui/lltoggleablemenu.cpp
+++ b/indra/llui/lltoggleablemenu.cpp
@@ -35,10 +35,22 @@ static LLDefaultChildRegistry::Register<LLToggleableMenu> r("toggleable_menu");
 LLToggleableMenu::LLToggleableMenu(const LLToggleableMenu::Params& p)
 :	LLMenuGL(p),
 	mButtonRect(),
+	mVisibilityChangeSignal(NULL),
 	mClosedByButtonClick(false)
 {
 }
 
+LLToggleableMenu::~LLToggleableMenu()
+{
+	delete mVisibilityChangeSignal;
+}
+
+boost::signals2::connection LLToggleableMenu::setVisibilityChangeCallback(const commit_signal_t::slot_type& cb)
+{
+	if (!mVisibilityChangeSignal) mVisibilityChangeSignal = new commit_signal_t();
+	return mVisibilityChangeSignal->connect(cb);
+}
+
 // virtual
 void LLToggleableMenu::handleVisibilityChange (BOOL curVisibilityIn)
 {
@@ -49,6 +61,12 @@ void LLToggleableMenu::handleVisibilityChange (BOOL curVisibilityIn)
 	{
 		mClosedByButtonClick = true;
 	}
+
+	if (mVisibilityChangeSignal)
+	{
+		(*mVisibilityChangeSignal)(this,
+				LLSD().with("visibility", curVisibilityIn).with("closed_by_button_click", mClosedByButtonClick));
+	}
 }
 
 void LLToggleableMenu::setButtonRect(const LLRect& rect, LLView* current_view)
diff --git a/indra/llui/lltoggleablemenu.h b/indra/llui/lltoggleablemenu.h
index f036cdfffbbd3eec4347c7368bd59ab137f6ddb5..2094bd776fde012e1334ac64aacca8a7ad5b09fb 100644
--- a/indra/llui/lltoggleablemenu.h
+++ b/indra/llui/lltoggleablemenu.h
@@ -41,6 +41,10 @@ class LLToggleableMenu : public LLMenuGL
 	LLToggleableMenu(const Params&);
 	friend class LLUICtrlFactory;
 public:
+	~LLToggleableMenu();
+
+	boost::signals2::connection setVisibilityChangeCallback( const commit_signal_t::slot_type& cb );
+
 	virtual void handleVisibilityChange (BOOL curVisibilityIn);
 
 	const LLRect& getButtonRect() const { return mButtonRect; }
@@ -57,6 +61,7 @@ class LLToggleableMenu : public LLMenuGL
 protected:
 	bool mClosedByButtonClick;
 	LLRect mButtonRect;
+	commit_signal_t*	mVisibilityChangeSignal;
 };
 
 #endif // LL_LLTOGGLEABLEMENU_H
diff --git a/indra/llui/lluistring.h b/indra/llui/lluistring.h
index eff2467bf0a2bf6e5c86c94313eae387735ce1fb..4faa0e070e673e62dd183346f5814a9a05e08419 100644
--- a/indra/llui/lluistring.h
+++ b/indra/llui/lluistring.h
@@ -58,10 +58,12 @@ class LLUIString
 public:
 	// These methods all perform appropriate argument substitution
 	// and modify mOrig where appropriate
-        LLUIString() : mArgs(NULL), mNeedsResult(false), mNeedsWResult(false) {}
+	LLUIString() : mArgs(NULL), mNeedsResult(false), mNeedsWResult(false) {}
 	LLUIString(const std::string& instring, const LLStringUtil::format_map_t& args);
 	LLUIString(const std::string& instring) : mArgs(NULL) { assign(instring); }
 
+	~LLUIString() { delete mArgs; }
+
 	void assign(const std::string& instring);
 	LLUIString& operator=(const std::string& s) { assign(s); return *this; }
 
@@ -81,14 +83,14 @@ class LLUIString
 
 	void clear();
 	void clearArgs() { if (mArgs) mArgs->clear(); }
-	
+
 	// These utility functions are included for text editing.
 	// They do not affect mOrig and do not perform argument substitution
 	void truncate(S32 maxchars);
 	void erase(S32 charidx, S32 len);
 	void insert(S32 charidx, const LLWString& wchars);
 	void replace(S32 charidx, llwchar wc);
-	
+
 private:
 	// something changed, requiring reformatting of strings
 	void dirty();
@@ -100,7 +102,7 @@ class LLUIString
 	void updateResult() const;
 	void updateWResult() const;
 	LLStringUtil::format_map_t& getArgs();
-	
+
 	std::string mOrig;
 	mutable std::string mResult;
 	mutable LLWString mWResult; // for displaying
diff --git a/indra/llui/llurlentry.cpp b/indra/llui/llurlentry.cpp
index efb3f1a8be6603b3830f7c91d0600eaa35b173a5..6cc72bad82817e081ab94a9cdb81131579f83bc8 100644
--- a/indra/llui/llurlentry.cpp
+++ b/indra/llui/llurlentry.cpp
@@ -978,7 +978,7 @@ std::string LLUrlEntryWorldMap::getLocation(const std::string &url) const
 //
 LLUrlEntryNoLink::LLUrlEntryNoLink()
 {
-	mPattern = boost::regex("<nolink>[^<]*</nolink>",
+	mPattern = boost::regex("<nolink>.*</nolink>",
 							boost::regex::perl|boost::regex::icase);
 }
 
@@ -995,7 +995,8 @@ std::string LLUrlEntryNoLink::getLabel(const std::string &url, const LLUrlLabelC
 
 LLStyle::Params LLUrlEntryNoLink::getStyle() const 
 { 
-	return LLStyle::Params(); 
+	// Don't render as URL (i.e. no context menu or hand cursor).
+	return LLStyle::Params().is_link(false);
 }
 
 
diff --git a/indra/mac_updater/mac_updater.cpp b/indra/mac_updater/mac_updater.cpp
index e4d100d1eca2e1b6bf87ae4df27a9fc898970837..23980ffac22a7954a0a6327369b71e5b2129ef38 100644
--- a/indra/mac_updater/mac_updater.cpp
+++ b/indra/mac_updater/mac_updater.cpp
@@ -61,6 +61,7 @@ Boolean gCancelled = false;
 
 const char *gUpdateURL;
 const char *gProductName;
+const char *gBundleID;
 
 void *updatethreadproc(void*);
 
@@ -329,6 +330,10 @@ int parse_args(int argc, char **argv)
 		{
 			gProductName = argv[j];
 		}
+		else if ((!strcmp(argv[j], "-bundleid")) && (++j < argc)) 
+		{
+			gBundleID = argv[j];
+		}
 	}
 
 	return 0;
@@ -355,6 +360,7 @@ int main(int argc, char **argv)
 	//
 	gUpdateURL  = NULL;
 	gProductName = NULL;
+	gBundleID = NULL;
 	parse_args(argc, argv);
 	if (!gUpdateURL)
 	{
@@ -372,6 +378,14 @@ int main(int argc, char **argv)
 		{
 			gProductName = "Second Life";
 		}
+		if (gBundleID)
+		{
+			llinfos << "Bundle ID is: " << gBundleID << llendl;
+		}
+		else
+		{
+			gBundleID = "com.secondlife.indra.viewer";
+		}
 	}
 	
 	llinfos << "Starting " << gProductName << " Updater" << llendl;
@@ -592,7 +606,8 @@ static bool isFSRefViewerBundle(FSRef *targetRef)
 	CFURLRef targetURL = NULL;
 	CFBundleRef targetBundle = NULL;
 	CFStringRef targetBundleID = NULL;
-	
+	CFStringRef sourceBundleID = NULL;
+
 	targetURL = CFURLCreateFromFSRef(NULL, targetRef);
 
 	if(targetURL == NULL)
@@ -619,7 +634,8 @@ static bool isFSRefViewerBundle(FSRef *targetRef)
 	}
 	else
 	{
-		if(CFStringCompare(targetBundleID, CFSTR("com.secondlife.indra.viewer"), 0) == kCFCompareEqualTo)
+		sourceBundleID = CFStringCreateWithCString(NULL, gBundleID, kCFStringEncodingUTF8);
+		if(CFStringCompare(sourceBundleID, targetBundleID, 0) == kCFCompareEqualTo)
 		{
 			// This is the bundle we're looking for.
 			result = true;
diff --git a/indra/newview/app_settings/cmd_line.xml b/indra/newview/app_settings/cmd_line.xml
index 00d69f805e8c9d6512395ebef4ed471e6b465509..ba3b6a42a42147d09689dc1ed31016f114bd68c4 100644
--- a/indra/newview/app_settings/cmd_line.xml
+++ b/indra/newview/app_settings/cmd_line.xml
@@ -391,5 +391,13 @@
       <string>CrashOnStartup</string>
     </map>
 
+    <key>disablecrashlogger</key>
+    <map>
+      <key>desc</key>
+      <string>Disables the crash logger and lets the OS handle crashes</string>
+      <key>map-to</key>
+      <string>DisableCrashLogger</string>
+    </map>
+
   </map>
 </llsd>
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index ee01ee783339518c50504f11ed86c56778f6c8ed..097fdfbb998a762e476db5721c5c2debda43e0c2 100644
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -24,6 +24,17 @@
       <key>Value</key>
       <real>300</real>
     </map>
+    <key>AdminMenu</key>
+    <map>
+      <key>Comment</key>
+      <string>Enable the debug admin menu from the main menu.  Note: This will just allow the menu to be shown; this does not grant admin privileges.</string>
+      <key>Persist</key>
+      <integer>0</integer>
+      <key>Type</key>
+      <string>Boolean</string>
+      <key>Value</key>
+      <integer>0</integer>
+    </map>
     <key>AdvanceSnapshot</key>
     <map>
       <key>Comment</key>
@@ -2567,6 +2578,28 @@
       <key>Value</key>
       <integer>1</integer>
     </map>
+    <key>EnableGroupChatPopups</key>
+    <map>
+      <key>Comment</key>
+      <string>Enable Incoming Group Chat Popups</string>
+      <key>Persist</key>
+      <integer>1</integer>
+      <key>Type</key>
+      <string>Boolean</string>
+      <key>Value</key>
+      <integer>1</integer>
+    </map>
+    <key>EnableIMChatPopups</key>
+    <map>
+      <key>Comment</key>
+      <string>Enable Incoming IM Chat Popups</string>
+      <key>Persist</key>
+      <integer>1</integer>
+      <key>Type</key>
+      <string>Boolean</string>
+      <key>Value</key>
+      <integer>1</integer>
+    </map>
     <key>DisplayAvatarAgentTarget</key>
     <map>
       <key>Comment</key>
@@ -4581,6 +4614,17 @@
       <key>Value</key>
       <integer>0</integer>
     </map>
+    <key>LogTextureNetworkTraffic</key>
+    <map>
+      <key>Comment</key>
+      <string>Log network traffic for textures</string>
+      <key>Persist</key>
+      <integer>1</integer>
+      <key>Type</key>
+      <string>Boolean</string>
+      <key>Value</key>
+      <integer>0</integer>
+    </map>
     <key>LoginAsGod</key>
     <map>
       <key>Comment</key>
@@ -5893,6 +5937,17 @@
       <key>Value</key>
       <integer>0</integer>
     </map>
+    <key>ObjectCacheEnabled</key>
+    <map>
+      <key>Comment</key>
+      <string>Enable the object cache.</string>
+      <key>Persist</key>
+      <integer>1</integer>
+      <key>Type</key>
+      <string>Boolean</string>
+      <key>Value</key>
+      <integer>1</integer>
+    </map>
     <key>OpenDebugStatAdvanced</key>
     <map>
       <key>Comment</key>
@@ -11145,6 +11200,17 @@
       <key>Value</key>
       <integer>1</integer>
     </map>
+    <key>SpeakerParticipantDefaultOrder</key>
+    <map>
+      <key>Comment</key>
+      <string>Order for displaying speakers in voice controls.  0 = alphabetical. 1 = recent.</string>
+      <key>Persist</key>
+      <integer>1</integer>
+      <key>Type</key>
+      <string>U32</string>
+      <key>Value</key>
+      <integer>1</integer>
+    </map>
     <key>SpeakerParticipantRemoveDelay</key>
     <map>
       <key>Comment</key>
@@ -12145,5 +12211,16 @@
       <key>Value</key>
       <real>300.0</real>
     </map>
+    <key>GroupMembersSortOrder</key>
+    <map>
+      <key>Comment</key>
+      <string>The order by which group members will be sorted (name|donated|online)</string>
+      <key>Persist</key>
+      <integer>1</integer>
+      <key>Type</key>
+      <string>String</string>
+      <key>Value</key>
+      <string>name</string>
+    </map>
 </map>
 </llsd>
diff --git a/indra/newview/llagentcamera.cpp b/indra/newview/llagentcamera.cpp
index 68e408d3e4aa9264e31cc8f6f465cba1e4e8c8cc..7c953cd2dc2ff9343fe0499a660f8a500e125d3c 100644
--- a/indra/newview/llagentcamera.cpp
+++ b/indra/newview/llagentcamera.cpp
@@ -296,8 +296,11 @@ void LLAgentCamera::resetView(BOOL reset_camera, BOOL change_camera)
 			LLSelectMgr::getInstance()->deselectAll();
 		}
 
-		// Hide all popup menus
-		gMenuHolder->hideMenus();
+		if (gMenuHolder != NULL)
+		{
+			// Hide all popup menus
+			gMenuHolder->hideMenus();
+		}
 	}
 
 	if (change_camera && !gSavedSettings.getBOOL("FreezeTime"))
diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp
index ed5e8ceee33af72f99e9b82aef171bfb919d730b..62074ddcd5c4f69fd2a9db395294d522ac2a4e72 100644
--- a/indra/newview/llappearancemgr.cpp
+++ b/indra/newview/llappearancemgr.cpp
@@ -2204,12 +2204,11 @@ void LLAppearanceMgr::updateIsDirty()
 		base_outfit = catp->getUUID();
 	}
 
-	if(base_outfit.isNull())
-	{
-		// no outfit link found, display "unsaved outfit"
-		mOutfitIsDirty = true;
-	}
-	else
+	// Set dirty to "false" if no base outfit found to disable "Save"
+	// and leave only "Save As" enabled in My Outfits.
+	mOutfitIsDirty = false;
+
+	if (base_outfit.notNull())
 	{
 		LLIsOfAssetType collector = LLIsOfAssetType(LLAssetType::AT_LINK);
 
@@ -2248,8 +2247,6 @@ void LLAppearanceMgr::updateIsDirty()
 				return;
 			}
 		}
-
-		mOutfitIsDirty = false;
 	}
 }
 
@@ -2635,6 +2632,7 @@ void LLAppearanceMgr::dumpItemArray(const LLInventoryModel::item_array_t& items,
 LLAppearanceMgr::LLAppearanceMgr():
 	mAttachmentInvLinkEnabled(false),
 	mOutfitIsDirty(false),
+	mOutfitLocked(false),
 	mIsInUpdateAppearanceFromCOF(false)
 {
 	LLOutfitObserver& outfit_observer = LLOutfitObserver::instance();
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index ba14c248aafa888a9939a8b023ef6aa90b7a7757..60ed37bdfbca8e5b51dcbbf91dce859d723187fa 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -30,6 +30,7 @@
 
 // Viewer includes
 #include "llversioninfo.h"
+#include "llversionviewer.h"
 #include "llfeaturemanager.h"
 #include "lluictrlfactory.h"
 #include "lltexteditor.h"
@@ -981,6 +982,7 @@ bool LLAppViewer::mainLoop()
 	LLVoiceClient::getInstance()->init(gServicePump);
 	LLTimer frameTimer,idleTimer;
 	LLTimer debugTime;
+	LLFrameTimer memCheckTimer;
 	LLViewerJoystick* joystick(LLViewerJoystick::getInstance());
 	joystick->setNeedsReset(true);
 
@@ -991,11 +993,29 @@ bool LLAppViewer::mainLoop()
     // point of posting.
     LLSD newFrame;
 
+	const F32 memory_check_interval = 1.0f ; //second
+
 	// Handle messages
 	while (!LLApp::isExiting())
 	{
 		LLFastTimer::nextFrame(); // Should be outside of any timer instances
 
+		//clear call stack records
+		llclearcallstacks;
+
+		//check memory availability information
+		{
+			if(memory_check_interval < memCheckTimer.getElapsedTimeF32())
+			{
+				memCheckTimer.reset() ;
+
+				//update the availability of memory
+				LLMemoryInfo::getAvailableMemoryKB(mAvailPhysicalMemInKB, mAvailVirtualMemInKB) ;
+			}
+			llcallstacks << "Available physical mem(KB): " << mAvailPhysicalMemInKB << llcallstacksendl ;
+			llcallstacks << "Available virtual mem(KB): " << mAvailVirtualMemInKB << llcallstacksendl ;
+		}
+
 		try
 		{
 			pingMainloopTimeout("Main:MiscNativeWindowEvents");
@@ -1222,11 +1242,20 @@ bool LLAppViewer::mainLoop()
 				resumeMainloopTimeout();
 	
 				pingMainloopTimeout("Main:End");
-			}
-						
+			}			
 		}
 		catch(std::bad_alloc)
 		{			
+			{
+				llinfos << "Availabe physical memory(KB) at the beginning of the frame: " << mAvailPhysicalMemInKB << llendl ;
+				llinfos << "Availabe virtual memory(KB) at the beginning of the frame: " << mAvailVirtualMemInKB << llendl ;
+
+				LLMemoryInfo::getAvailableMemoryKB(mAvailPhysicalMemInKB, mAvailVirtualMemInKB) ;
+
+				llinfos << "Current availabe physical memory(KB): " << mAvailPhysicalMemInKB << llendl ;
+				llinfos << "Current availabe virtual memory(KB): " << mAvailVirtualMemInKB << llendl ;
+			}
+
 			//stop memory leaking simulation
 			LLFloaterMemLeak* mem_leak_instance =
 				LLFloaterReg::findTypedInstance<LLFloaterMemLeak>("mem_leaking");
@@ -2019,6 +2048,15 @@ bool LLAppViewer::initConfiguration()
 	// - apply command line settings 
 	clp.notify(); 
 
+	// Register the core crash option as soon as we can
+	// if we want gdb post-mortem on cores we need to be up and running
+	// ASAP or we might miss init issue etc.
+	if(clp.hasOption("disablecrashlogger"))
+	{
+		llwarns << "Crashes will be handled by system, stack trace logs and crash logger are both disabled" << llendl;
+		LLAppViewer::instance()->disableCrashlogger();
+	}
+
 	// Handle initialization from settings.
 	// Start up the debugging console before handling other options.
 	if (gSavedSettings.getBOOL("ShowConsoleWindow"))
@@ -2595,6 +2633,11 @@ void LLAppViewer::handleViewerCrash()
 		abort();
 	}
 
+	if (LLApp::isCrashloggerDisabled())
+	{
+		abort();
+	}
+
 	// Returns whether a dialog was shown.
 	// Only do the logic in here once
 	if (pApp->mReportedCrash)
@@ -4513,6 +4556,8 @@ void LLAppViewer::launchUpdater()
 	LLAppViewer::sUpdaterInfo->mUpdateExePath += update_url.asString();
 	LLAppViewer::sUpdaterInfo->mUpdateExePath += "\" -name \"";
 	LLAppViewer::sUpdaterInfo->mUpdateExePath += LLAppViewer::instance()->getSecondLifeTitle();
+	LLAppViewer::sUpdaterInfo->mUpdateExePath += "\" -bundleid \"";
+	LLAppViewer::sUpdaterInfo->mUpdateExePath += LL_VERSION_BUNDLE_ID;
 	LLAppViewer::sUpdaterInfo->mUpdateExePath += "\" &";
 
 	LL_DEBUGS("AppInit") << "Calling updater: " << LLAppViewer::sUpdaterInfo->mUpdateExePath << LL_ENDL;
diff --git a/indra/newview/llappviewer.h b/indra/newview/llappviewer.h
index fdc3b9ef9e9a37f24ea2ac02a513afb0e8ab647f..a40cd831822a36b53f6185f66a0fc733830f1537 100644
--- a/indra/newview/llappviewer.h
+++ b/indra/newview/llappviewer.h
@@ -260,6 +260,8 @@ class LLAppViewer : public LLApp
 
 	std::set<struct apr_dso_handle_t*> mPlugins;
 
+	U32 mAvailPhysicalMemInKB ;
+	U32 mAvailVirtualMemInKB ;
 public:
 	//some information for updater
 	typedef struct
diff --git a/indra/newview/llavatarlistitem.cpp b/indra/newview/llavatarlistitem.cpp
index a56dc129d4a3e74718b792aeb8ec76156f31602f..30eecfe3231ddb2a061696a30b94e4cafbc65a92 100644
--- a/indra/newview/llavatarlistitem.cpp
+++ b/indra/newview/llavatarlistitem.cpp
@@ -41,7 +41,7 @@
 
 bool LLAvatarListItem::sStaticInitialized = false;
 S32 LLAvatarListItem::sLeftPadding = 0;
-S32 LLAvatarListItem::sRightNamePadding = 0;
+S32 LLAvatarListItem::sNameRightPadding = 0;
 S32 LLAvatarListItem::sChildrenWidths[LLAvatarListItem::ALIC_COUNT];
 
 static LLWidgetNameRegistry::StaticRegistrar sRegisterAvatarListItemParams(&typeid(LLAvatarListItem::Params), "avatar_list_item");
@@ -52,7 +52,8 @@ LLAvatarListItem::Params::Params()
 	voice_call_joined_style("voice_call_joined_style"),
 	voice_call_left_style("voice_call_left_style"),
 	online_style("online_style"),
-	offline_style("offline_style")
+	offline_style("offline_style"),
+	name_right_pad("name_right_pad", 0)
 {};
 
 
@@ -119,6 +120,9 @@ BOOL  LLAvatarListItem::postBuild()
 		// so that we can hide and show them again later.
 		initChildrenWidths(this);
 
+		// Right padding between avatar name text box and nearest visible child.
+		sNameRightPadding = LLUICtrlFactory::getDefaultParams<LLAvatarListItem>().name_right_pad;
+
 		sStaticInitialized = true;
 	}
 
@@ -486,7 +490,6 @@ void LLAvatarListItem::initChildrenWidths(LLAvatarListItem* avatar_item)
 	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;
@@ -565,7 +568,7 @@ void LLAvatarListItem::updateChildren()
 
 	// apply paddings
 	name_new_width -= sLeftPadding;
-	name_new_width -= sRightNamePadding;
+	name_new_width -= sNameRightPadding;
 
 	name_view_rect.setLeftTopAndSize(
 		name_new_left,
diff --git a/indra/newview/llavatarlistitem.h b/indra/newview/llavatarlistitem.h
index a069838ac3255211fe75d30dab36762b5a94ed16..c95ac3969685f5ce3dcfa43379e548204e54e8e4 100644
--- a/indra/newview/llavatarlistitem.h
+++ b/indra/newview/llavatarlistitem.h
@@ -51,6 +51,8 @@ class LLAvatarListItem : public LLPanel, public LLFriendObserver
 									online_style,
 									offline_style;
 
+		Optional<S32>				name_right_pad;
+
 		Params();
 	};
 
@@ -215,7 +217,7 @@ class LLAvatarListItem : public LLPanel, public LLFriendObserver
 
 	static bool	sStaticInitialized; // this variable is introduced to improve code readability
 	static S32  sLeftPadding; // padding to first left visible child (icon or name)
-	static S32  sRightNamePadding; // right padding from name to next visible child
+	static S32  sNameRightPadding; // right padding from name to next visible child
 
 	/**
 	 * Contains widths of each child specified by EAvatarListItemChildIndex
diff --git a/indra/newview/llcallfloater.cpp b/indra/newview/llcallfloater.cpp
index 078bd73379daf943de4aaca4ba505015463401b4..b2e9564f7d3bb13a3240577e604d998140f79e5e 100644
--- a/indra/newview/llcallfloater.cpp
+++ b/indra/newview/llcallfloater.cpp
@@ -45,6 +45,7 @@
 #include "llspeakers.h"
 #include "lltextutil.h"
 #include "lltransientfloatermgr.h"
+#include "llviewercontrol.h"
 #include "llviewerdisplayname.h"
 #include "llviewerwindow.h"
 #include "llvoicechannel.h"
@@ -335,8 +336,9 @@ void LLCallFloater::refreshParticipantList()
 	{
 		mParticipants = new LLParticipantList(mSpeakerManager, mAvatarList, true, mVoiceType != VC_GROUP_CHAT && mVoiceType != VC_AD_HOC_CHAT, false);
 		mParticipants->setValidateSpeakerCallback(boost::bind(&LLCallFloater::validateSpeaker, this, _1));
-		mParticipants->setSortOrder(LLParticipantList::E_SORT_BY_RECENT_SPEAKERS);
-
+		const U32 speaker_sort_order = gSavedSettings.getU32("SpeakerParticipantDefaultOrder");
+		mParticipants->setSortOrder(LLParticipantList::EParticipantSortOrder(speaker_sort_order));
+		
 		if (LLLocalSpeakerMgr::getInstance() == mSpeakerManager)
 		{
 			mAvatarList->setNoItemsCommentText(getString("no_one_near"));
diff --git a/indra/newview/llchathistory.cpp b/indra/newview/llchathistory.cpp
index 9153f7325f58b83ecfb6036b85bf4f1b109e2226..0f7e9313a9fff1e60e13e877f3692f4396bf62c7 100644
--- a/indra/newview/llchathistory.cpp
+++ b/indra/newview/llchathistory.cpp
@@ -790,8 +790,9 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL
 				// (don't let object names with hyperlinks override our objectim Url)
 				LLStyle::Params link_params(style_params);
 				link_params.color.control = "HTMLLinkColor";
+				link_params.is_link = true;
 				link_params.link_href = url;
-				mEditor->appendText("<nolink>" + chat.mFromName + "</nolink>"  + delimiter,
+				mEditor->appendText(chat.mFromName + delimiter,
 									false, link_params);
 			}
 			else if ( chat.mFromName != SYSTEM_FROM && chat.mFromID.notNull() && !message_from_log)
@@ -804,7 +805,7 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL
 			}
 			else
 			{
-				mEditor->appendText(chat.mFromName + delimiter, false, style_params);
+				mEditor->appendText("<nolink>" + chat.mFromName + "</nolink>" + delimiter, false, style_params);
 			}
 		}
 	}
diff --git a/indra/newview/llchatitemscontainerctrl.cpp b/indra/newview/llchatitemscontainerctrl.cpp
index ababa713485b05c52d13ecc51594f41666700478..d353c809cac14e2c06a36a0ab0fdf23d17dadfab 100644
--- a/indra/newview/llchatitemscontainerctrl.cpp
+++ b/indra/newview/llchatitemscontainerctrl.cpp
@@ -31,6 +31,7 @@
 
 #include "llchatmsgbox.h"
 #include "llavatariconctrl.h"
+#include "llcommandhandler.h"
 #include "llfloaterreg.h"
 #include "lllocalcliprect.h"
 #include "lltrans.h"
@@ -44,6 +45,40 @@ static const S32 msg_left_offset = 10;
 static const S32 msg_right_offset = 10;
 static const S32 msg_height_pad = 5;
 
+//*******************************************************************************************************************
+// LLObjectHandler
+//*******************************************************************************************************************
+
+// handle secondlife:///app/object/<ID>/inspect SLURLs
+class LLObjectHandler : public LLCommandHandler
+{
+public:
+	LLObjectHandler() : LLCommandHandler("object", UNTRUSTED_BLOCK) { }
+
+	bool handle(const LLSD& params, const LLSD& query_map, LLMediaCtrl* web)
+	{
+		if (params.size() < 2) return false;
+
+		LLUUID object_id;
+		if (!object_id.set(params[0], FALSE))
+		{
+			return false;
+		}
+
+		const std::string verb = params[1].asString();
+
+		if (verb == "inspect")
+		{
+			LLFloaterReg::showInstance("inspect_object", LLSD().with("object_id", object_id));
+			return true;
+		}
+
+		return false;
+	}
+};
+
+LLObjectHandler gObjectHandler;
+
 //*******************************************************************************************************************
 //LLNearbyChatToastPanel
 //*******************************************************************************************************************
@@ -169,17 +204,26 @@ void LLNearbyChatToastPanel::init(LLSD& notification)
 	{
 		std::string str_sender;
 
-		str_sender = "<nolink>"; // disable parsing URLs in object names (STORM-358)
-		str_sender += fromName;
-		str_sender += "</nolink>";
+		str_sender = fromName;
 
 		str_sender+=" ";
 
-		//append user name
+		//append sender name
+		if (mSourceType == CHAT_SOURCE_AGENT || mSourceType == CHAT_SOURCE_OBJECT)
 		{
 			LLStyle::Params style_params_name;
 
 			LLColor4 userNameColor = LLUIColorTable::instance().getColor("ChatToastAgentNameColor");
+			std::string href;
+
+			if (mSourceType == CHAT_SOURCE_AGENT)
+			{
+				href = LLSLURL("agent", mFromID, "about").getSLURLString();
+			}
+			else
+			{
+				href = LLSLURL("object", mFromID, "inspect").getSLURLString();
+			}
 
 			style_params_name.color(userNameColor);
 
@@ -188,11 +232,16 @@ void LLNearbyChatToastPanel::init(LLSD& notification)
 			style_params_name.font.name(font_name);
 			style_params_name.font.size(font_style_size);
 
-			style_params_name.link_href = LLSLURL("agent",mFromID,"about").getSLURLString();
+			style_params_name.link_href = href;
+			style_params_name.is_link = true;
 
 			msg_text->appendText(str_sender, FALSE, style_params_name);
 
 		}
+		else
+		{
+			msg_text->appendText(str_sender, false);
+		}
 	}
 
 	//append text
diff --git a/indra/newview/llcommandlineparser.cpp b/indra/newview/llcommandlineparser.cpp
index ee8646aad0bcf6c7de0e1fa1b25603615a925f89..f31ff14df6390d34712b77a636bd1815fb120c14 100644
--- a/indra/newview/llcommandlineparser.cpp
+++ b/indra/newview/llcommandlineparser.cpp
@@ -267,7 +267,11 @@ bool LLCommandLineParser::parseAndStoreResults(po::command_line_parser& clp)
     {
         clp.options(gOptionsDesc);
         clp.positional(gPositionalOptions);
-        clp.style(po::command_line_style::default_style 
+		// SNOW-626: Boost 1.42 erroneously added allow_guessing to the default style
+		// (see http://groups.google.com/group/boost-list/browse_thread/thread/545d7bf98ff9bb16?fwc=2&pli=1)
+		// Remove allow_guessing from the default style, because that is not allowed
+		// when we have options that are a prefix of other options (aka, --help and --helperuri).
+        clp.style((po::command_line_style::default_style & ~po::command_line_style::allow_guessing)
                   | po::command_line_style::allow_long_disguise);
 		if(mExtraParser)
 		{
diff --git a/indra/newview/lldrawable.cpp b/indra/newview/lldrawable.cpp
index 583bb541608ec7a66caa54b744921fd6d9b78f48..8106fada111b5aa02aceed2f091fafefbdc28e59 100644
--- a/indra/newview/lldrawable.cpp
+++ b/indra/newview/lldrawable.cpp
@@ -358,6 +358,7 @@ void LLDrawable::makeActive()
 	{
 		U32 pcode = mVObjp->getPCode();
 		if (pcode == LLViewerObject::LL_VO_WATER ||
+			pcode == LLViewerObject::LL_VO_VOID_WATER ||
 			pcode == LLViewerObject::LL_VO_SURFACE_PATCH ||
 			pcode == LLViewerObject::LL_VO_PART_GROUP ||
 			pcode == LLViewerObject::LL_VO_HUD_PART_GROUP ||
diff --git a/indra/newview/lldrawpool.cpp b/indra/newview/lldrawpool.cpp
index cb651f9d3a23773cfd4ff1105f2769c605ebe1fc..ba576ff97f260365af30c2b8c413c9d8f0d81319 100644
--- a/indra/newview/lldrawpool.cpp
+++ b/indra/newview/lldrawpool.cpp
@@ -89,6 +89,7 @@ LLDrawPool *LLDrawPool::createPool(const U32 type, LLViewerTexture *tex0)
 	case POOL_SKY:
 		poolp = new LLDrawPoolSky();
 		break;
+	case POOL_VOIDWATER:
 	case POOL_WATER:
 		poolp = new LLDrawPoolWater();
 		break;
diff --git a/indra/newview/lldrawpool.h b/indra/newview/lldrawpool.h
index 221f81ec256c8fe30042e4f310ca89f8fa3bfe22..e394aeaaf141c6acdc69da3d1e834918e69c6b17 100644
--- a/indra/newview/lldrawpool.h
+++ b/indra/newview/lldrawpool.h
@@ -57,6 +57,7 @@ class LLDrawPool
 		POOL_BUMP,
 		POOL_INVISIBLE, // see below *
 		POOL_AVATAR,
+		POOL_VOIDWATER,
 		POOL_WATER,
 		POOL_GLOW,
 		POOL_ALPHA,
diff --git a/indra/newview/lldrawpoolground.cpp b/indra/newview/lldrawpoolground.cpp
index e950fbfa82d72724c6f9f796bc425e4e7a9f69b0..b4dc0c26a6bfb0134044d31ba6396ac330de1ce0 100644
--- a/indra/newview/lldrawpoolground.cpp
+++ b/indra/newview/lldrawpoolground.cpp
@@ -68,7 +68,7 @@ void LLDrawPoolGround::render(S32 pass)
 
 	LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE);
 
-	LLGLClampToFarClip far_clip(glh_get_current_projection());
+	LLGLSquashToFarClip far_clip(glh_get_current_projection());
 
 	F32 water_height = gAgent.getRegion()->getWaterHeight();
 	glPushMatrix();
diff --git a/indra/newview/lldrawpoolsky.cpp b/indra/newview/lldrawpoolsky.cpp
index d811ab8c5410a0990546dd1cba68ebaf0e3d22ae..9eb45a952c98a348d453d5557cbcd73bbe72174a 100644
--- a/indra/newview/lldrawpoolsky.cpp
+++ b/indra/newview/lldrawpoolsky.cpp
@@ -97,7 +97,7 @@ void LLDrawPoolSky::render(S32 pass)
 
 	LLGLDepthTest gls_depth(GL_TRUE, GL_FALSE);
 
-	LLGLClampToFarClip far_clip(glh_get_current_projection());
+	LLGLSquashToFarClip far_clip(glh_get_current_projection());
 
 	LLGLEnable fog_enable( (mVertexShaderLevel < 1 && LLViewerCamera::getInstance()->cameraUnderWater()) ? GL_FOG : 0);
 
diff --git a/indra/newview/lldrawpoolwater.cpp b/indra/newview/lldrawpoolwater.cpp
index ce1b899d553fc2f38d4fe76613587d3aaabe07b1..612690823155977af47bf513ea1d3fa08d372eda 100644
--- a/indra/newview/lldrawpoolwater.cpp
+++ b/indra/newview/lldrawpoolwater.cpp
@@ -532,6 +532,7 @@ void LLDrawPoolWater::shade()
 	glColor4fv(water_color.mV);
 
 	{
+		LLGLEnable depth_clamp(gGLManager.mHasDepthClamp ? GL_DEPTH_CLAMP : 0);
 		LLGLDisable cullface(GL_CULL_FACE);
 		for (std::vector<LLFace*>::iterator iter = mDrawFace.begin();
 			iter != mDrawFace.end(); iter++)
@@ -548,30 +549,19 @@ void LLDrawPoolWater::shade()
 
 			sNeedsReflectionUpdate = TRUE;
 			
-			if (water->getUseTexture())
+			if (water->getUseTexture() || !water->getIsEdgePatch())
 			{
 				sNeedsDistortionUpdate = TRUE;
 				face->renderIndexed();
 			}
+			else if (gGLManager.mHasDepthClamp || deferred_render)
+			{
+				face->renderIndexed();
+			}
 			else
-			{ //smash background faces to far clip plane
-				if (water->getIsEdgePatch())
-				{
-					if (deferred_render)
-					{
-						face->renderIndexed();
-					}
-					else
-					{
-						LLGLClampToFarClip far_clip(glh_get_current_projection());
-						face->renderIndexed();
-					}
-				}
-				else
-				{
-					sNeedsDistortionUpdate = TRUE;
-					face->renderIndexed();
-				}
+			{
+				LLGLSquashToFarClip far_clip(glh_get_current_projection());
+				face->renderIndexed();
 			}
 		}
 	}
diff --git a/indra/newview/lldrawpoolwlsky.cpp b/indra/newview/lldrawpoolwlsky.cpp
index 41a299151e1c08e55a2ea82f7847d38a2ec9fef2..eaa6aa7e37cbacc6199f5f31736e0b2661912a14 100644
--- a/indra/newview/lldrawpoolwlsky.cpp
+++ b/indra/newview/lldrawpoolwlsky.cpp
@@ -260,7 +260,7 @@ void LLDrawPoolWLSky::render(S32 pass)
 	LLGLDepthTest depth(GL_TRUE, GL_FALSE);
 	LLGLDisable clip(GL_CLIP_PLANE0);
 
-	LLGLClampToFarClip far_clip(glh_get_current_projection());
+	LLGLSquashToFarClip far_clip(glh_get_current_projection());
 
 	renderSkyHaze(camHeightLocal);
 
diff --git a/indra/newview/llfavoritesbar.cpp b/indra/newview/llfavoritesbar.cpp
index 3981b887ade3c4230965fb8707ce418416fd334f..a1ba370c2646ac390f29015383fc1cf53ccdafcf 100644
--- a/indra/newview/llfavoritesbar.cpp
+++ b/indra/newview/llfavoritesbar.cpp
@@ -414,6 +414,9 @@ BOOL LLFavoritesBarCtrl::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
 {
 	*accept = ACCEPT_NO;
 
+	LLToolDragAndDrop::ESource source = LLToolDragAndDrop::getInstance()->getSource();
+	if (LLToolDragAndDrop::SOURCE_AGENT != source && LLToolDragAndDrop::SOURCE_LIBRARY != source) return FALSE;
+
 	switch (cargo_type)
 	{
 
diff --git a/indra/newview/llfloatergodtools.cpp b/indra/newview/llfloatergodtools.cpp
index 662e1c4f422c2df41a7e7dbd3ea96151e7d9a7f0..a34e0353ec5d9cd9593a20a858a5c54894b7050c 100644
--- a/indra/newview/llfloatergodtools.cpp
+++ b/indra/newview/llfloatergodtools.cpp
@@ -209,13 +209,6 @@ void LLFloaterGodTools::processRegionInfo(LLMessageSystem* msg)
 	llassert(msg);
 	if (!msg) return;
 
-	LLHost host = msg->getSender();
-	if (host != gAgent.getRegionHost())
-	{
-		// update is for a different region than the one we're in
-		return;
-	}
-
 	//const S32 SIM_NAME_BUF = 256;
 	U32 region_flags;
 	U8 sim_access;
@@ -233,6 +226,8 @@ void LLFloaterGodTools::processRegionInfo(LLMessageSystem* msg)
 	S32 redirect_grid_y;
 	LLUUID cache_id;
 
+	LLHost host = msg->getSender();
+
 	msg->getStringFast(_PREHASH_RegionInfo, _PREHASH_SimName, sim_name);
 	msg->getU32Fast(_PREHASH_RegionInfo, _PREHASH_EstateID, estate_id);
 	msg->getU32Fast(_PREHASH_RegionInfo, _PREHASH_ParentEstateID, parent_estate_id);
@@ -242,6 +237,15 @@ void LLFloaterGodTools::processRegionInfo(LLMessageSystem* msg)
 	msg->getF32Fast(_PREHASH_RegionInfo, _PREHASH_ObjectBonusFactor, object_bonus_factor);
 	msg->getF32Fast(_PREHASH_RegionInfo, _PREHASH_BillableFactor, billable_factor);
 	msg->getF32Fast(_PREHASH_RegionInfo, _PREHASH_WaterHeight, water_height);
+
+	if (host != gAgent.getRegionHost())
+	{
+		// Update is for a different region than the one we're in.
+		// Just check for a waterheight change.
+		LLWorld::getInstance()->waterHeightRegionInfo(sim_name, water_height);
+		return;
+	}
+
 	msg->getF32Fast(_PREHASH_RegionInfo, _PREHASH_TerrainRaiseLimit, terrain_raise_limit);
 	msg->getF32Fast(_PREHASH_RegionInfo, _PREHASH_TerrainLowerLimit, terrain_lower_limit);
 	msg->getS32Fast(_PREHASH_RegionInfo, _PREHASH_PricePerMeter, price_per_meter);
diff --git a/indra/newview/llfloatermap.cpp b/indra/newview/llfloatermap.cpp
index a1d291fea6a9e23f20816c0388e0f7783f78496d..351b9ac5dad40a4423cfe24556ee7ba6acf5cccb 100644
--- a/indra/newview/llfloatermap.cpp
+++ b/indra/newview/llfloatermap.cpp
@@ -43,6 +43,8 @@
 #include "lldraghandle.h"
 #include "lltextbox.h"
 #include "llviewermenu.h"
+#include "llfloaterworldmap.h"
+#include "llagent.h"
 
 //
 // Constants
@@ -122,11 +124,36 @@ BOOL LLFloaterMap::postBuild()
 	return TRUE;
 }
 
-BOOL LLFloaterMap::handleDoubleClick( S32 x, S32 y, MASK mask )
+BOOL LLFloaterMap::handleDoubleClick(S32 x, S32 y, MASK mask)
 {
 	// If floater is minimized, minimap should be shown on doubleclick (STORM-299)
-	std::string floater_to_show = this->isMinimized() ? "mini_map" : "world_map";
-	LLFloaterReg::showInstance(floater_to_show);
+	if (isMinimized())
+	{
+		setMinimized(FALSE);
+		return TRUE;
+	}
+
+	LLVector3d pos_global = mMap->viewPosToGlobal(x, y);
+	
+	// If we're not tracking a beacon already, double-click will set one 
+	if (!LLTracker::isTracking(NULL))
+	{
+		LLFloaterWorldMap* world_map = LLFloaterWorldMap::getInstance();
+		if (world_map)
+		{
+			world_map->trackLocation(pos_global);
+		}
+	}
+	
+	if (gSavedSettings.getBOOL("DoubleClickTeleport"))
+	{
+		// If DoubleClickTeleport is on, double clicking the minimap will teleport there
+		gAgent.teleportViaLocationLookAt(pos_global);
+	}
+	else 
+	{
+		LLFloaterReg::showInstance("world_map");
+	}
 	return TRUE;
 }
 
diff --git a/indra/newview/llfloaterworldmap.cpp b/indra/newview/llfloaterworldmap.cpp
index 723689454266181e51eced97bfa1e9ec624fdf8a..ba0eb8a711c065f8cdca800c488d76f7e4af5335 100644
--- a/indra/newview/llfloaterworldmap.cpp
+++ b/indra/newview/llfloaterworldmap.cpp
@@ -635,7 +635,7 @@ void LLFloaterWorldMap::updateTeleportCoordsDisplay( const LLVector3d& pos )
 	// convert global specified position to a local one
 	F32 region_local_x = (F32)fmod( pos.mdV[VX], (F64)REGION_WIDTH_METERS );
 	F32 region_local_y = (F32)fmod( pos.mdV[VY], (F64)REGION_WIDTH_METERS );
-	F32 region_local_z = (F32)fmod( pos.mdV[VZ], (F64)REGION_WIDTH_METERS );
+	F32 region_local_z = (F32)llclamp( pos.mdV[VZ], 0.0, (F64)REGION_HEIGHT_METERS );
 
 	// write in the values
 	childSetValue("teleport_coordinate_x", region_local_x );
diff --git a/indra/newview/llfolderview.cpp b/indra/newview/llfolderview.cpp
index c38cd4d09032eb1a98b03f4e11b02d4479057c4b..62ba746a02a84ab3b9e9a8294c3ea697cc93ab45 100644
--- a/indra/newview/llfolderview.cpp
+++ b/indra/newview/llfolderview.cpp
@@ -2429,6 +2429,7 @@ S32	LLFolderView::notify(const LLSD& info)
 		{
 			setFocus(true);
 			selectFirstItem();
+			scrollToShowSelection();
 			return 1;
 
 		}
@@ -2436,6 +2437,7 @@ S32	LLFolderView::notify(const LLSD& info)
 		{
 			setFocus(true);
 			selectLastItem();
+			scrollToShowSelection();
 			return 1;
 		}
 	}
diff --git a/indra/newview/llgiveinventory.cpp b/indra/newview/llgiveinventory.cpp
index 260e15c714c735aacb67251689a707653e7774a5..f990b9294d6f8aa37c088b716d7f0ec7af4c10be 100644
--- a/indra/newview/llgiveinventory.cpp
+++ b/indra/newview/llgiveinventory.cpp
@@ -128,7 +128,7 @@ bool LLGiveInventory::isInventoryGiveAcceptable(const LLInventoryItem* item)
 	switch(item->getType())
 	{
 	case LLAssetType::AT_OBJECT:
-		if (gAgentAvatarp->isWearingAttachment(item->getUUID()))
+		if (get_is_item_worn(item->getUUID()))
 		{
 			acceptable = false;
 		}
@@ -139,7 +139,7 @@ bool LLGiveInventory::isInventoryGiveAcceptable(const LLInventoryItem* item)
 			BOOL copyable = false;
 			if (item->getPermissions().allowCopyBy(gAgentID)) copyable = true;
 
-			if (!copyable && gAgentWearables.isWearingItem(item->getUUID()))
+			if (!copyable && get_is_item_worn(item->getUUID()))
 			{
 				acceptable = false;
 			}
diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp
index 02a693b9a0041d09af932dc220fe8126ddde0fda..857c27be6394147ff9dd4dbb073d615e93a1f2ea 100644
--- a/indra/newview/llimview.cpp
+++ b/indra/newview/llimview.cpp
@@ -131,6 +131,20 @@ void toast_callback(const LLSD& msg){
 		return;
 	}
 
+	// *NOTE Skip toasting if the user disable it in preferences/debug settings ~Alexandrea
+	LLIMModel::LLIMSession* session = LLIMModel::instance().findIMSession(
+				msg["session_id"]);
+	if (!gSavedSettings.getBOOL("EnableGroupChatPopups")
+			&& session->isGroupSessionType())
+	{
+		return;
+	}
+	if (!gSavedSettings.getBOOL("EnableIMChatPopups")
+			&& !session->isGroupSessionType())
+	{
+		return;
+	}
+
 	// Skip toasting if we have open window of IM with this session id
 	LLIMFloater* open_im_floater = LLIMFloater::findInstance(msg["session_id"]);
 	if (open_im_floater && open_im_floater->getVisible())
@@ -1064,17 +1078,27 @@ void LLIMModel::sendMessage(const std::string& utf8_text,
 		if( session == 0)//??? shouldn't really happen
 		{
 			LLRecentPeople::instance().add(other_participant_id);
+			return;
 		}
-		else
+		// IM_SESSION_INVITE means that this is an Ad-hoc incoming chat
+		//		(it can be also Group chat but it is checked above)
+		// In this case mInitialTargetIDs contains Ad-hoc session ID and it should not be added
+		// to Recent People to prevent showing of an item with (???)(???). See EXT-8246.
+		// Concrete participants will be added into this list once they sent message in chat.
+		if (IM_SESSION_INVITE == dialog) return;
+			
+		if (IM_SESSION_CONFERENCE_START == dialog) // outgoing ad-hoc session
 		{
-			// IM_SESSION_INVITE means that this is an Ad-hoc incoming chat
-			//		(it can be also Group chat but it is checked above)
-			// In this case mInitialTargetIDs contains Ad-hoc session ID and it should not be added
-			// to Recent People to prevent showing of an item with (???)(???). See EXT-8246.
-			// Concrete participants will be added into this list once they sent message in chat.
-			if (IM_SESSION_INVITE == dialog) return;
-			// Add only online members to recent (EXT-8658)
-			addSpeakersToRecent(im_session_id);			
+			// Add only online members of conference to recent list (EXT-8658)
+			addSpeakersToRecent(im_session_id);
+		}
+		else // outgoing P2P session
+		{
+			// Add the recepient of the session.
+			if (!session->mInitialTargetIDs.empty())
+			{
+				LLRecentPeople::instance().add(*(session->mInitialTargetIDs.begin()));
+			}
 		}
 	}
 }
diff --git a/indra/newview/llinspectavatar.cpp b/indra/newview/llinspectavatar.cpp
index 29dcb2c4d3a89beb0573aea6decb7c7902c8af67..91ede6d2213aebbd4b7c91723b566666ecf09de0 100644
--- a/indra/newview/llinspectavatar.cpp
+++ b/indra/newview/llinspectavatar.cpp
@@ -53,6 +53,7 @@
 #include "llfloaterreg.h"
 #include "llmenubutton.h"
 #include "lltextbox.h"
+#include "lltoggleablemenu.h"
 #include "lltooltip.h"	// positionViewNearMouse()
 #include "lltrans.h"
 #include "lluictrl.h"
@@ -402,8 +403,8 @@ void LLInspectAvatar::processAvatarData(LLAvatarData* data)
 // 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();
+	LLToggleableMenu* gear_menu = getChild<LLMenuButton>("gear_btn")->getMenu();
+	LLToggleableMenu* gear_menu_self = getChild<LLMenuButton>("gear_self_btn")->getMenu();
 	if ( gear_menu && gear_menu->getVisible() &&
 		 gear_menu_self && gear_menu_self->getVisible() )
 	{
diff --git a/indra/newview/llinspectobject.cpp b/indra/newview/llinspectobject.cpp
index 532ffca4be5357a55d175725b844cf62a7490091..ee076f68ea1fa4217beb2c986ff7ae64484e13d9 100644
--- a/indra/newview/llinspectobject.cpp
+++ b/indra/newview/llinspectobject.cpp
@@ -47,6 +47,7 @@
 #include "llsafehandle.h"
 #include "llsidetray.h"
 #include "lltextbox.h"			// for description truncation
+#include "lltoggleablemenu.h"
 #include "lltrans.h"
 #include "llui.h"				// positionViewNearMouse()
 #include "lluictrl.h"
@@ -568,7 +569,7 @@ void LLInspectObject::updateSecureBrowsing()
 // if the gear menu is not open
 void LLInspectObject::onMouseLeave(S32 x, S32 y, MASK mask)
 {
-	LLMenuGL* gear_menu = getChild<LLMenuButton>("gear_btn")->getMenu();
+	LLToggleableMenu* gear_menu = getChild<LLMenuButton>("gear_btn")->getMenu();
 	if ( gear_menu && gear_menu->getVisible() )
 	{
 		return;
diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp
index b15dcd993a761a3e644c58b515ad86bdf5cfcca5..5ba87423c7bae91222a0fa4ebe526acc332580a8 100644
--- a/indra/newview/llinventorybridge.cpp
+++ b/indra/newview/llinventorybridge.cpp
@@ -1643,16 +1643,19 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat,
 	const BOOL is_agent_inventory = (model->getCategory(inv_cat->getUUID()) != NULL)
 		&& (LLToolDragAndDrop::SOURCE_AGENT == source);
 
+	const LLUUID &current_outfit_id = model->findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT, false);
+	const BOOL move_is_into_current_outfit = (mUUID == current_outfit_id);
+
 	BOOL accept = FALSE;
 	if (is_agent_inventory)
 	{
 		const LLUUID &cat_id = inv_cat->getUUID();
 		const LLUUID &trash_id = model->findCategoryUUIDForType(LLFolderType::FT_TRASH, false);
-		const LLUUID &current_outfit_id = model->findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT, false);
+		const LLUUID &landmarks_id = model->findCategoryUUIDForType(LLFolderType::FT_LANDMARK, false);
 		
 		const BOOL move_is_into_trash = (mUUID == trash_id) || model->isObjectDescendentOf(mUUID, trash_id);
 		const BOOL move_is_into_outfit = getCategory() && (getCategory()->getPreferredType() == LLFolderType::FT_OUTFIT);
-		const BOOL move_is_into_current_outfit = (mUUID == current_outfit_id);
+		const BOOL move_is_into_landmarks = (mUUID == landmarks_id) || model->isObjectDescendentOf(mUUID, landmarks_id);
 
 		//--------------------------------------------------------------------------------
 		// Determine if folder can be moved.
@@ -1690,6 +1693,21 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat,
 				}
 			}
 		}
+		if (move_is_into_landmarks)
+		{
+			for (S32 i=0; i < descendent_items.count(); ++i)
+			{
+				LLViewerInventoryItem* item = descendent_items[i];
+
+				// Don't move anything except landmarks and categories into Landmarks folder.
+				// We use getType() instead of getActua;Type() to allow links to landmarks and folders.
+				if (LLAssetType::AT_LANDMARK != item->getType() && LLAssetType::AT_CATEGORY != item->getType())
+				{
+					is_movable = FALSE;
+					break; // It's generally movable, but not into Landmarks.
+				}
+			}
+		}
 
 		// 
 		//--------------------------------------------------------------------------------
@@ -1777,6 +1795,17 @@ BOOL LLFolderBridge::dragCategoryIntoFolder(LLInventoryCategory* inv_cat,
 		LLUUID category_id = mUUID;
 		accept = move_inv_category_world_to_agent(object_id, category_id, drop);
 	}
+	else if (LLToolDragAndDrop::SOURCE_LIBRARY == source)
+	{
+		// Accept folders that contain complete outfits.
+		accept = move_is_into_current_outfit && LLAppearanceMgr::instance().getCanMakeFolderIntoOutfit(inv_cat->getUUID());
+
+		if (accept && drop)
+		{
+			LLAppearanceMgr::instance().wearInventoryCategory(inv_cat, true, false);
+		}
+	}
+
 	return accept;
 }
 
@@ -2661,6 +2690,8 @@ BOOL LLFolderBridge::dragOrDrop(MASK mask, BOOL drop,
 								EDragAndDropType cargo_type,
 								void* cargo_data)
 {
+	LLInventoryItem* inv_item = (LLInventoryItem*)cargo_data;
+
 	//llinfos << "LLFolderBridge::dragOrDrop()" << llendl;
 	BOOL accept = FALSE;
 	switch(cargo_type)
@@ -2676,9 +2707,24 @@ BOOL LLFolderBridge::dragOrDrop(MASK mask, BOOL drop,
 		case DAD_BODYPART:
 		case DAD_ANIMATION:
 		case DAD_GESTURE:
+			accept = dragItemIntoFolder(inv_item, drop);
+			break;
 		case DAD_LINK:
-			accept = dragItemIntoFolder((LLInventoryItem*)cargo_data,
-										drop);
+			// DAD_LINK type might mean one of two asset types: AT_LINK or AT_LINK_FOLDER.
+			// If we have an item of AT_LINK_FOLDER type we should process the linked
+			// category being dragged or dropped into folder.
+			if (inv_item && LLAssetType::AT_LINK_FOLDER == inv_item->getActualType())
+			{
+				LLInventoryCategory* linked_category = gInventory.getCategory(inv_item->getLinkedUUID());
+				if (linked_category)
+				{
+					accept = dragCategoryIntoFolder((LLInventoryCategory*)linked_category, drop);
+				}
+			}
+			else
+			{
+				accept = dragItemIntoFolder(inv_item, drop);
+			}
 			break;
 		case DAD_CATEGORY:
 			if (LLFriendCardsManager::instance().isAnyFriendCategory(mUUID))
@@ -2862,6 +2908,7 @@ static BOOL can_move_to_outfit(LLInventoryItem* inv_item, BOOL move_is_into_curr
 {
 	if ((inv_item->getInventoryType() != LLInventoryType::IT_WEARABLE) &&
 		(inv_item->getInventoryType() != LLInventoryType::IT_GESTURE) &&
+		(inv_item->getInventoryType() != LLInventoryType::IT_ATTACHMENT) &&
 		(inv_item->getInventoryType() != LLInventoryType::IT_OBJECT))
 	{
 		return FALSE;
@@ -2875,6 +2922,24 @@ static BOOL can_move_to_outfit(LLInventoryItem* inv_item, BOOL move_is_into_curr
 	return TRUE;
 }
 
+// Returns TRUE if item is a landmark or a link to a landmark
+// and can be moved to Favorites or Landmarks folder.
+static BOOL can_move_to_landmarks(LLInventoryItem* inv_item)
+{
+	// Need to get the linked item to know its type because LLInventoryItem::getType()
+	// returns actual type AT_LINK for links, not the asset type of a linked item.
+	if (LLAssetType::AT_LINK == inv_item->getType())
+	{
+		LLInventoryItem* linked_item = gInventory.getItem(inv_item->getLinkedUUID());
+		if (linked_item)
+		{
+			return LLAssetType::AT_LANDMARK == linked_item->getType();
+		}
+	}
+
+	return LLAssetType::AT_LANDMARK == inv_item->getType();
+}
+
 void LLFolderBridge::dropToFavorites(LLInventoryItem* inv_item)
 {
 	// use callback to rearrange favorite landmarks after adding
@@ -2931,9 +2996,12 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item,
 
 	const LLUUID &current_outfit_id = model->findCategoryUUIDForType(LLFolderType::FT_CURRENT_OUTFIT, false);
 	const LLUUID &favorites_id = model->findCategoryUUIDForType(LLFolderType::FT_FAVORITE, false);
+	const LLUUID &landmarks_id = model->findCategoryUUIDForType(LLFolderType::FT_LANDMARK, false);
 
 	const BOOL move_is_into_current_outfit = (mUUID == current_outfit_id);
+	const BOOL move_is_into_favorites = (mUUID == favorites_id);
 	const BOOL move_is_into_outfit = (getCategory() && getCategory()->getPreferredType()==LLFolderType::FT_OUTFIT);
+	const BOOL move_is_into_landmarks = (mUUID == landmarks_id) || model->isObjectDescendentOf(mUUID, landmarks_id);
 
 	LLToolDragAndDrop::ESource source = LLToolDragAndDrop::getInstance()->getSource();
 	BOOL accept = FALSE;
@@ -2944,7 +3012,6 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item,
 
 		const BOOL move_is_into_trash = (mUUID == trash_id) || model->isObjectDescendentOf(mUUID, trash_id);
 		const BOOL move_is_outof_current_outfit = LLAppearanceMgr::instance().getIsInCOF(inv_item->getUUID());
-		const BOOL folder_allows_reorder = (mUUID == favorites_id);
 
 		//--------------------------------------------------------------------------------
 		// Determine if item can be moved.
@@ -2990,12 +3057,16 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item,
 
 		if (!is_movable) 
 			accept = FALSE;
-		if ((mUUID == inv_item->getParentUUID()) && !folder_allows_reorder)
+		if ((mUUID == inv_item->getParentUUID()) && !move_is_into_favorites)
 			accept = FALSE;
 		if (move_is_into_current_outfit || move_is_into_outfit)
 		{
 			accept = can_move_to_outfit(inv_item, move_is_into_current_outfit);
 		}
+		else if (move_is_into_favorites || move_is_into_landmarks)
+		{
+			accept = can_move_to_landmarks(inv_item);
+		}
 
 		if(accept && drop)
 		{
@@ -3021,8 +3092,8 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item,
 			// 
 
 			// REORDER
-			// (only reorder the item)
-			if ((mUUID == inv_item->getParentUUID()) && folder_allows_reorder)
+			// (only reorder the item in Favorites folder)
+			if ((mUUID == inv_item->getParentUUID()) && move_is_into_favorites)
 			{
 				LLInventoryPanel* panel = dynamic_cast<LLInventoryPanel*>(mInventoryPanel.get());
 				LLFolderViewItem* itemp = panel ? panel->getRootFolder()->getDraggingOverItem() : NULL;
@@ -3036,7 +3107,7 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item,
 
 			// FAVORITES folder
 			// (copy the item)
-			else if (favorites_id == mUUID)
+			else if (move_is_into_favorites)
 			{
 				dropToFavorites(inv_item);
 			}
@@ -3101,6 +3172,13 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item,
 		{
 			accept = FALSE;
 		}
+		// Don't allow to move a single item to Favorites or Landmarks
+		// if it is not a landmark or a link to a landmark.
+		else if ((move_is_into_favorites || move_is_into_landmarks)
+				 && !can_move_to_landmarks(inv_item))
+		{
+			accept = FALSE;
+		}
 
 		if(drop && accept)
 		{
@@ -3146,12 +3224,18 @@ BOOL LLFolderBridge::dragItemIntoFolder(LLInventoryItem* inv_item,
 			{
 				accept = can_move_to_outfit(inv_item, move_is_into_current_outfit);
 			}
+			// Don't allow to move a single item to Favorites or Landmarks
+			// if it is not a landmark or a link to a landmark.
+			else if (move_is_into_favorites || move_is_into_landmarks)
+			{
+				accept = can_move_to_landmarks(inv_item);
+			}
 
 			if (accept && drop)
 			{
 				// FAVORITES folder
 				// (copy the item)
-				if (favorites_id == mUUID)
+				if (move_is_into_favorites)
 				{
 					dropToFavorites(inv_item);
 				}
diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp
index f3d9639deebcc550a4ad8dcd4321e2815e3bcef8..ef2086911401ccdcda96cdaf0d3196fdccdd1694 100644
--- a/indra/newview/llinventoryfunctions.cpp
+++ b/indra/newview/llinventoryfunctions.cpp
@@ -487,12 +487,9 @@ bool LLInventoryCollectFunctor::itemTransferCommonlyAllowed(const LLInventoryIte
 			return false;
 			break;
 		case LLAssetType::AT_OBJECT:
-			if (isAgentAvatarValid() && !gAgentAvatarp->isWearingAttachment(item->getUUID()))
-				return true;
-			break;
 		case LLAssetType::AT_BODYPART:
 		case LLAssetType::AT_CLOTHING:
-			if(!gAgentWearables.isWearingItem(item->getUUID()))
+			if (!get_is_item_worn(item->getUUID()))
 				return true;
 			break;
 		default:
diff --git a/indra/newview/llinventoryicon.cpp b/indra/newview/llinventoryicon.cpp
index 7216d61e7fc3197255b5be8d849aa5c53cfc68da..3f4f33e88db9267a7becde099a9b5353c24b70c2 100644
--- a/indra/newview/llinventoryicon.cpp
+++ b/indra/newview/llinventoryicon.cpp
@@ -50,7 +50,7 @@ class LLIconDictionary : public LLSingleton<LLIconDictionary>,
 LLIconDictionary::LLIconDictionary()
 {
 	addEntry(LLInventoryIcon::ICONNAME_TEXTURE, 				new IconEntry("Inv_Texture"));
-	addEntry(LLInventoryIcon::ICONNAME_SOUND, 					new IconEntry("Inv_Texture"));
+	addEntry(LLInventoryIcon::ICONNAME_SOUND, 					new IconEntry("Inv_Sound"));
 	addEntry(LLInventoryIcon::ICONNAME_CALLINGCARD_ONLINE, 		new IconEntry("Inv_CallingCard"));
 	addEntry(LLInventoryIcon::ICONNAME_CALLINGCARD_OFFLINE, 	new IconEntry("Inv_CallingCard"));
 	addEntry(LLInventoryIcon::ICONNAME_LANDMARK, 				new IconEntry("Inv_Landmark"));
@@ -83,7 +83,7 @@ LLIconDictionary::LLIconDictionary()
 	addEntry(LLInventoryIcon::ICONNAME_GESTURE, 				new IconEntry("Inv_Gesture"));
 
 	addEntry(LLInventoryIcon::ICONNAME_LINKITEM, 				new IconEntry("Inv_LinkItem"));
-	addEntry(LLInventoryIcon::ICONNAME_LINKFOLDER, 				new IconEntry("Inv_LinkItem"));
+	addEntry(LLInventoryIcon::ICONNAME_LINKFOLDER, 				new IconEntry("Inv_LinkFolder"));
 
 	addEntry(LLInventoryIcon::ICONNAME_INVALID, 				new IconEntry("Inv_Invalid"));
 
diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp
index 50adae09c0e81531dc3fb0463a5fedc9f0af29d9..0870b5b8dd3fad9d804218f284889809a49f2d0e 100644
--- a/indra/newview/llinventorypanel.cpp
+++ b/indra/newview/llinventorypanel.cpp
@@ -290,7 +290,10 @@ void LLInventoryPanel::modelChanged(U32 mask)
 		const LLUUID& item_id = (*items_iter);
 		const LLInventoryObject* model_item = model->getObject(item_id);
 		LLFolderViewItem* view_item = mFolderRoot->getItemByID(item_id);
-		LLFolderViewFolder* view_folder = mFolderRoot->getFolderByID(item_id);
+
+		// LLFolderViewFolder is derived from LLFolderViewItem so dynamic_cast from item
+		// to folder is the fast way to get a folder without searching through folders tree.
+		LLFolderViewFolder* view_folder = dynamic_cast<LLFolderViewFolder*>(view_item);
 
 		//////////////////////////////
 		// LABEL Operation
diff --git a/indra/newview/llnearbychathandler.cpp b/indra/newview/llnearbychathandler.cpp
index 47d32e57fbef76394c36831343effdd4e6b26760..d2ad78f140cc3ae7911b754d656adedf851fc277 100644
--- a/indra/newview/llnearbychathandler.cpp
+++ b/indra/newview/llnearbychathandler.cpp
@@ -64,6 +64,18 @@ class LLNearbyChatScreenChannel: public LLScreenChannelBase
 	LLNearbyChatScreenChannel(const LLUUID& id):LLScreenChannelBase(id) 
 	{
 		mStopProcessing = false;
+
+		LLControlVariable* ctrl = gSavedSettings.getControl("NearbyToastLifeTime").get();
+		if (ctrl)
+		{
+			ctrl->getSignal()->connect(boost::bind(&LLNearbyChatScreenChannel::updateToastsLifetime, this));
+		}
+
+		ctrl = gSavedSettings.getControl("NearbyToastFadingTime").get();
+		if (ctrl)
+		{
+			ctrl->getSignal()->connect(boost::bind(&LLNearbyChatScreenChannel::updateToastFadingTime, this));
+		}
 	}
 
 	void addNotification	(LLSD& notification);
@@ -109,13 +121,26 @@ class LLNearbyChatScreenChannel: public LLScreenChannelBase
 		if (!toast) return;
 		LL_DEBUGS("NearbyChat") << "Pooling toast" << llendl;
 		toast->setVisible(FALSE);
-		toast->stopTimer();
+		toast->stopFading();
 		toast->setIsHidden(true);
+
+		// Nearby chat toasts that are hidden, not destroyed. They are collected to the toast pool, so that
+		// they can be used next time, this is done for performance. But if the toast lifetime was changed
+		// (from preferences floater (STORY-36)) while it was shown (at this moment toast isn't in the pool yet)
+		// changes don't take affect.
+		// So toast's lifetime should be updated each time it's added to the pool. Otherwise viewer would have
+		// to be restarted so that changes take effect.
+		toast->setLifetime(gSavedSettings.getS32("NearbyToastLifeTime"));
+		toast->setFadingTime(gSavedSettings.getS32("NearbyToastFadingTime"));
 		m_toast_pool.push_back(toast->getHandle());
 	}
 
 	void	createOverflowToast(S32 bottom, F32 timer);
 
+	void 	updateToastsLifetime();
+
+	void	updateToastFadingTime();
+
 	create_toast_panel_callback_t m_create_toast_panel_callback_t;
 
 	bool	createPoolToast();
@@ -205,6 +230,27 @@ void LLNearbyChatScreenChannel::onToastFade(LLToast* toast)
 	arrangeToasts();
 }
 
+void LLNearbyChatScreenChannel::updateToastsLifetime()
+{
+	S32 seconds = gSavedSettings.getS32("NearbyToastLifeTime");
+	toast_list_t::iterator it;
+
+	for(it = m_toast_pool.begin(); it != m_toast_pool.end(); ++it)
+	{
+		(*it).get()->setLifetime(seconds);
+	}
+}
+
+void LLNearbyChatScreenChannel::updateToastFadingTime()
+{
+	S32 seconds = gSavedSettings.getS32("NearbyToastFadingTime");
+	toast_list_t::iterator it;
+
+	for(it = m_toast_pool.begin(); it != m_toast_pool.end(); ++it)
+	{
+		(*it).get()->setFadingTime(seconds);
+	}
+}
 
 bool	LLNearbyChatScreenChannel::createPoolToast()
 {
@@ -250,7 +296,7 @@ void LLNearbyChatScreenChannel::addNotification(LLSD& notification)
 			{
 				panel->addMessage(notification);
 				toast->reshapeToPanel();
-				toast->resetTimer();
+				toast->startFading();
 	  
 				arrangeToasts();
 				return;
@@ -295,7 +341,7 @@ void LLNearbyChatScreenChannel::addNotification(LLSD& notification)
 	panel->init(notification);
 
 	toast->reshapeToPanel();
-	toast->resetTimer();
+	toast->startFading();
 	
 	m_active_toasts.push_back(toast->getHandle());
 
@@ -325,9 +371,9 @@ void LLNearbyChatScreenChannel::arrangeToasts()
 
 int sort_toasts_predicate(LLHandle<LLToast> first, LLHandle<LLToast> second)
 {
-	F32 v1 = first.get()->getTimer()->getEventTimer().getElapsedTimeF32();
-	F32 v2 = second.get()->getTimer()->getEventTimer().getElapsedTimeF32();
-	return v1 < v2;
+	F32 v1 = first.get()->getTimeLeftToLive();
+	F32 v2 = second.get()->getTimeLeftToLive();
+	return v1 > v2;
 }
 
 void LLNearbyChatScreenChannel::showToastsBottom()
diff --git a/indra/newview/llnetmap.h b/indra/newview/llnetmap.h
index 650bce0da4d580bf2bb5ffc11e97d10c66030a33..e053b1c177006a02d33443c69dbf51a93703aa89 100644
--- a/indra/newview/llnetmap.h
+++ b/indra/newview/llnetmap.h
@@ -38,6 +38,7 @@ class LLColor4U;
 class LLCoordGL;
 class LLImageRaw;
 class LLViewerTexture;
+class LLFloaterMap;
 
 class LLNetMap : public LLUICtrl
 {
@@ -55,6 +56,7 @@ class LLNetMap : public LLUICtrl
 protected:
 	LLNetMap (const Params & p);
 	friend class LLUICtrlFactory;
+	friend class LLFloaterMap;
 
 public:
 	virtual ~LLNetMap();
diff --git a/indra/newview/lloutfitslist.cpp b/indra/newview/lloutfitslist.cpp
index db9d386b6b61934d6b247bf08add622055ab306f..6435126fc0c5d10c7ec081ea734b640d7d178feb 100644
--- a/indra/newview/lloutfitslist.cpp
+++ b/indra/newview/lloutfitslist.cpp
@@ -38,9 +38,11 @@
 #include "llinventoryfunctions.h"
 #include "llinventorymodel.h"
 #include "lllistcontextmenu.h"
+#include "llmenubutton.h"
 #include "llnotificationsutil.h"
 #include "lloutfitobserver.h"
 #include "llsidetray.h"
+#include "lltoggleablemenu.h"
 #include "lltransutil.h"
 #include "llviewermenu.h"
 #include "llvoavatar.h"
@@ -113,7 +115,7 @@ class LLOutfitListGearMenu
 		registrar.add("Gear.Wear", boost::bind(&LLOutfitListGearMenu::onWear, this));
 		registrar.add("Gear.TakeOff", boost::bind(&LLOutfitListGearMenu::onTakeOff, this));
 		registrar.add("Gear.Rename", boost::bind(&LLOutfitListGearMenu::onRename, this));
-		registrar.add("Gear.Delete", boost::bind(&LLOutfitListGearMenu::onDelete, this));
+		registrar.add("Gear.Delete", boost::bind(&LLOutfitsList::removeSelected, mOutfitList));
 		registrar.add("Gear.Create", boost::bind(&LLOutfitListGearMenu::onCreate, this, _2));
 
 		registrar.add("Gear.WearAdd", boost::bind(&LLOutfitListGearMenu::onAdd, this));
@@ -121,23 +123,11 @@ class LLOutfitListGearMenu
 		enable_registrar.add("Gear.OnEnable", boost::bind(&LLOutfitListGearMenu::onEnable, this, _2));
 		enable_registrar.add("Gear.OnVisible", boost::bind(&LLOutfitListGearMenu::onVisible, this, _2));
 
-		mMenu = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>(
+		mMenu = LLUICtrlFactory::getInstance()->createFromFile<LLToggleableMenu>(
 			"menu_outfit_gear.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
 		llassert(mMenu);
 	}
 
-	void show(LLView* spawning_view)
-	{
-		if (!mMenu) return;
-
-		updateItemsVisibility();
-		mMenu->buildDrawLabels();
-		mMenu->updateParent(LLMenuGL::sMenuContainer);
-		S32 menu_x = 0;
-		S32 menu_y = spawning_view->getRect().getHeight() + mMenu->getRect().getHeight();
-		LLMenuGL::showPopup(spawning_view, mMenu, menu_x, menu_y);
-	}
-
 	void updateItemsVisibility()
 	{
 		if (!mMenu) return;
@@ -148,6 +138,8 @@ class LLOutfitListGearMenu
 		mMenu->arrangeAndClear(); // update menu height
 	}
 
+	LLToggleableMenu* getMenu() { return mMenu; }
+
 private:
 	const LLUUID& getSelectedOutfitID()
 	{
@@ -205,15 +197,6 @@ class LLOutfitListGearMenu
 		}
 	}
 
-	void onDelete()
-	{
-		const LLUUID& selected_outfit_id = getSelectedOutfitID();
-		if (selected_outfit_id.notNull())
-		{
-			remove_category(&gInventory, selected_outfit_id);
-		}
-	}
-
 	void onCreate(const LLSD& data)
 	{
 		LLWearableType::EType type = LLWearableType::typeNameToType(data.asString());
@@ -260,14 +243,20 @@ class LLOutfitListGearMenu
 		return true;
 	}
 
-	LLOutfitsList*	mOutfitList;
-	LLMenuGL*		mMenu;
+	LLOutfitsList*			mOutfitList;
+	LLToggleableMenu*		mMenu;
 };
 
 //////////////////////////////////////////////////////////////////////////
 
 class LLOutfitContextMenu : public LLListContextMenu
 {
+public:
+
+	LLOutfitContextMenu(LLOutfitsList* outfit_list)
+	:		LLListContextMenu(),
+	 		mOutfitList(outfit_list)
+	{}
 protected:
 	/* virtual */ LLContextMenu* createMenu()
 	{
@@ -283,7 +272,7 @@ class LLOutfitContextMenu : public LLListContextMenu
 				boost::bind(&LLAppearanceMgr::takeOffOutfit, &LLAppearanceMgr::instance(), selected_id));
 		registrar.add("Outfit.Edit", boost::bind(editOutfit));
 		registrar.add("Outfit.Rename", boost::bind(renameOutfit, selected_id));
-		registrar.add("Outfit.Delete", boost::bind(deleteOutfit, selected_id));
+		registrar.add("Outfit.Delete", boost::bind(&LLOutfitsList::removeSelected, mOutfitList));
 
 		enable_registrar.add("Outfit.OnEnable", boost::bind(&LLOutfitContextMenu::onEnable, this, _2));
 		enable_registrar.add("Outfit.OnVisible", boost::bind(&LLOutfitContextMenu::onVisible, this, _2));
@@ -346,10 +335,8 @@ class LLOutfitContextMenu : public LLListContextMenu
 		LLAppearanceMgr::instance().renameOutfit(outfit_cat_id);
 	}
 
-	static void deleteOutfit(const LLUUID& outfit_cat_id)
-	{
-		remove_category(&gInventory, outfit_cat_id);
-	}
+private:
+	LLOutfitsList*	mOutfitList;
 };
 
 //////////////////////////////////////////////////////////////////////////
@@ -366,7 +353,7 @@ LLOutfitsList::LLOutfitsList()
 	mCategoriesObserver = new LLInventoryCategoriesObserver();
 
 	mGearMenu = new LLOutfitListGearMenu(this);
-	mOutfitMenu = new LLOutfitContextMenu();
+	mOutfitMenu = new LLOutfitContextMenu(this);
 }
 
 LLOutfitsList::~LLOutfitsList()
@@ -386,6 +373,11 @@ BOOL LLOutfitsList::postBuild()
 	mAccordion = getChild<LLAccordionCtrl>("outfits_accordion");
 	mAccordion->setComparator(&OUTFIT_TAB_NAME_COMPARATOR);
 
+	LLMenuButton* menu_gear_btn = getChild<LLMenuButton>("options_gear_btn");
+
+	menu_gear_btn->setMouseDownCallback(boost::bind(&LLOutfitListGearMenu::updateItemsVisibility, mGearMenu));
+	menu_gear_btn->setMenu(mGearMenu->getMenu());
+
 	return TRUE;
 }
 
@@ -638,6 +630,14 @@ void LLOutfitsList::performAction(std::string action)
 
 void LLOutfitsList::removeSelected()
 {
+	LLNotificationsUtil::add("DeleteOutfits", LLSD(), LLSD(), boost::bind(&LLOutfitsList::onOutfitsRemovalConfirmation, this, _1, _2));
+}
+
+void LLOutfitsList::onOutfitsRemovalConfirmation(const LLSD& notification, const LLSD& response)
+{
+	S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+	if (option != 0) return; // canceled
+
 	if (mSelectedOutfitUUID.notNull())
 	{
 		remove_category(&gInventory, mSelectedOutfitUUID);
@@ -727,13 +727,6 @@ bool LLOutfitsList::isActionEnabled(const LLSD& userdata)
 	return false;
 }
 
-// virtual
-void LLOutfitsList::showGearMenu(LLView* spawning_view)
-{
-	if (!mGearMenu) return;
-	mGearMenu->show(spawning_view);
-}
-
 void LLOutfitsList::getSelectedItemsUUIDs(uuid_vec_t& selected_uuids) const
 {
 	// Collect selected items from all selected lists.
diff --git a/indra/newview/lloutfitslist.h b/indra/newview/lloutfitslist.h
index f73ae5bef2a85dbd73c00a87bfe24a7fd7f254e5..a0598737f1a8ab20727a0d7e477708f1a14ebf7f 100644
--- a/indra/newview/lloutfitslist.h
+++ b/indra/newview/lloutfitslist.h
@@ -94,8 +94,6 @@ class LLOutfitsList : public LLPanelAppearanceTab
 
 	/*virtual*/ bool isActionEnabled(const LLSD& userdata);
 
-	/*virtual*/ void showGearMenu(LLView* spawning_view);
-
 	const LLUUID& getSelectedOutfitUUID() const { return mSelectedOutfitUUID; }
 
 	/*virtual*/ void getSelectedItemsUUIDs(uuid_vec_t& selected_uuids) const;
@@ -112,6 +110,8 @@ class LLOutfitsList : public LLPanelAppearanceTab
 
 private:
 
+	void onOutfitsRemovalConfirmation(const LLSD& notification, const LLSD& response);
+
 	/**
 	 * Wrapper for LLCommonUtils::computeDifference. @see LLCommonUtils::computeDifference
 	 */
diff --git a/indra/newview/llpanelappearancetab.h b/indra/newview/llpanelappearancetab.h
index 81366c5db4a26cc6b97595672fd9c4ca8393110d..2ed6b004977009cad0e13242f8acc6adde2c45e9 100644
--- a/indra/newview/llpanelappearancetab.h
+++ b/indra/newview/llpanelappearancetab.h
@@ -39,8 +39,6 @@ class LLPanelAppearanceTab : public LLPanel
 
 	virtual bool isActionEnabled(const LLSD& userdata) = 0;
 
-	virtual void showGearMenu(LLView* spawning_view) = 0;
-
 	virtual void getSelectedItemsUUIDs(uuid_vec_t& selected_uuids) const {}
 
 	static const std::string& getFilterSubString() { return sFilterSubString; }
diff --git a/indra/newview/llpanelgroupgeneral.cpp b/indra/newview/llpanelgroupgeneral.cpp
index 80df420a4e060fd9dce0671e34a24a2507b01c72..ec340dc258dff5964524d41dfad2889e1588f6b7 100644
--- a/indra/newview/llpanelgroupgeneral.cpp
+++ b/indra/newview/llpanelgroupgeneral.cpp
@@ -692,7 +692,8 @@ void LLPanelGroupGeneral::updateMembers()
 	LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID);
 
 	if (!mListVisibleMembers || !gdatap 
-		|| !gdatap->isMemberDataComplete())
+		|| !gdatap->isMemberDataComplete()
+		|| gdatap->mMembers.empty())
 	{
 		return;
 	}
diff --git a/indra/newview/llpanelgrouproles.cpp b/indra/newview/llpanelgrouproles.cpp
index 35f898bfa60245dc876fdda13108c1cbfc93cce7..d1362d79227f5826091a3eefeb027dd461465a8e 100644
--- a/indra/newview/llpanelgrouproles.cpp
+++ b/indra/newview/llpanelgrouproles.cpp
@@ -49,6 +49,7 @@
 #include "llviewertexturelist.h"
 #include "llviewerwindow.h"
 #include "llfocusmgr.h"
+#include "llviewercontrol.h"
 
 #include "roles_constants.h"
 
@@ -742,10 +743,12 @@ LLPanelGroupMembersSubTab::LLPanelGroupMembersSubTab()
 	mHasMatch(FALSE),
 	mNumOwnerAdditions(0)
 {
+	mUdpateSessionID = LLUUID::null;
 }
 
 LLPanelGroupMembersSubTab::~LLPanelGroupMembersSubTab()
 {
+	gSavedSettings.setString("GroupMembersSortOrder", mMembersList->getSortColumnName());
 }
 
 BOOL LLPanelGroupMembersSubTab::postBuildSubTab(LLView* root)
@@ -772,6 +775,17 @@ BOOL LLPanelGroupMembersSubTab::postBuildSubTab(LLView* root)
 	// Show the member's profile on double click.
 	mMembersList->setDoubleClickCallback(onMemberDoubleClick, this);
 	mMembersList->setContextMenu(LLScrollListCtrl::MENU_AVATAR);
+	
+	LLSD row;
+	row["columns"][0]["column"] = "name";
+	row["columns"][1]["column"] = "donated";
+	row["columns"][2]["column"] = "online";
+	mMembersList->addElement(row);
+	std::string order_by = gSavedSettings.getString("GroupMembersSortOrder");
+	if(!order_by.empty())
+	{
+		mMembersList->sortByColumn(order_by, TRUE);
+	}	
 
 	LLButton* button = parent->getChild<LLButton>("member_invite", recurse);
 	if ( button )
@@ -1529,6 +1543,10 @@ void LLPanelGroupMembersSubTab::update(LLGroupChange gc)
 		mMemberProgress = gdatap->mMembers.begin();
 		mPendingMemberUpdate = TRUE;
 		mHasMatch = FALSE;
+		// Generate unique ID for current updateMembers()- see onNameCache for details.
+		// Using unique UUID is perhaps an overkill but this way we are perfectly safe
+		// from coincidences.
+		mUdpateSessionID.generate();
 	}
 	else
 	{
@@ -1556,6 +1574,63 @@ void LLPanelGroupMembersSubTab::update(LLGroupChange gc)
 	}
 }
 
+void LLPanelGroupMembersSubTab::addMemberToList(LLUUID id, LLGroupMemberData* data)
+{
+	if (!data) return;
+	LLUIString donated = getString("donation_area");
+	donated.setArg("[AREA]", llformat("%d", data->getContribution()));
+
+	LLSD row;
+	row["id"] = id;
+
+	row["columns"][0]["column"] = "name";
+	// value is filled in by name list control
+
+	row["columns"][1]["column"] = "donated";
+	row["columns"][1]["value"] = donated.getString();
+
+	row["columns"][2]["column"] = "online";
+	row["columns"][2]["value"] = data->getOnlineStatus();
+	row["columns"][2]["font"] = "SANSSERIF_SMALL";
+
+	mMembersList->addElement(row);
+
+	mHasMatch = TRUE;
+}
+
+void LLPanelGroupMembersSubTab::onNameCache(const LLUUID& update_id, const LLUUID& id)
+{
+	// Update ID is used to determine whether member whose id is passed
+	// into onNameCache() was passed after current or previous user-initiated update.
+	// This is needed to avoid probable duplication of members in list after changing filter
+	// or adding of members of another group if gets for their names were called on
+	// previous update. If this id is from get() called from older update,
+	// we do nothing.
+	if (mUdpateSessionID != update_id) return;
+	
+	LLGroupMgrGroupData* gdatap = LLGroupMgr::getInstance()->getGroupData(mGroupID);
+		if (!gdatap) 
+	{
+		llwarns << "LLPanelGroupMembersSubTab::updateMembers() -- No group data!" << llendl;
+		return;
+	}
+	
+	std::string fullname;
+	gCacheName->getFullName(id, fullname);
+
+	LLGroupMemberData* data;
+	// trying to avoid unnecessary hash lookups
+	if (matchesSearchFilter(fullname) && ((data = gdatap->mMembers[id]) != NULL))
+	{
+		addMemberToList(id, data);
+		if(!mMembersList->getEnabled())
+		{
+			mMembersList->setEnabled(TRUE);
+		}
+	}
+	
+}
+
 void LLPanelGroupMembersSubTab::updateMembers()
 {
 	mPendingMemberUpdate = FALSE;
@@ -1580,12 +1655,13 @@ void LLPanelGroupMembersSubTab::updateMembers()
 
 	//cleanup list only for first iretation
 	if(mMemberProgress == gdatap->mMembers.begin())
+	{
 		mMembersList->deleteAllItems();
+	}
 
 
 	LLGroupMgrGroupData::member_list_t::iterator end = gdatap->mMembers.end();
-	LLUIString donated = getString("donation_area");
-
+	
 	S32 i = 0;
 	for( ; mMemberProgress != end && i<UPDATE_MEMBERS_PER_FRAME; 
 			++mMemberProgress, ++i)
@@ -1593,38 +1669,19 @@ void LLPanelGroupMembersSubTab::updateMembers()
 		if (!mMemberProgress->second)
 			continue;
 		// Do filtering on name if it is already in the cache.
-		bool add_member = true;
-
 		std::string fullname;
 		if (gCacheName->getFullName(mMemberProgress->first, fullname))
 		{
-			if ( !matchesSearchFilter(fullname) )
+			if (matchesSearchFilter(fullname))
 			{
-				add_member = false;
+				addMemberToList(mMemberProgress->first, mMemberProgress->second);
 			}
 		}
-
-		if (add_member)
+		else
 		{
-			donated.setArg("[AREA]", llformat("%d", mMemberProgress->second->getContribution()));
-
-			LLSD row;
-			row["id"] = (*mMemberProgress).first;
-
-			row["columns"][0]["column"] = "name";
-			// value is filled in by name list control
-
-			row["columns"][1]["column"] = "donated";
-			row["columns"][1]["value"] = donated.getString();
-
-			row["columns"][2]["column"] = "online";
-			row["columns"][2]["value"] = mMemberProgress->second->getOnlineStatus();
-			row["columns"][2]["font"] = "SANSSERIF_SMALL";
-
-			LLScrollListItem* member = mMembersList->addElement(row);
-
-			LLUUID id = member->getUUID();
-			mHasMatch = TRUE;
+			// If name is not cached, onNameCache() should be called when it is cached and add this member to list.
+			gCacheName->get(mMemberProgress->first, FALSE, boost::bind(&LLPanelGroupMembersSubTab::onNameCache,
+																	   this, mUdpateSessionID, _1));
 		}
 	}
 
diff --git a/indra/newview/llpanelgrouproles.h b/indra/newview/llpanelgrouproles.h
index 6a773f1ebb3d6717e45d8b8a8f6ad9b77bb41660..270259c16f90824a5f9a34f5f41f40413dc83820 100644
--- a/indra/newview/llpanelgrouproles.h
+++ b/indra/newview/llpanelgrouproles.h
@@ -187,6 +187,9 @@ class LLPanelGroupMembersSubTab : public LLPanelGroupSubTab
 
 	virtual void setGroupID(const LLUUID& id);
 
+	void addMemberToList(LLUUID id, LLGroupMemberData* data);
+	void onNameCache(const LLUUID& update_id, const LLUUID& id);
+
 protected:
 	typedef std::map<LLUUID, LLRoleMemberChangeType> role_change_data_map_t;
 	typedef std::map<LLUUID, role_change_data_map_t*> member_role_changes_map_t;
@@ -207,6 +210,9 @@ class LLPanelGroupMembersSubTab : public LLPanelGroupSubTab
 	BOOL mPendingMemberUpdate;
 	BOOL mHasMatch;
 
+	// This id is generated after each user initiated member list update(opening Roles or changing filter)
+	LLUUID mUdpateSessionID;
+
 	member_role_changes_map_t mMemberRoleChangeData;
 	U32 mNumOwnerAdditions;
 
diff --git a/indra/newview/llpanellandmarks.cpp b/indra/newview/llpanellandmarks.cpp
index c4a484d368b413b328805c90666a7fa4da389592..d25b8e0e024e11f25754268dc6b10da5748d6346 100644
--- a/indra/newview/llpanellandmarks.cpp
+++ b/indra/newview/llpanellandmarks.cpp
@@ -47,9 +47,11 @@
 #include "llinventorymodelbackgroundfetch.h"
 #include "llinventorypanel.h"
 #include "lllandmarkactions.h"
+#include "llmenubutton.h"
 #include "llplacesinventorybridge.h"
 #include "llplacesinventorypanel.h"
 #include "llsidetray.h"
+#include "lltoggleablemenu.h"
 #include "llviewermenu.h"
 #include "llviewerregion.h"
 
@@ -191,6 +193,7 @@ LLLandmarksPanel::LLLandmarksPanel()
 	,	mLibraryInventoryPanel(NULL)
 	,	mCurrentSelectedList(NULL)
 	,	mListCommands(NULL)
+	,	mGearButton(NULL)
 	,	mGearFolderMenu(NULL)
 	,	mGearLandmarkMenu(NULL)
 {
@@ -685,7 +688,9 @@ void LLLandmarksPanel::initListCommandsHandlers()
 {
 	mListCommands = getChild<LLPanel>("bottom_panel");
 
-	mListCommands->childSetAction(OPTIONS_BUTTON_NAME, boost::bind(&LLLandmarksPanel::onActionsButtonClick, this));
+	mGearButton = getChild<LLMenuButton>(OPTIONS_BUTTON_NAME);
+	mGearButton->setMouseDownCallback(boost::bind(&LLLandmarksPanel::onActionsButtonClick, this));
+
 	mListCommands->childSetAction(TRASH_BUTTON_NAME, boost::bind(&LLLandmarksPanel::onTrashButtonClick, this));
 
 	LLDragAndDropButton* trash_btn = mListCommands->getChild<LLDragAndDropButton>(TRASH_BUTTON_NAME);
@@ -702,8 +707,8 @@ void LLLandmarksPanel::initListCommandsHandlers()
 	mCommitCallbackRegistrar.add("Places.LandmarksGear.Folding.Action", boost::bind(&LLLandmarksPanel::onFoldingAction, this, _2));
 	mEnableCallbackRegistrar.add("Places.LandmarksGear.Check", boost::bind(&LLLandmarksPanel::isActionChecked, this, _2));
 	mEnableCallbackRegistrar.add("Places.LandmarksGear.Enable", boost::bind(&LLLandmarksPanel::isActionEnabled, this, _2));
-	mGearLandmarkMenu = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>("menu_places_gear_landmark.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
-	mGearFolderMenu = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>("menu_places_gear_folder.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
+	mGearLandmarkMenu = LLUICtrlFactory::getInstance()->createFromFile<LLToggleableMenu>("menu_places_gear_landmark.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
+	mGearFolderMenu = LLUICtrlFactory::getInstance()->createFromFile<LLToggleableMenu>("menu_places_gear_folder.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
 	mMenuAdd = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>("menu_place_add_button.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
 
 	mListCommands->childSetAction(ADD_BUTTON_NAME, boost::bind(&LLLandmarksPanel::showActionMenu, this, mMenuAdd, ADD_BUTTON_NAME));
@@ -722,7 +727,7 @@ void LLLandmarksPanel::updateListCommands()
 
 void LLLandmarksPanel::onActionsButtonClick()
 {
-	LLMenuGL* menu = mGearFolderMenu;
+	LLToggleableMenu* menu = mGearFolderMenu;
 
 	LLFolderViewItem* cur_item = NULL;
 	if(mCurrentSelectedList)
@@ -741,7 +746,7 @@ void LLLandmarksPanel::onActionsButtonClick()
 		}
 	}
 
-	showActionMenu(menu,OPTIONS_BUTTON_NAME);
+	mGearButton->setMenu(menu);
 }
 
 void LLLandmarksPanel::showActionMenu(LLMenuGL* menu, std::string spawning_view_name)
@@ -750,7 +755,10 @@ void LLLandmarksPanel::showActionMenu(LLMenuGL* menu, std::string spawning_view_
 	{
 		menu->buildDrawLabels();
 		menu->updateParent(LLMenuGL::sMenuContainer);
-		LLView* spawning_view = getChild<LLView> (spawning_view_name);
+		menu->arrangeAndClear();
+
+		LLView* spawning_view = getChild<LLView>(spawning_view_name);
+
 		S32 menu_x, menu_y;
 		//show menu in co-ordinates of panel
 		spawning_view->localPointToOtherView(0, spawning_view->getRect().getHeight(), &menu_x, &menu_y, this);
diff --git a/indra/newview/llpanellandmarks.h b/indra/newview/llpanellandmarks.h
index 0d4402d8cb5609ee33766872695f3455ae80d745..8dcbca04406542ff0fc9b96bb416a8641b1b9454 100644
--- a/indra/newview/llpanellandmarks.h
+++ b/indra/newview/llpanellandmarks.h
@@ -39,7 +39,9 @@
 
 class LLAccordionCtrlTab;
 class LLFolderViewItem;
+class LLMenuButton;
 class LLMenuGL;
+class LLToggleableMenu;
 class LLInventoryPanel;
 class LLPlacesInventoryPanel;
 
@@ -155,8 +157,9 @@ class LLLandmarksPanel : public LLPanelPlacesTab, LLRemoteParcelInfoObserver
 	LLPlacesInventoryPanel*		mLandmarksInventoryPanel;
 	LLPlacesInventoryPanel*		mMyInventoryPanel;
 	LLPlacesInventoryPanel*		mLibraryInventoryPanel;
-	LLMenuGL*					mGearLandmarkMenu;
-	LLMenuGL*					mGearFolderMenu;
+	LLMenuButton*				mGearButton;
+	LLToggleableMenu*			mGearLandmarkMenu;
+	LLToggleableMenu*			mGearFolderMenu;
 	LLMenuGL*					mMenuAdd;
 	LLPlacesInventoryPanel*		mCurrentSelectedList;
 	LLInventoryObserver*		mInventoryObserver;
diff --git a/indra/newview/llpanelmaininventory.cpp b/indra/newview/llpanelmaininventory.cpp
index 5b07e4863bb939c736057b2f6c9e6f7f950bff3a..904e3dabcc6adc4f5d59efb8c48f356e813cbd92 100644
--- a/indra/newview/llpanelmaininventory.cpp
+++ b/indra/newview/llpanelmaininventory.cpp
@@ -39,12 +39,14 @@
 #include "llinventorypanel.h"
 #include "llfiltereditor.h"
 #include "llfloaterreg.h"
+#include "llmenubutton.h"
 #include "lloutfitobserver.h"
 #include "llpreviewtexture.h"
 #include "llresmgr.h"
 #include "llscrollcontainer.h"
 #include "llsdserialize.h"
 #include "llspinctrl.h"
+#include "lltoggleablemenu.h"
 #include "lltooldraganddrop.h"
 #include "llviewermenu.h"
 #include "llviewertexturelist.h"
@@ -192,6 +194,8 @@ BOOL LLPanelMainInventory::postBuild()
 		mFilterEditor->setCommitCallback(boost::bind(&LLPanelMainInventory::onFilterEdit, this, _2));
 	}
 
+	mGearMenuButton = getChild<LLMenuButton>("options_gear_btn");
+
 	initListCommandsHandlers();
 
 	// *TODO:Get the cost info from the server
@@ -900,7 +904,6 @@ void LLFloaterInventoryFinder::selectNoTypes(void* user_data)
 
 void LLPanelMainInventory::initListCommandsHandlers()
 {
-	childSetAction("options_gear_btn", boost::bind(&LLPanelMainInventory::onGearButtonClick, this));
 	childSetAction("trash_btn", boost::bind(&LLPanelMainInventory::onTrashButtonClick, this));
 	childSetAction("add_btn", boost::bind(&LLPanelMainInventory::onAddButtonClick, this));
 
@@ -913,7 +916,8 @@ void LLPanelMainInventory::initListCommandsHandlers()
 
 	mCommitCallbackRegistrar.add("Inventory.GearDefault.Custom.Action", boost::bind(&LLPanelMainInventory::onCustomAction, this, _2));
 	mEnableCallbackRegistrar.add("Inventory.GearDefault.Enable", boost::bind(&LLPanelMainInventory::isActionEnabled, this, _2));
-	mMenuGearDefault = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>("menu_inventory_gear_default.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
+	mMenuGearDefault = LLUICtrlFactory::getInstance()->createFromFile<LLToggleableMenu>("menu_inventory_gear_default.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
+	mGearMenuButton->setMenu(mMenuGearDefault);
 	mMenuAdd = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>("menu_inventory_add.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
 
 	// Update the trash button when selected item(s) get worn or taken off.
@@ -927,11 +931,6 @@ void LLPanelMainInventory::updateListCommands()
 	mTrashButton->setEnabled(trash_enabled);
 }
 
-void LLPanelMainInventory::onGearButtonClick()
-{
-	showActionMenu(mMenuGearDefault,"options_gear_btn");
-}
-
 void LLPanelMainInventory::onAddButtonClick()
 {
 	setUploadCostIfNeeded();
diff --git a/indra/newview/llpanelmaininventory.h b/indra/newview/llpanelmaininventory.h
index cf2cc14531fe5ef27cab9f3d434732d014687245..d136e2d32ea686cf7242df0732920ba33f65a1c7 100644
--- a/indra/newview/llpanelmaininventory.h
+++ b/indra/newview/llpanelmaininventory.h
@@ -40,7 +40,9 @@ class LLSaveFolderState;
 class LLFilterEditor;
 class LLTabContainer;
 class LLFloaterInventoryFinder;
+class LLMenuButton;
 class LLMenuGL;
+class LLToggleableMenu;
 class LLFloater;
 
 //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -129,7 +131,6 @@ class LLPanelMainInventory : public LLPanel, LLInventoryObserver
 protected:
 	void initListCommandsHandlers();
 	void updateListCommands();
-	void onGearButtonClick();
 	void onAddButtonClick();
 	void showActionMenu(LLMenuGL* menu, std::string spawning_view_name);
 	void onTrashButtonClick();
@@ -143,8 +144,9 @@ class LLPanelMainInventory : public LLPanel, LLInventoryObserver
 	void setUploadCostIfNeeded();
 private:
 	LLDragAndDropButton*		mTrashButton;
-	LLMenuGL*					mMenuGearDefault;
+	LLToggleableMenu*			mMenuGearDefault;
 	LLMenuGL*					mMenuAdd;
+	LLMenuButton*				mGearMenuButton;
 
 	bool						mNeedUploadCost;
 	// List Commands                                                              //
diff --git a/indra/newview/llpaneloutfitedit.cpp b/indra/newview/llpaneloutfitedit.cpp
index 408d4f29b72a559b63cb2b6a6bd3d66f6a71f96d..ce9b1c66d742462550c0423ae39b784368a10c28 100644
--- a/indra/newview/llpaneloutfitedit.cpp
+++ b/indra/newview/llpaneloutfitedit.cpp
@@ -56,11 +56,13 @@
 #include "llinventorymodel.h"
 #include "llinventorymodelbackgroundfetch.h"
 #include "llloadingindicator.h"
+#include "llmenubutton.h"
 #include "llpaneloutfitsinventory.h"
 #include "lluiconstants.h"
 #include "llsaveoutfitcombobtn.h"
 #include "llscrolllistctrl.h"
 #include "lltextbox.h"
+#include "lltoggleablemenu.h"
 #include "lltrans.h"
 #include "lluictrlfactory.h"
 #include "llsdutil.h"
@@ -151,13 +153,13 @@ std::string LLShopURLDispatcher::resolveURL(LLAssetType::EType asset_type, ESex
 class LLPanelOutfitEditGearMenu
 {
 public:
-	static LLMenuGL* create()
+	static LLToggleableMenu* create()
 	{
 		LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar;
 
 		registrar.add("Wearable.Create", boost::bind(onCreate, _2));
 
-		LLMenuGL* menu = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>(
+		LLToggleableMenu* menu = LLUICtrlFactory::getInstance()->createFromFile<LLToggleableMenu>(
 			"menu_cof_gear.xml", LLMenuGL::sMenuContainer, LLViewerMenuHolderGL::child_registry_t::instance());
 		llassert(menu);
 		if (menu)
@@ -218,7 +220,7 @@ class LLPanelOutfitEditGearMenu
 class LLAddWearablesGearMenu : public LLInitClass<LLAddWearablesGearMenu>
 {
 public:
-	static LLMenuGL* create(LLWearableItemsList* flat_list, LLInventoryPanel* inventory_panel)
+	static LLToggleableMenu* create(LLWearableItemsList* flat_list, LLInventoryPanel* inventory_panel)
 	{
 		LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar;
 		LLUICtrl::EnableCallbackRegistry::ScopedRegistrar enable_registrar;
@@ -233,7 +235,7 @@ class LLAddWearablesGearMenu : public LLInitClass<LLAddWearablesGearMenu>
 		enable_registrar.add("AddWearable.Gear.Check", boost::bind(onCheck, flat_list_handle, inventory_panel_handle, _2));
 		enable_registrar.add("AddWearable.Gear.Visible", boost::bind(onVisible, inventory_panel_handle, _2));
 
-		LLMenuGL* menu = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>(
+		LLToggleableMenu* menu = LLUICtrlFactory::getInstance()->createFromFile<LLToggleableMenu>(
 			"menu_add_wearable_gear.xml",
 			LLMenuGL::sMenuContainer, LLViewerMenuHolderGL::child_registry_t::instance());
 
@@ -404,7 +406,9 @@ LLPanelOutfitEdit::LLPanelOutfitEdit()
 	mFolderViewFilterCmbBox(NULL),
 	mListViewFilterCmbBox(NULL),
 	mWearableListManager(NULL),
-	mPlusBtn(NULL)
+	mPlusBtn(NULL),
+	mWearablesGearMenuBtn(NULL),
+	mGearMenuBtn(NULL)
 {
 	mSavedFolderState = new LLSaveFolderState();
 	mSavedFolderState->setApply(FALSE);
@@ -480,13 +484,14 @@ BOOL LLPanelOutfitEdit::postBuild()
 	childSetCommitCallback("folder_view_btn", boost::bind(&LLPanelOutfitEdit::saveListSelection, this), NULL);
 	childSetCommitCallback("list_view_btn", boost::bind(&LLPanelOutfitEdit::showWearablesListView, this), NULL);
 	childSetCommitCallback("list_view_btn", boost::bind(&LLPanelOutfitEdit::saveListSelection, this), NULL);
-	childSetCommitCallback("wearables_gear_menu_btn", boost::bind(&LLPanelOutfitEdit::onGearButtonClick, this, _1), NULL);
-	childSetCommitCallback("gear_menu_btn", boost::bind(&LLPanelOutfitEdit::onGearButtonClick, this, _1), NULL);
 	childSetCommitCallback("shop_btn_1", boost::bind(&LLPanelOutfitEdit::onShopButtonClicked, this), NULL);
 	childSetCommitCallback("shop_btn_2", boost::bind(&LLPanelOutfitEdit::onShopButtonClicked, this), NULL);
 
 	setVisibleCallback(boost::bind(&LLPanelOutfitEdit::onVisibilityChange, this, _2));
 
+	mWearablesGearMenuBtn = getChild<LLMenuButton>("wearables_gear_menu_btn");
+	mGearMenuBtn = getChild<LLMenuButton>("gear_menu_btn");
+
 	mCOFWearables = findChild<LLCOFWearables>("cof_wearables_list");
 	mCOFWearables->setCommitCallback(boost::bind(&LLPanelOutfitEdit::filterWearablesBySelectedItem, this));
 
@@ -559,6 +564,13 @@ BOOL LLPanelOutfitEdit::postBuild()
 
 	mWearableItemsList->setComparator(mWearableListViewItemsComparator);
 
+	// Creating "Add Wearables" panel gear menu after initialization of mWearableItemsList and mInventoryItemsPanel.
+	mAddWearablesGearMenu = LLAddWearablesGearMenu::create(mWearableItemsList, mInventoryItemsPanel);
+	mWearablesGearMenuBtn->setMenu(mAddWearablesGearMenu);
+
+	mGearMenu = LLPanelOutfitEditGearMenu::create();
+	mGearMenuBtn->setMenu(mGearMenu);
+
 	mSaveComboBtn.reset(new LLSaveOutfitComboBtn(this));
 	return TRUE;
 }
@@ -1258,37 +1270,6 @@ void LLPanelOutfitEdit::resetAccordionState()
 	}
 }
 
-void LLPanelOutfitEdit::onGearButtonClick(LLUICtrl* clicked_button)
-{
-	LLMenuGL* menu = NULL;
-
-	if (mAddWearablesPanel->getVisible())
-	{
-		if (!mAddWearablesGearMenu)
-		{
-			mAddWearablesGearMenu = LLAddWearablesGearMenu::create(mWearableItemsList, mInventoryItemsPanel);
-		}
-
-		menu = mAddWearablesGearMenu;
-	}
-	else
-	{
-		if (!mGearMenu)
-		{
-			mGearMenu = LLPanelOutfitEditGearMenu::create();
-		}
-
-		menu = mGearMenu;
-	}
-
-	if (!menu) return;
-
-	menu->arrangeAndClear(); // update menu height
-	S32 menu_y = menu->getRect().getHeight() + clicked_button->getRect().getHeight();
-	menu->buildDrawLabels();
-	LLMenuGL::showPopup(clicked_button, menu, 0, menu_y);
-}
-
 void LLPanelOutfitEdit::onAddMoreButtonClicked()
 {
 	toggleAddWearablesPanel();
diff --git a/indra/newview/llpaneloutfitedit.h b/indra/newview/llpaneloutfitedit.h
index 2dca986e330b84a901075494a84e8f482f83179c..fd366e9cbce518e6e029305d7adc46a26ac82255 100644
--- a/indra/newview/llpaneloutfitedit.h
+++ b/indra/newview/llpaneloutfitedit.h
@@ -54,6 +54,7 @@ class LLScrollListCtrl;
 class LLToggleableMenu;
 class LLFilterEditor;
 class LLFilteredWearableListManager;
+class LLMenuButton;
 class LLMenuGL;
 class LLFindNonLinksByMask;
 class LLFindWearablesOfType;
@@ -186,8 +187,6 @@ class LLPanelOutfitEdit : public LLPanel
 									  std::string& tooltip_msg);
 
 private:
-
-	void onGearButtonClick(LLUICtrl* clicked_button);
 	void onAddMoreButtonClicked();
 	void showFilteredWearablesListView(LLWearableType::EType type);
 	void onOutfitChanging(bool started);
@@ -234,12 +233,12 @@ class LLPanelOutfitEdit : public LLPanel
 	std::vector<LLFilterItem*> mListViewItemTypes;
 
 	LLCOFWearables*		mCOFWearables;
-	LLMenuGL*			mGearMenu;
-	LLMenuGL*			mAddWearablesGearMenu;
+	LLToggleableMenu*	mGearMenu;
+	LLToggleableMenu*	mAddWearablesGearMenu;
 	bool				mInitialized;
 	std::auto_ptr<LLSaveOutfitComboBtn> mSaveComboBtn;
-
-
+	LLMenuButton*		mWearablesGearMenuBtn;
+	LLMenuButton*		mGearMenuBtn;
 
 };
 
diff --git a/indra/newview/llpaneloutfitsinventory.cpp b/indra/newview/llpaneloutfitsinventory.cpp
index d6d8a38ebef146495a1528e089cf500b5a280e36..a90f864ae2700207b99e65cd0d869084b931a4eb 100644
--- a/indra/newview/llpaneloutfitsinventory.cpp
+++ b/indra/newview/llpaneloutfitsinventory.cpp
@@ -232,9 +232,7 @@ void LLPanelOutfitsInventory::initListCommandsHandlers()
 {
 	mListCommands = getChild<LLPanel>("bottom_panel");
 	mListCommands->childSetAction("wear_btn", boost::bind(&LLPanelOutfitsInventory::onWearButtonClick, this));
-	mMyOutfitsPanel->childSetAction("options_gear_btn", boost::bind(&LLPanelOutfitsInventory::showGearMenu, this));
 	mMyOutfitsPanel->childSetAction("trash_btn", boost::bind(&LLPanelOutfitsInventory::onTrashButtonClick, this));
-	mCurrentOutfitPanel->childSetAction("options_gear_btn", boost::bind(&LLPanelOutfitsInventory::showGearMenu, this));
 }
 
 void LLPanelOutfitsInventory::updateListCommands()
@@ -258,27 +256,9 @@ void LLPanelOutfitsInventory::updateListCommands()
 	}
 }
 
-void LLPanelOutfitsInventory::showGearMenu()
-{
-	if (!mActivePanel) return;
-
-	LLView* spawning_view = getChild<LLView>("options_gear_btn");
-	mActivePanel->showGearMenu(spawning_view);
-}
-
 void LLPanelOutfitsInventory::onTrashButtonClick()
 {
-	LLNotificationsUtil::add("DeleteOutfits", LLSD(), LLSD(), boost::bind(&LLPanelOutfitsInventory::onOutfitsRemovalConfirmation, this, _1, _2));
-}
-
-void LLPanelOutfitsInventory::onOutfitsRemovalConfirmation(const LLSD& notification, const LLSD& response)
-{
-	S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
-	if (option != 0) return; // canceled
-
 	mMyOutfitsPanel->removeSelected();
-	updateListCommands();
-	updateVerbs();
 }
 
 bool LLPanelOutfitsInventory::isActionEnabled(const LLSD& userdata)
diff --git a/indra/newview/llpaneloutfitsinventory.h b/indra/newview/llpaneloutfitsinventory.h
index f1ca1dbfeb20b48787dfcda47a96b82fd331ecc6..a7917b457c95934671c3aeadd407fe9821f82d86 100644
--- a/indra/newview/llpaneloutfitsinventory.h
+++ b/indra/newview/llpaneloutfitsinventory.h
@@ -89,7 +89,6 @@ class LLPanelOutfitsInventory : public LLPanel
 	void onWearButtonClick();
 	void showGearMenu();
 	void onTrashButtonClick();
-	void onOutfitsRemovalConfirmation(const LLSD& notification, const LLSD& response);
 	bool isActionEnabled(const LLSD& userdata);
 	void setWearablesLoading(bool val);
 	void onWearablesLoaded();
diff --git a/indra/newview/llpanelpeople.cpp b/indra/newview/llpanelpeople.cpp
index 040b5319b934f411b3eb65d0cef4d3bb9d064886..71c812efe25229a9c6fa2184d67c2ae2c9278c44 100644
--- a/indra/newview/llpanelpeople.cpp
+++ b/indra/newview/llpanelpeople.cpp
@@ -29,11 +29,13 @@
 // libs
 #include "llavatarname.h"
 #include "llfloaterreg.h"
+#include "llmenubutton.h"
 #include "llmenugl.h"
 #include "llnotificationsutil.h"
 #include "lleventtimer.h"
 #include "llfiltereditor.h"
 #include "lltabcontainer.h"
+#include "lltoggleablemenu.h"
 #include "lluictrlfactory.h"
 
 #include "llpanelpeople.h"
@@ -464,7 +466,11 @@ LLPanelPeople::LLPanelPeople()
 		mAllFriendList(NULL),
 		mNearbyList(NULL),
 		mRecentList(NULL),
-		mGroupList(NULL)
+		mGroupList(NULL),
+		mNearbyGearButton(NULL),
+		mFriendsGearButton(NULL),
+		mGroupsGearButton(NULL),
+		mRecentGearButton(NULL)
 {
 	mFriendListUpdater = new LLFriendListUpdater(boost::bind(&LLPanelPeople::updateFriendList,	this));
 	mNearbyListUpdater = new LLNearbyListUpdater(boost::bind(&LLPanelPeople::updateNearbyList,	this));
@@ -600,11 +606,6 @@ BOOL LLPanelPeople::postBuild()
 	buttonSetAction("teleport_btn",		boost::bind(&LLPanelPeople::onTeleportButtonClicked,	this));
 	buttonSetAction("share_btn",		boost::bind(&LLPanelPeople::onShareButtonClicked,		this));
 
-	getChild<LLPanel>(NEARBY_TAB_NAME)->childSetAction("nearby_view_sort_btn",boost::bind(&LLPanelPeople::onNearbyViewSortButtonClicked,		this));
-	getChild<LLPanel>(RECENT_TAB_NAME)->childSetAction("recent_viewsort_btn",boost::bind(&LLPanelPeople::onRecentViewSortButtonClicked,			this));
-	getChild<LLPanel>(FRIENDS_TAB_NAME)->childSetAction("friends_viewsort_btn",boost::bind(&LLPanelPeople::onFriendsViewSortButtonClicked,		this));
-	getChild<LLPanel>(GROUP_TAB_NAME)->childSetAction("groups_viewsort_btn",boost::bind(&LLPanelPeople::onGroupsViewSortButtonClicked,		this));
-
 	// Must go after setting commit callback and initializing all pointers to children.
 	mTabContainer->selectTabByName(NEARBY_TAB_NAME);
 
@@ -624,24 +625,41 @@ BOOL LLPanelPeople::postBuild()
 	enable_registrar.add("People.Recent.ViewSort.CheckItem",	boost::bind(&LLPanelPeople::onRecentViewSortMenuItemCheck,	this, _2));
 	enable_registrar.add("People.Nearby.ViewSort.CheckItem",	boost::bind(&LLPanelPeople::onNearbyViewSortMenuItemCheck,	this, _2));
 
+	mNearbyGearButton = getChild<LLMenuButton>("nearby_view_sort_btn");
+	mFriendsGearButton = getChild<LLMenuButton>("friends_viewsort_btn");
+	mGroupsGearButton = getChild<LLMenuButton>("groups_viewsort_btn");
+	mRecentGearButton = getChild<LLMenuButton>("recent_viewsort_btn");
+
 	LLMenuGL* plus_menu  = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>("menu_group_plus.xml",  gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
 	mGroupPlusMenuHandle  = plus_menu->getHandle();
 
-	LLMenuGL* nearby_view_sort  = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>("menu_people_nearby_view_sort.xml",  gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
+	LLToggleableMenu* nearby_view_sort  = LLUICtrlFactory::getInstance()->createFromFile<LLToggleableMenu>("menu_people_nearby_view_sort.xml",  gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
 	if(nearby_view_sort)
+	{
 		mNearbyViewSortMenuHandle  = nearby_view_sort->getHandle();
+		mNearbyGearButton->setMenu(nearby_view_sort);
+	}
 
-	LLMenuGL* friend_view_sort  = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>("menu_people_friends_view_sort.xml",  gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
+	LLToggleableMenu* friend_view_sort  = LLUICtrlFactory::getInstance()->createFromFile<LLToggleableMenu>("menu_people_friends_view_sort.xml",  gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
 	if(friend_view_sort)
+	{
 		mFriendsViewSortMenuHandle  = friend_view_sort->getHandle();
+		mFriendsGearButton->setMenu(friend_view_sort);
+	}
 
-	LLMenuGL* group_view_sort  = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>("menu_people_groups_view_sort.xml",  gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
+	LLToggleableMenu* group_view_sort  = LLUICtrlFactory::getInstance()->createFromFile<LLToggleableMenu>("menu_people_groups_view_sort.xml",  gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
 	if(group_view_sort)
+	{
 		mGroupsViewSortMenuHandle  = group_view_sort->getHandle();
+		mGroupsGearButton->setMenu(group_view_sort);
+	}
 
-	LLMenuGL* recent_view_sort  = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>("menu_people_recent_view_sort.xml",  gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
+	LLToggleableMenu* recent_view_sort  = LLUICtrlFactory::getInstance()->createFromFile<LLToggleableMenu>("menu_people_recent_view_sort.xml",  gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
 	if(recent_view_sort)
+	{
 		mRecentViewSortMenuHandle  = recent_view_sort->getHandle();
+		mRecentGearButton->setMenu(recent_view_sort);
+	}
 
 	LLVoiceClient::getInstance()->addObserver(this);
 
@@ -911,7 +929,7 @@ void LLPanelPeople::showGroupMenu(LLMenuGL* menu)
 
 	// Calculate its coordinates.
 	// (assumes that groups panel is the current tab)
-	LLPanel* bottom_panel = mTabContainer->getCurrentPanel()->getChild<LLPanel>("bottom_panel"); 
+	LLPanel* bottom_panel = mTabContainer->getCurrentPanel()->getChild<LLPanel>("bottom_panel");
 	LLPanel* parent_panel = mTabContainer->getCurrentPanel();
 	menu->arrangeAndClear();
 	S32 menu_height = menu->getRect().getHeight();
@@ -1346,38 +1364,6 @@ void LLPanelPeople::onMoreButtonClicked()
 	// *TODO: not implemented yet
 }
 
-void LLPanelPeople::onFriendsViewSortButtonClicked()
-{
-	LLMenuGL* menu = (LLMenuGL*)mFriendsViewSortMenuHandle.get();
-	if (!menu)
-		return;
-	showGroupMenu(menu);
-}
-
-void LLPanelPeople::onGroupsViewSortButtonClicked()
-{
-	LLMenuGL* menu = (LLMenuGL*)mGroupsViewSortMenuHandle.get();
-	if (!menu)
-		return;
-	showGroupMenu(menu);
-}
-
-void LLPanelPeople::onRecentViewSortButtonClicked()
-{
-	LLMenuGL* menu = (LLMenuGL*)mRecentViewSortMenuHandle.get();
-	if (!menu)
-		return;
-	showGroupMenu(menu);
-}
-
-void LLPanelPeople::onNearbyViewSortButtonClicked()
-{
-	LLMenuGL* menu = (LLMenuGL*)mNearbyViewSortMenuHandle.get();
-	if (!menu)
-		return;
-	showGroupMenu(menu);
-}
-
 void	LLPanelPeople::onOpen(const LLSD& key)
 {
 	std::string tab_name = key["people_panel_tab_name"];
diff --git a/indra/newview/llpanelpeople.h b/indra/newview/llpanelpeople.h
index f5ff09b0380529a4781174eef67f094504078934..4412aed0628b2aab30c266a22b088d0b4d73eb5e 100644
--- a/indra/newview/llpanelpeople.h
+++ b/indra/newview/llpanelpeople.h
@@ -36,6 +36,7 @@ class LLAvatarList;
 class LLAvatarName;
 class LLFilterEditor;
 class LLGroupList;
+class LLMenuButton;
 class LLTabContainer;
 
 class LLPanelPeople 
@@ -101,10 +102,6 @@ class LLPanelPeople
 	void					onShareButtonClicked();
 	void					onMoreButtonClicked();
 	void					onActivateButtonClicked();
-	void					onRecentViewSortButtonClicked();
-	void					onNearbyViewSortButtonClicked();
-	void					onFriendsViewSortButtonClicked();
-	void					onGroupsViewSortButtonClicked();
 	void					onAvatarListDoubleClicked(LLUICtrl* ctrl);
 	void					onAvatarListCommitted(LLAvatarList* list);
 	void					onGroupPlusButtonClicked();
@@ -156,6 +153,11 @@ class LLPanelPeople
 	Updater*				mNearbyListUpdater;
 	Updater*				mRecentListUpdater;
 
+	LLMenuButton*			mNearbyGearButton;
+	LLMenuButton*			mFriendsGearButton;
+	LLMenuButton*			mGroupsGearButton;
+	LLMenuButton*			mRecentGearButton;
+
 	std::string				mFilterSubString;
 	std::string				mFilterSubStringOrig;
 };
diff --git a/indra/newview/llpanelteleporthistory.cpp b/indra/newview/llpanelteleporthistory.cpp
index 9b8167b15a687294698b3171d3573f7e2b29b3e1..fff8ccb912b04b14b265d24cba6375a1571171df 100644
--- a/indra/newview/llpanelteleporthistory.cpp
+++ b/indra/newview/llpanelteleporthistory.cpp
@@ -27,6 +27,7 @@
 #include "llviewerprecompiledheaders.h"
 
 #include "llfloaterreg.h"
+#include "llmenubutton.h"
 
 #include "llfloaterworldmap.h"
 #include "llpanelteleporthistory.h"
@@ -40,6 +41,7 @@
 #include "llflatlistview.h"
 #include "llnotificationsutil.h"
 #include "lltextbox.h"
+#include "lltoggleablemenu.h"
 #include "llviewermenu.h"
 #include "lllandmarkactions.h"
 #include "llclipboard.h"
@@ -375,7 +377,8 @@ LLTeleportHistoryPanel::LLTeleportHistoryPanel()
 		mHistoryAccordion(NULL),
 		mAccordionTabMenu(NULL),
 		mLastSelectedFlatlList(NULL),
-		mLastSelectedItemIndex(-1)
+		mLastSelectedItemIndex(-1),
+		mMenuGearButton(NULL)
 {
 	buildFromFile( "panel_teleport_history.xml");
 }
@@ -439,8 +442,6 @@ BOOL LLTeleportHistoryPanel::postBuild()
 		}
 	}
 
-	getChild<LLPanel>("bottom_panel")->childSetAction("gear_btn",boost::bind(&LLTeleportHistoryPanel::onGearButtonClicked, this));
-
 	LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar;
 
 	registrar.add("TeleportHistory.ExpandAllFolders",  boost::bind(&LLTeleportHistoryPanel::onExpandAllFolders,  this));
@@ -448,9 +449,14 @@ BOOL LLTeleportHistoryPanel::postBuild()
 	registrar.add("TeleportHistory.ClearTeleportHistory",  boost::bind(&LLTeleportHistoryPanel::onClearTeleportHistory,  this));
 	mEnableCallbackRegistrar.add("TeleportHistory.GearMenu.Enable", boost::bind(&LLTeleportHistoryPanel::isActionEnabled, this, _2));
 
-	LLMenuGL* gear_menu  = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>("menu_teleport_history_gear.xml",  gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
+	mMenuGearButton = getChild<LLMenuButton>("gear_btn");
+
+	LLToggleableMenu* gear_menu  = LLUICtrlFactory::getInstance()->createFromFile<LLToggleableMenu>("menu_teleport_history_gear.xml",  gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());;
 	if(gear_menu)
+	{
 		mGearMenuHandle  = gear_menu->getHandle();
+		mMenuGearButton->setMenu(gear_menu);
+	}
 
 	return TRUE;
 }
@@ -985,27 +991,6 @@ LLFlatListView* LLTeleportHistoryPanel::getFlatListViewFromTab(LLAccordionCtrlTa
 	return NULL;
 }
 
-void LLTeleportHistoryPanel::onGearButtonClicked()
-{
-	LLMenuGL* menu = (LLMenuGL*)mGearMenuHandle.get();
-	if (!menu)
-		return;
-
-	// Shows the menu at the top of the button bar.
-
-	// Calculate its coordinates.
-	LLPanel* bottom_panel = getChild<LLPanel>("bottom_panel");
-	menu->arrangeAndClear();
-	S32 menu_height = menu->getRect().getHeight();
-	S32 menu_x = -2; // *HACK: compensates HPAD in showPopup()
-	S32 menu_y = bottom_panel->getRect().mTop + menu_height;
-
-	// Actually show the menu.
-	menu->buildDrawLabels();
-	menu->updateParent(LLMenuGL::sMenuContainer);
-	LLMenuGL::showPopup(this, menu, menu_x, menu_y);
-}
-
 bool LLTeleportHistoryPanel::isActionEnabled(const LLSD& userdata) const
 {
 	S32 tabs_cnt = mItemContainers.size();
diff --git a/indra/newview/llpanelteleporthistory.h b/indra/newview/llpanelteleporthistory.h
index b5a025b39bcedf200387cac4a2cecc59d53879f0..3d29454d1538cd84159aeaf27b722e5b62231830 100644
--- a/indra/newview/llpanelteleporthistory.h
+++ b/indra/newview/llpanelteleporthistory.h
@@ -38,6 +38,7 @@ class LLTeleportHistoryStorage;
 class LLAccordionCtrl;
 class LLAccordionCtrlTab;
 class LLFlatListView;
+class LLMenuButton;
 
 class LLTeleportHistoryPanel : public LLPanelPlacesTab
 {
@@ -94,7 +95,6 @@ class LLTeleportHistoryPanel : public LLPanelPlacesTab
 	void showTeleportHistory();
 	void handleItemSelect(LLFlatListView* );
 	LLFlatListView* getFlatListViewFromTab(LLAccordionCtrlTab *);
-	void onGearButtonClicked();
 	bool isActionEnabled(const LLSD& userdata) const;
 
 	void setAccordionCollapsedByUser(LLUICtrl* acc_tab, bool collapsed);
@@ -118,6 +118,7 @@ class LLTeleportHistoryPanel : public LLPanelPlacesTab
 	ContextMenu mContextMenu;
 	LLContextMenu*			mAccordionTabMenu;
 	LLHandle<LLView>		mGearMenuHandle;
+	LLMenuButton*			mMenuGearButton;
 };
 
 
diff --git a/indra/newview/llpanelwearing.cpp b/indra/newview/llpanelwearing.cpp
index 860470cd73ee55829c3bd19b96b1a98531191677..911a9e5ddadf064773f4c9ab943ef6ae8d3c5287 100644
--- a/indra/newview/llpanelwearing.cpp
+++ b/indra/newview/llpanelwearing.cpp
@@ -28,10 +28,13 @@
 
 #include "llpanelwearing.h"
 
+#include "lltoggleablemenu.h"
+
 #include "llappearancemgr.h"
 #include "llinventoryfunctions.h"
 #include "llinventorymodel.h"
 #include "llinventoryobserver.h"
+#include "llmenubutton.h"
 #include "llsidetray.h"
 #include "llviewermenu.h"
 #include "llwearableitemslist.h"
@@ -58,21 +61,12 @@ class LLWearingGearMenu
 
 		enable_registrar.add("Gear.OnEnable", boost::bind(&LLPanelWearing::isActionEnabled, mPanelWearing, _2));
 
-		mMenu = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>(
+		mMenu = LLUICtrlFactory::getInstance()->createFromFile<LLToggleableMenu>(
 			"menu_wearing_gear.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
 		llassert(mMenu);
 	}
 
-	void show(LLView* spawning_view)
-	{
-		if (!mMenu) return;
-
-		mMenu->buildDrawLabels();
-		mMenu->updateParent(LLMenuGL::sMenuContainer);
-		S32 menu_x = 0;
-		S32 menu_y = spawning_view->getRect().getHeight() + mMenu->getRect().getHeight();
-		LLMenuGL::showPopup(spawning_view, mMenu, menu_x, menu_y);
-	}
+	LLToggleableMenu* getMenu() { return mMenu; }
 
 private:
 
@@ -87,8 +81,8 @@ class LLWearingGearMenu
 		}
 	}
 
-	LLMenuGL*		mMenu;
-	LLPanelWearing* mPanelWearing;
+	LLToggleableMenu*		mMenu;
+	LLPanelWearing* 		mPanelWearing;
 };
 
 //////////////////////////////////////////////////////////////////////////
@@ -189,6 +183,10 @@ BOOL LLPanelWearing::postBuild()
 	mCOFItemsList = getChild<LLWearableItemsList>("cof_items_list");
 	mCOFItemsList->setRightMouseDownCallback(boost::bind(&LLPanelWearing::onWearableItemsListRightClick, this, _1, _2, _3));
 
+	LLMenuButton* menu_gear_btn = getChild<LLMenuButton>("options_gear_btn");
+
+	menu_gear_btn->setMenu(mGearMenu->getMenu());
+
 	return TRUE;
 }
 
@@ -253,13 +251,6 @@ bool LLPanelWearing::isActionEnabled(const LLSD& userdata)
 	return false;
 }
 
-// virtual
-void LLPanelWearing::showGearMenu(LLView* spawning_view)
-{
-	if (!mGearMenu) return;
-	mGearMenu->show(spawning_view);
-}
-
 boost::signals2::connection LLPanelWearing::setSelectionChangeCallback(commit_callback_t cb)
 {
 	if (!mCOFItemsList) return boost::signals2::connection();
diff --git a/indra/newview/llpanelwearing.h b/indra/newview/llpanelwearing.h
index 1fa97735b1b6d35e491db0fba7df2d0ad354fd95..157b2c4c5f0ed35c5d063377897cffa1cdfc7ae3 100644
--- a/indra/newview/llpanelwearing.h
+++ b/indra/newview/llpanelwearing.h
@@ -58,8 +58,6 @@ class LLPanelWearing : public LLPanelAppearanceTab
 
 	/*virtual*/ bool isActionEnabled(const LLSD& userdata);
 
-	/*virtual*/ void showGearMenu(LLView* spawning_view);
-
 	/*virtual*/ void getSelectedItemsUUIDs(uuid_vec_t& selected_uuids) const;
 
 	boost::signals2::connection setSelectionChangeCallback(commit_callback_t cb);
diff --git a/indra/newview/llparticipantlist.cpp b/indra/newview/llparticipantlist.cpp
index 01b3b5572e3477eb8800321edd550e9f512a56e9..54053cf89f4d0a2d1a7142314bb6308d9569d136 100644
--- a/indra/newview/llparticipantlist.cpp
+++ b/indra/newview/llparticipantlist.cpp
@@ -197,17 +197,20 @@ class LLAvalineUpdater : public LLVoiceClientParticipantObserver
 	uuid_set_t mAvalineCallers;
 };
 
-LLParticipantList::LLParticipantList(LLSpeakerMgr* data_source, LLAvatarList* avatar_list,  bool use_context_menu/* = true*/,
-		bool exclude_agent /*= true*/, bool can_toggle_icons /*= true*/):
+LLParticipantList::LLParticipantList(LLSpeakerMgr* data_source, 
+									 LLAvatarList* avatar_list,
+									 bool use_context_menu/* = true*/,
+									 bool exclude_agent /*= true*/, 
+									 bool can_toggle_icons /*= true*/) :
 	mSpeakerMgr(data_source),
 	mAvatarList(avatar_list),
-	mSortOrder(E_SORT_BY_NAME)
-,	mParticipantListMenu(NULL)
-,	mExcludeAgent(exclude_agent)
-,	mValidateSpeakerCallback(NULL)
+	mParticipantListMenu(NULL),
+	mExcludeAgent(exclude_agent),
+	mValidateSpeakerCallback(NULL)
 {
+
 	mAvalineUpdater = new LLAvalineUpdater(boost::bind(&LLParticipantList::onAvalineCallerFound, this, _1),
-		boost::bind(&LLParticipantList::onAvalineCallerRemoved, this, _1));
+										   boost::bind(&LLParticipantList::onAvalineCallerRemoved, this, _1));
 
 	mSpeakerAddListener = new SpeakerAddListener(*this);
 	mSpeakerRemoveListener = new SpeakerRemoveListener(*this);
@@ -393,15 +396,15 @@ void LLParticipantList::onAvatarListRefreshed(LLUICtrl* ctrl, const LLSD& param)
 }
 
 /*
-Seems this method is not necessary after onAvalineCallerRemoved was implemented;
+  Seems this method is not necessary after onAvalineCallerRemoved was implemented;
 
-It does nothing because list item is always created with correct class type for Avaline caller.
-For now Avaline Caller is removed from the LLSpeakerMgr List when it is removed from the Voice Client
-session.
-This happens in two cases: if Avaline Caller ends call itself or if Resident ends group call.
+  It does nothing because list item is always created with correct class type for Avaline caller.
+  For now Avaline Caller is removed from the LLSpeakerMgr List when it is removed from the Voice Client
+  session.
+  This happens in two cases: if Avaline Caller ends call itself or if Resident ends group call.
 
-Probably Avaline caller should be removed from the LLSpeakerMgr list ONLY if it ends call itself.
-Asked in EXT-4301.
+  Probably Avaline caller should be removed from the LLSpeakerMgr list ONLY if it ends call itself.
+  Asked in EXT-4301.
 */
 void LLParticipantList::onAvalineCallerFound(const LLUUID& participant_id)
 {
@@ -443,16 +446,19 @@ void LLParticipantList::onAvalineCallerRemoved(const LLUUID& participant_id)
 
 void LLParticipantList::setSortOrder(EParticipantSortOrder order)
 {
-	if ( mSortOrder != order )
+	const U32 speaker_sort_order = gSavedSettings.getU32("SpeakerParticipantDefaultOrder");
+
+	if ( speaker_sort_order != order )
 	{
-		mSortOrder = order;
+		gSavedSettings.setU32("SpeakerParticipantDefaultOrder", (U32)order);
 		sort();
 	}
 }
 
-LLParticipantList::EParticipantSortOrder LLParticipantList::getSortOrder()
+const LLParticipantList::EParticipantSortOrder LLParticipantList::getSortOrder() const
 {
-	return mSortOrder;
+	const U32 speaker_sort_order = gSavedSettings.getU32("SpeakerParticipantDefaultOrder");
+	return EParticipantSortOrder(speaker_sort_order);
 }
 
 void LLParticipantList::setValidateSpeakerCallback(validate_speaker_callback_t cb)
@@ -551,28 +557,29 @@ void LLParticipantList::sort()
 	if ( !mAvatarList )
 		return;
 
-	switch ( mSortOrder ) {
-	case E_SORT_BY_NAME :
-		// if mExcludeAgent == true , then no need to keep agent on top of the list
-		if(mExcludeAgent)
-		{
-			mAvatarList->sortByName();
-		}
-		else
-		{
-			mAvatarList->setComparator(&AGENT_ON_TOP_NAME_COMPARATOR);
+	switch ( getSortOrder() ) 
+	{
+		case E_SORT_BY_NAME :
+			// if mExcludeAgent == true , then no need to keep agent on top of the list
+			if(mExcludeAgent)
+			{
+				mAvatarList->sortByName();
+			}
+			else
+			{
+				mAvatarList->setComparator(&AGENT_ON_TOP_NAME_COMPARATOR);
+				mAvatarList->sort();
+			}
+			break;
+		case E_SORT_BY_RECENT_SPEAKERS:
+			if (mSortByRecentSpeakers.isNull())
+				mSortByRecentSpeakers = new LLAvatarItemRecentSpeakerComparator(*this);
+			mAvatarList->setComparator(mSortByRecentSpeakers.get());
 			mAvatarList->sort();
-		}
-		break;
-	case E_SORT_BY_RECENT_SPEAKERS:
-		if (mSortByRecentSpeakers.isNull())
-			mSortByRecentSpeakers = new LLAvatarItemRecentSpeakerComparator(*this);
-		mAvatarList->setComparator(mSortByRecentSpeakers.get());
-		mAvatarList->sort();
-		break;
-	default :
-		llwarns << "Unrecognized sort order for " << mAvatarList->getName() << llendl;
-		return;
+			break;
+		default :
+			llwarns << "Unrecognized sort order for " << mAvatarList->getName() << llendl;
+			return;
 	}
 }
 
@@ -645,7 +652,7 @@ bool LLParticipantList::SpeakerClearListener::handleEvent(LLPointer<LLOldEvents:
 //
 bool LLParticipantList::SpeakerModeratorUpdateListener::handleEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata)
 {
-		return mParent.onModeratorUpdateEvent(event, userdata);
+	return mParent.onModeratorUpdateEvent(event, userdata);
 }
 
 bool LLParticipantList::SpeakerMuteListener::handleEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata)
@@ -867,7 +874,7 @@ void LLParticipantList::LLParticipantListMenu::confirmMuteAllCallback(const LLSD
 	const LLUUID& session_id = payload["session_id"];
 
 	LLIMSpeakerMgr * speaker_manager = dynamic_cast<LLIMSpeakerMgr*> (
-			LLIMModel::getInstance()->getSpeakerManager(session_id));
+		LLIMModel::getInstance()->getSpeakerManager(session_id));
 	if (speaker_manager)
 	{
 		speaker_manager->moderateVoiceAllParticipants(false);
@@ -925,9 +932,9 @@ bool LLParticipantList::LLParticipantListMenu::enableContextMenuItem(const LLSD&
 }
 
 /*
-Processed menu items with such parameters:
-	can_allow_text_chat
-	can_moderate_voice
+  Processed menu items with such parameters:
+  can_allow_text_chat
+  can_moderate_voice
 */
 bool LLParticipantList::LLParticipantListMenu::enableModerateContextMenuItem(const LLSD& userdata)
 {
@@ -978,11 +985,11 @@ bool LLParticipantList::LLParticipantListMenu::checkContextMenuItem(const LLSD&
 	}
 	else if(item == "is_sorted_by_name")
 	{
-		return E_SORT_BY_NAME == mParent.mSortOrder;
+		return E_SORT_BY_NAME == mParent.getSortOrder();
 	}
 	else if(item == "is_sorted_by_recent_speakers")
 	{
-		return E_SORT_BY_RECENT_SPEAKERS == mParent.mSortOrder;
+		return E_SORT_BY_RECENT_SPEAKERS == mParent.getSortOrder();
 	}
 
 	return false;
diff --git a/indra/newview/llparticipantlist.h b/indra/newview/llparticipantlist.h
index 722a749d19de30f3d40fa895c97b930a7a0b0e58..e0b3d42c25d9229a21f44aa5e4e22323f9a7370a 100644
--- a/indra/newview/llparticipantlist.h
+++ b/indra/newview/llparticipantlist.h
@@ -24,6 +24,9 @@
  * $/LicenseInfo$
  */
 
+#ifndef LL_PARTICIPANTLIST_H
+#define LL_PARTICIPANTLIST_H
+
 #include "llviewerprecompiledheaders.h"
 #include "llevent.h"
 #include "llavatarlist.h" // for LLAvatarItemRecentSpeakerComparator
@@ -37,239 +40,247 @@ class LLAvalineUpdater;
 class LLParticipantList
 {
 	LOG_CLASS(LLParticipantList);
+public:
+
+	typedef boost::function<bool (const LLUUID& speaker_id)> validate_speaker_callback_t;
+
+	LLParticipantList(LLSpeakerMgr* data_source, 
+					  LLAvatarList* avatar_list, 
+					  bool use_context_menu = true, 
+					  bool exclude_agent = true, 
+					  bool can_toggle_icons = true);
+	~LLParticipantList();
+	void setSpeakingIndicatorsVisible(BOOL visible);
+
+	enum EParticipantSortOrder
+	{
+		E_SORT_BY_NAME = 0,
+		E_SORT_BY_RECENT_SPEAKERS = 1,
+	};
+
+	/**
+	 * Adds specified avatar ID to the existing list if it is not Agent's ID
+	 *
+	 * @param[in] avatar_id - Avatar UUID to be added into the list
+	 */
+	void addAvatarIDExceptAgent(const LLUUID& avatar_id);
+
+	/**
+	 * Set and sort Avatarlist by given order
+	 */
+	void setSortOrder(EParticipantSortOrder order = E_SORT_BY_NAME);
+	const EParticipantSortOrder getSortOrder() const;
+
+	/**
+	 * Refreshes the participant list if it's in sort by recent speaker order.
+	 */
+	void updateRecentSpeakersOrder();
+
+	/**
+	 * Set a callback to be called before adding a speaker. Invalid speakers will not be added.
+	 *
+	 * If the callback is unset all speakers are considered as valid.
+	 *
+	 * @see onAddItemEvent()
+	 */
+	void setValidateSpeakerCallback(validate_speaker_callback_t cb);
+
+protected:
+	/**
+	 * LLSpeakerMgr event handlers
+	 */
+	bool onAddItemEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata);
+	bool onRemoveItemEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata);
+	bool onClearListEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata);
+	bool onModeratorUpdateEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata);
+	bool onSpeakerMuteEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata);
+
+	/**
+	 * Sorts the Avatarlist by stored order
+	 */
+	void sort();
+
+	/**
+	 * List of listeners implementing LLOldEvents::LLSimpleListener.
+	 * There is no way to handle all the events in one listener as LLSpeakerMgr registers
+	 * listeners in such a way that one listener can handle only one type of event
+	 **/
+	class BaseSpeakerListener : public LLOldEvents::LLSimpleListener
+	{
 	public:
+		BaseSpeakerListener(LLParticipantList& parent) : mParent(parent) {}
+	protected:
+		LLParticipantList& mParent;
+	};
 
-		typedef boost::function<bool (const LLUUID& speaker_id)> validate_speaker_callback_t;
-
-		LLParticipantList(LLSpeakerMgr* data_source, LLAvatarList* avatar_list, bool use_context_menu = true, bool exclude_agent = true, bool can_toggle_icons = true);
-		~LLParticipantList();
-		void setSpeakingIndicatorsVisible(BOOL visible);
-
-		typedef enum e_participant_sort_oder {
-			E_SORT_BY_NAME = 0,
-			E_SORT_BY_RECENT_SPEAKERS = 1,
-		} EParticipantSortOrder;
+	class SpeakerAddListener : public BaseSpeakerListener
+	{
+	public:
+		SpeakerAddListener(LLParticipantList& parent) : BaseSpeakerListener(parent) {}
+		/*virtual*/ bool handleEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata);
+	};
 
-		/**
-		 * Adds specified avatar ID to the existing list if it is not Agent's ID
-		 *
-		 * @param[in] avatar_id - Avatar UUID to be added into the list
-		 */
-		void addAvatarIDExceptAgent(const LLUUID& avatar_id);
+	class SpeakerRemoveListener : public BaseSpeakerListener
+	{
+	public:
+		SpeakerRemoveListener(LLParticipantList& parent) : BaseSpeakerListener(parent) {}
+		/*virtual*/ bool handleEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata);
+	};
 
-		/**
-		 * Set and sort Avatarlist by given order
-		 */
-		void setSortOrder(EParticipantSortOrder order = E_SORT_BY_NAME);
-		EParticipantSortOrder getSortOrder();
+	class SpeakerClearListener : public BaseSpeakerListener
+	{
+	public:
+		SpeakerClearListener(LLParticipantList& parent) : BaseSpeakerListener(parent) {}
+		/*virtual*/ bool handleEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata);
+	};
 
-		/**
-		 * Refreshes the participant list if it's in sort by recent speaker order.
-		 */
-		void updateRecentSpeakersOrder();
+	class SpeakerModeratorUpdateListener : public BaseSpeakerListener
+	{
+	public:
+		SpeakerModeratorUpdateListener(LLParticipantList& parent) : BaseSpeakerListener(parent) {}
+		/*virtual*/ bool handleEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata);
+	};
+		
+	class SpeakerMuteListener : public BaseSpeakerListener
+	{
+	public:
+		SpeakerMuteListener(LLParticipantList& parent) : BaseSpeakerListener(parent) {}
 
-		/**
-		 * Set a callback to be called before adding a speaker. Invalid speakers will not be added.
-		 *
-		 * If the callback is unset all speakers are considered as valid.
-		 *
-		 * @see onAddItemEvent()
-		 */
-		void setValidateSpeakerCallback(validate_speaker_callback_t cb);
+		/*virtual*/ bool handleEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata);
+	};
 
+	/**
+	 * Menu used in the participant list.
+	 */
+	class LLParticipantListMenu : public LLListContextMenu
+	{
+	public:
+		LLParticipantListMenu(LLParticipantList& parent):mParent(parent){};
+		/*virtual*/ LLContextMenu* createMenu();
+		/*virtual*/ void show(LLView* spawning_view, const uuid_vec_t& uuids, S32 x, S32 y);
 	protected:
+		LLParticipantList& mParent;
+	private:
+		bool enableContextMenuItem(const LLSD& userdata);
+		bool enableModerateContextMenuItem(const LLSD& userdata);
+		bool checkContextMenuItem(const LLSD& userdata);
+
+		void sortParticipantList(const LLSD& userdata);
+		void toggleAllowTextChat(const LLSD& userdata);
+		void toggleMute(const LLSD& userdata, U32 flags);
+		void toggleMuteText(const LLSD& userdata);
+		void toggleMuteVoice(const LLSD& userdata);
+		
 		/**
-		 * LLSpeakerMgr event handlers
+		 * Return true if Agent is group moderator(and moderator of group call).
 		 */
-		bool onAddItemEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata);
-		bool onRemoveItemEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata);
-		bool onClearListEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata);
-		bool onModeratorUpdateEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata);
-		bool onSpeakerMuteEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata);
+		bool isGroupModerator();
 
+		// Voice moderation support
 		/**
-		 * Sorts the Avatarlist by stored order
+		 * Check whether specified by argument avatar is muted for group chat or not.
 		 */
-		void sort();
-
-		//List of listeners implementing LLOldEvents::LLSimpleListener.
-		//There is no way to handle all the events in one listener as LLSpeakerMgr registers listeners in such a way
-		//that one listener can handle only one type of event
-		class BaseSpeakerListner : public LLOldEvents::LLSimpleListener
-		{
-		public:
-			BaseSpeakerListner(LLParticipantList& parent) : mParent(parent) {}
-		protected:
-			LLParticipantList& mParent;
-		};
-
-		class SpeakerAddListener : public BaseSpeakerListner
-		{
-		public:
-			SpeakerAddListener(LLParticipantList& parent) : BaseSpeakerListner(parent) {}
-			/*virtual*/ bool handleEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata);
-		};
-
-		class SpeakerRemoveListener : public BaseSpeakerListner
-		{
-		public:
-			SpeakerRemoveListener(LLParticipantList& parent) : BaseSpeakerListner(parent) {}
-			/*virtual*/ bool handleEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata);
-		};
-
-		class SpeakerClearListener : public BaseSpeakerListner
-		{
-		public:
-			SpeakerClearListener(LLParticipantList& parent) : BaseSpeakerListner(parent) {}
-			/*virtual*/ bool handleEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata);
-		};
-
-		class SpeakerModeratorUpdateListener : public BaseSpeakerListner
-		{
-		public:
-			SpeakerModeratorUpdateListener(LLParticipantList& parent) : BaseSpeakerListner(parent) {}
-			/*virtual*/ bool handleEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata);
-		};
-		
-		class SpeakerMuteListener : public BaseSpeakerListner
-		{
-		public:
-			SpeakerMuteListener(LLParticipantList& parent) : BaseSpeakerListner(parent) {}
-
-			/*virtual*/ bool handleEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata);
-		};
+		bool isMuted(const LLUUID& avatar_id);
 
 		/**
-		 * Menu used in the participant list.
+		 * Processes Voice moderation menu items.
+		 *
+		 * It calls either moderateVoiceParticipant() or moderateVoiceParticipant() depend on
+		 * passed parameter.
+		 *
+		 * @param userdata can be "selected" or "others".
+		 *
+		 * @see moderateVoiceParticipant()
+		 * @see moderateVoiceAllParticipants()
 		 */
-		class LLParticipantListMenu : public LLListContextMenu
-		{
-		public:
-			LLParticipantListMenu(LLParticipantList& parent):mParent(parent){};
-			/*virtual*/ LLContextMenu* createMenu();
-			/*virtual*/ void show(LLView* spawning_view, const uuid_vec_t& uuids, S32 x, S32 y);
-		protected:
-			LLParticipantList& mParent;
-		private:
-			bool enableContextMenuItem(const LLSD& userdata);
-			bool enableModerateContextMenuItem(const LLSD& userdata);
-			bool checkContextMenuItem(const LLSD& userdata);
-
-			void sortParticipantList(const LLSD& userdata);
-			void toggleAllowTextChat(const LLSD& userdata);
-			void toggleMute(const LLSD& userdata, U32 flags);
-			void toggleMuteText(const LLSD& userdata);
-			void toggleMuteVoice(const LLSD& userdata);
-		
-			/**
-			 * Return true if Agent is group moderator(and moderator of group call).
-			 */
-			bool isGroupModerator();
-
-			// Voice moderation support
-			/**
-			 * Check whether specified by argument avatar is muted for group chat or not.
-			 */
-			bool isMuted(const LLUUID& avatar_id);
-
-			/**
-			 * Processes Voice moderation menu items.
-			 *
-			 * It calls either moderateVoiceParticipant() or moderateVoiceParticipant() depend on
-			 * passed parameter.
-			 *
-			 * @param userdata can be "selected" or "others".
-			 *
-			 * @see moderateVoiceParticipant()
-			 * @see moderateVoiceAllParticipants()
-			 */
-			void moderateVoice(const LLSD& userdata);
-
-			/**
-			 * Mutes/Unmutes avatar for current group voice chat.
-			 *
-			 * It only marks avatar as muted for session and does not use local Agent's Block list.
-			 * It does not mute Agent itself.
-			 *
-			 * @param[in] avatar_id UUID of avatar to be processed
-			 * @param[in] unmute if true - specified avatar will be muted, otherwise - unmuted.
-			 *
-			 * @see moderateVoiceAllParticipants()
-			 */
-			void moderateVoiceParticipant(const LLUUID& avatar_id, bool unmute);
-
-			/**
-			 * Mutes/Unmutes all avatars for current group voice chat.
-			 *
-			 * It only marks avatars as muted for session and does not use local Agent's Block list.
-			 *
-			 * @param[in] unmute if true - avatars will be muted, otherwise - unmuted.
-			 *
-			 * @see moderateVoiceParticipant()
-			 */
-			void moderateVoiceAllParticipants(bool unmute);
-
-			static void confirmMuteAllCallback(const LLSD& notification, const LLSD& response);
-		};
+		void moderateVoice(const LLSD& userdata);
 
 		/**
-		 * Comparator for comparing avatar items by last spoken time
+		 * Mutes/Unmutes avatar for current group voice chat.
+		 *
+		 * It only marks avatar as muted for session and does not use local Agent's Block list.
+		 * It does not mute Agent itself.
+		 *
+		 * @param[in] avatar_id UUID of avatar to be processed
+		 * @param[in] unmute if true - specified avatar will be muted, otherwise - unmuted.
+		 *
+		 * @see moderateVoiceAllParticipants()
 		 */
-		class LLAvatarItemRecentSpeakerComparator : public LLAvatarItemNameComparator, public LLRefCount
-		{
-			LOG_CLASS(LLAvatarItemRecentSpeakerComparator);
-		  public:
-			LLAvatarItemRecentSpeakerComparator(LLParticipantList& parent):mParent(parent){};
-			virtual ~LLAvatarItemRecentSpeakerComparator() {};
-		  protected:
-			virtual bool doCompare(const LLAvatarListItem* avatar_item1, const LLAvatarListItem* avatar_item2) const;
-		  private:
-			LLParticipantList& mParent;
-		};
-
-	private:
-		void onAvatarListDoubleClicked(LLUICtrl* ctrl);
-		void onAvatarListRefreshed(LLUICtrl* ctrl, const LLSD& param);
-
-		void onAvalineCallerFound(const LLUUID& participant_id);
-		void onAvalineCallerRemoved(const LLUUID& participant_id);
+		void moderateVoiceParticipant(const LLUUID& avatar_id, bool unmute);
 
 		/**
-		 * Adjusts passed participant to work properly.
+		 * Mutes/Unmutes all avatars for current group voice chat.
 		 *
-		 * Adds SpeakerMuteListener to process moderation actions.
-		 */
-		void adjustParticipant(const LLUUID& speaker_id);
-
-		LLSpeakerMgr*		mSpeakerMgr;
-		LLAvatarList*		mAvatarList;
-
-		std::set<LLUUID>	mModeratorList;
-		std::set<LLUUID>	mModeratorToRemoveList;
-
-		LLPointer<SpeakerAddListener>				mSpeakerAddListener;
-		LLPointer<SpeakerRemoveListener>			mSpeakerRemoveListener;
-		LLPointer<SpeakerClearListener>				mSpeakerClearListener;
-		LLPointer<SpeakerModeratorUpdateListener>	mSpeakerModeratorListener;
-		LLPointer<SpeakerMuteListener>				mSpeakerMuteListener;
-
-		LLParticipantListMenu*    mParticipantListMenu;
-
-		EParticipantSortOrder	mSortOrder;
-		/*
-		 * This field manages an adding  a new avatar_id in the mAvatarList
-		 * If true, then agent_id wont  be added into mAvatarList
-		 * Also by default this field is controlling a sort procedure, @c sort() 
+		 * It only marks avatars as muted for session and does not use local Agent's Block list.
+		 *
+		 * @param[in] unmute if true - avatars will be muted, otherwise - unmuted.
+		 *
+		 * @see moderateVoiceParticipant()
 		 */
-		bool mExcludeAgent;
+		void moderateVoiceAllParticipants(bool unmute);
 
-		// boost::connections
-		boost::signals2::connection mAvatarListDoubleClickConnection;
-		boost::signals2::connection mAvatarListRefreshConnection;
-		boost::signals2::connection mAvatarListReturnConnection;
-		boost::signals2::connection mAvatarListToggleIconsConnection;
+		static void confirmMuteAllCallback(const LLSD& notification, const LLSD& response);
+	};
 
-		LLPointer<LLAvatarItemRecentSpeakerComparator> mSortByRecentSpeakers;
-		validate_speaker_callback_t mValidateSpeakerCallback;
-		LLAvalineUpdater* mAvalineUpdater;
+	/**
+	 * Comparator for comparing avatar items by last spoken time
+	 */
+	class LLAvatarItemRecentSpeakerComparator : public LLAvatarItemNameComparator, public LLRefCount
+	{
+		LOG_CLASS(LLAvatarItemRecentSpeakerComparator);
+	public:
+		LLAvatarItemRecentSpeakerComparator(LLParticipantList& parent):mParent(parent){};
+		virtual ~LLAvatarItemRecentSpeakerComparator() {};
+	protected:
+		virtual bool doCompare(const LLAvatarListItem* avatar_item1, const LLAvatarListItem* avatar_item2) const;
+	private:
+		LLParticipantList& mParent;
+	};
+
+private:
+	void onAvatarListDoubleClicked(LLUICtrl* ctrl);
+	void onAvatarListRefreshed(LLUICtrl* ctrl, const LLSD& param);
+
+	void onAvalineCallerFound(const LLUUID& participant_id);
+	void onAvalineCallerRemoved(const LLUUID& participant_id);
+
+	/**
+	 * Adjusts passed participant to work properly.
+	 *
+	 * Adds SpeakerMuteListener to process moderation actions.
+	 */
+	void adjustParticipant(const LLUUID& speaker_id);
+
+	LLSpeakerMgr*		mSpeakerMgr;
+	LLAvatarList*		mAvatarList;
+
+	std::set<LLUUID>	mModeratorList;
+	std::set<LLUUID>	mModeratorToRemoveList;
+
+	LLPointer<SpeakerAddListener>				mSpeakerAddListener;
+	LLPointer<SpeakerRemoveListener>			mSpeakerRemoveListener;
+	LLPointer<SpeakerClearListener>				mSpeakerClearListener;
+	LLPointer<SpeakerModeratorUpdateListener>	mSpeakerModeratorListener;
+	LLPointer<SpeakerMuteListener>				mSpeakerMuteListener;
+
+	LLParticipantListMenu*    mParticipantListMenu;
+
+	/**
+	 * This field manages an adding  a new avatar_id in the mAvatarList
+	 * If true, then agent_id wont  be added into mAvatarList
+	 * Also by default this field is controlling a sort procedure, @c sort() 
+	 */
+	bool mExcludeAgent;
+
+	// boost::connections
+	boost::signals2::connection mAvatarListDoubleClickConnection;
+	boost::signals2::connection mAvatarListRefreshConnection;
+	boost::signals2::connection mAvatarListReturnConnection;
+	boost::signals2::connection mAvatarListToggleIconsConnection;
+
+	LLPointer<LLAvatarItemRecentSpeakerComparator> mSortByRecentSpeakers;
+	validate_speaker_callback_t mValidateSpeakerCallback;
+	LLAvalineUpdater* mAvalineUpdater;
 };
+
+#endif // LL_PARTICIPANTLIST_H
diff --git a/indra/newview/llplacesinventorypanel.cpp b/indra/newview/llplacesinventorypanel.cpp
index 408270a1a042933cc56f5b5f81c043e39a2b558a..29e262199e3fea24c028338b372f4b83610500bd 100644
--- a/indra/newview/llplacesinventorypanel.cpp
+++ b/indra/newview/llplacesinventorypanel.cpp
@@ -205,24 +205,6 @@ BOOL LLPlacesFolderView::handleRightMouseDown(S32 x, S32 y, MASK mask)
 	return LLFolderView::handleRightMouseDown(x, y, mask);
 }
 
-BOOL LLPlacesFolderView::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
-										   EDragAndDropType cargo_type,
-										   void* cargo_data,
-										   EAcceptance* accept,
-										   std::string& tooltip_msg)
-{
-	// Don't accept anything except landmarks and folders to be dropped
-	// in places folder view. See STORM-296.
-	if (cargo_type != DAD_LANDMARK && cargo_type != DAD_CATEGORY)
-	{
-		*accept = ACCEPT_NO;
-		return FALSE;
-	}
-
-	return LLFolderView::handleDragAndDrop(x, y, mask, drop, cargo_type, cargo_data,
-										   accept, tooltip_msg);
-}
-
 void LLPlacesFolderView::setupMenuHandle(LLInventoryType::EType asset_type, LLHandle<LLView> menu_handle)
 {
 	mMenuHandlesByInventoryType[asset_type] = menu_handle;
diff --git a/indra/newview/llplacesinventorypanel.h b/indra/newview/llplacesinventorypanel.h
index a44776d18b9f19ff976118927698c704839376c7..6641871a0bfc279b86bd2c8ac637da4726805d27 100644
--- a/indra/newview/llplacesinventorypanel.h
+++ b/indra/newview/llplacesinventorypanel.h
@@ -70,12 +70,6 @@ class LLPlacesFolderView : public LLFolderView
 	 */
 	/*virtual*/ BOOL handleRightMouseDown( S32 x, S32 y, MASK mask );
 
-	/*virtual*/ BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
-									   EDragAndDropType cargo_type,
-									   void* cargo_data,
-									   EAcceptance* accept,
-									   std::string& tooltip_msg);
-
 	void setupMenuHandle(LLInventoryType::EType asset_type, LLHandle<LLView> menu_handle);
 
 	void setParentLandmarksPanel(LLLandmarksPanel* panel)
diff --git a/indra/newview/llscreenchannel.cpp b/indra/newview/llscreenchannel.cpp
index 18c9ac28c145937c84449422d7b80e2330ac7115..61f4897ed089dde0b0656b33f7f58f7659803364 100644
--- a/indra/newview/llscreenchannel.cpp
+++ b/indra/newview/llscreenchannel.cpp
@@ -369,7 +369,7 @@ void LLScreenChannel::loadStoredToastsToChannel()
 	for(it = mStoredToastList.begin(); it != mStoredToastList.end(); ++it)
 	{
 		(*it).toast->setIsHidden(false);
-		(*it).toast->resetTimer();
+		(*it).toast->startFading();
 		mToastList.push_back((*it));
 	}
 
@@ -394,7 +394,7 @@ void LLScreenChannel::loadStoredToastByNotificationIDToChannel(LLUUID id)
 	}
 
 	toast->setIsHidden(false);
-	toast->resetTimer();
+	toast->startFading();
 	mToastList.push_back((*it));
 
 	redrawToasts();
@@ -477,7 +477,7 @@ void LLScreenChannel::modifyToastByNotificationID(LLUUID id, LLPanel* panel)
 		toast->removeChild(old_panel);
 		delete old_panel;
 		toast->insertPanel(panel);
-		toast->resetTimer();
+		toast->startFading();
 		redrawToasts();
 	}
 }
@@ -588,7 +588,7 @@ void LLScreenChannel::showToastsBottom()
 		mHiddenToastsNum = 0;
 		for(; it != mToastList.rend(); it++)
 		{
-			(*it).toast->stopTimer();
+			(*it).toast->stopFading();
 			(*it).toast->setVisible(FALSE);
 			mHiddenToastsNum++;
 		}
diff --git a/indra/newview/llsidepaneliteminfo.cpp b/indra/newview/llsidepaneliteminfo.cpp
index f9c0fd398e5ec8070ce7ca7954265ddc96a323fd..be797ea937defcb084cf596abd66b6d21797f707 100644
--- a/indra/newview/llsidepaneliteminfo.cpp
+++ b/indra/newview/llsidepaneliteminfo.cpp
@@ -68,10 +68,22 @@ class LLItemPropertiesObserver : public LLInventoryObserver
 
 void LLItemPropertiesObserver::changed(U32 mask)
 {
-	// if there's a change we're interested in.
-	if((mask & (LLInventoryObserver::LABEL | LLInventoryObserver::INTERNAL | LLInventoryObserver::REMOVE)) != 0)
+	const std::set<LLUUID>& mChangedItemIDs = gInventory.getChangedIDs();
+	std::set<LLUUID>::const_iterator it;
+
+	const LLUUID& object_id = mFloater->getObjectID();
+
+	for (it = mChangedItemIDs.begin(); it != mChangedItemIDs.end(); it++)
 	{
-		mFloater->dirty();
+		// set dirty for 'item profile panel' only if changed item is the item for which 'item profile panel' is shown (STORM-288)
+		if (*it == object_id)
+		{
+			// if there's a change we're interested in.
+			if((mask & (LLInventoryObserver::LABEL | LLInventoryObserver::INTERNAL | LLInventoryObserver::REMOVE)) != 0)
+			{
+				mFloater->dirty();
+			}
+		}
 	}
 }
 
@@ -179,6 +191,11 @@ void LLSidepanelItemInfo::setItemID(const LLUUID& item_id)
 	mItemID = item_id;
 }
 
+const LLUUID& LLSidepanelItemInfo::getObjectID() const
+{
+	return mObjectID;
+}
+
 void LLSidepanelItemInfo::reset()
 {
 	LLSidepanelInventorySubpanel::reset();
diff --git a/indra/newview/llsidepaneliteminfo.h b/indra/newview/llsidepaneliteminfo.h
index 10e93dd7de513148daec39f0da76cb5d7cd2d35d..6416e2cfe40342b9a1922cd01e8c465d58139d73 100644
--- a/indra/newview/llsidepaneliteminfo.h
+++ b/indra/newview/llsidepaneliteminfo.h
@@ -54,6 +54,8 @@ class LLSidepanelItemInfo : public LLSidepanelInventorySubpanel
 	void setItemID(const LLUUID& item_id);
 	void setEditMode(BOOL edit);
 
+	const LLUUID& getObjectID() const;
+
 protected:
 	/*virtual*/ void refresh();
 	/*virtual*/ void save();
diff --git a/indra/newview/llspatialpartition.cpp b/indra/newview/llspatialpartition.cpp
index fb984a7c6289820a12a9fa3c143a670e1ec03f96..960e72ee421e9b3ac65de574fc0489ca81273c7a 100644
--- a/indra/newview/llspatialpartition.cpp
+++ b/indra/newview/llspatialpartition.cpp
@@ -1555,7 +1555,9 @@ void LLSpatialGroup::doOcclusion(LLCamera* camera)
 {
 	if (mSpatialPartition->isOcclusionEnabled() && LLPipeline::sUseOcclusion > 1)
 	{
-		if (earlyFail(camera, this))
+		// Don't cull hole/edge water, unless we have the GL_ARB_depth_clamp extension
+		if ((mSpatialPartition->mDrawableType == LLDrawPool::POOL_VOIDWATER && !gGLManager.mHasDepthClamp) ||
+			earlyFail(camera, this))
 		{
 			setOcclusionState(LLSpatialGroup::DISCARD_QUERY);
 			assert_states_valid(this);
@@ -1576,7 +1578,18 @@ void LLSpatialGroup::doOcclusion(LLCamera* camera)
 				{
 					buildOcclusion();
 				}
-
+				
+				// Depth clamp all water to avoid it being culled as a result of being
+				// behind the far clip plane, and in the case of edge water to avoid
+				// it being culled while still visible.
+				bool const use_depth_clamp = gGLManager.mHasDepthClamp &&
+											(mSpatialPartition->mDrawableType == LLDrawPool::POOL_WATER ||
+											mSpatialPartition->mDrawableType == LLDrawPool::POOL_VOIDWATER);
+				if (use_depth_clamp)
+				{
+					glEnable(GL_DEPTH_CLAMP);
+				}
+				
 				glBeginQueryARB(GL_SAMPLES_PASSED_ARB, mOcclusionQuery[LLViewerCamera::sCurCameraID]);					
 				glVertexPointer(3, GL_FLOAT, 0, mOcclusionVerts);
 				if (camera->getOrigin().isExactlyZero())
@@ -1592,6 +1605,11 @@ void LLSpatialGroup::doOcclusion(LLCamera* camera)
 								GL_UNSIGNED_BYTE, get_box_fan_indices(camera, mBounds[0]));
 				}
 				glEndQueryARB(GL_SAMPLES_PASSED_ARB);
+				
+				if (use_depth_clamp)
+				{
+					glDisable(GL_DEPTH_CLAMP);
+				}
 			}
 
 			setOcclusionState(LLSpatialGroup::QUERY_PENDING);
@@ -2591,9 +2609,10 @@ void renderBoundingBox(LLDrawable* drawable, BOOL set_color = TRUE)
 						gGL.color4f(0.5f,0.5f,0.5f,1.0f);
 						break;
 				case LLViewerObject::LL_VO_PART_GROUP:
-			case LLViewerObject::LL_VO_HUD_PART_GROUP:
+				case LLViewerObject::LL_VO_HUD_PART_GROUP:
 						gGL.color4f(0,0,1,1);
 						break;
+				case LLViewerObject::LL_VO_VOID_WATER:
 				case LLViewerObject::LL_VO_WATER:
 						gGL.color4f(0,0.5f,1,1);
 						break;
diff --git a/indra/newview/llspatialpartition.h b/indra/newview/llspatialpartition.h
index 1a25f3f85dee6e17f9dfbc0595fcef8b4fb3affd..2b9cf6c6300498ea17b122b1e259b73ef3cf8aa6 100644
--- a/indra/newview/llspatialpartition.h
+++ b/indra/newview/llspatialpartition.h
@@ -551,6 +551,13 @@ class LLWaterPartition : public LLSpatialPartition
 	virtual void addGeometryCount(LLSpatialGroup* group, U32 &vertex_count, U32& index_count) { }
 };
 
+//spatial partition for hole and edge water (implemented in LLVOWater.cpp)
+class LLVoidWaterPartition : public LLWaterPartition
+{
+public:
+	LLVoidWaterPartition();
+};
+
 //spatial partition for terrain (impelmented in LLVOSurfacePatch.cpp)
 class LLTerrainPartition : public LLSpatialPartition
 {
diff --git a/indra/newview/llsurface.cpp b/indra/newview/llsurface.cpp
index af4d9fa7b950c3a14494d9fb3953dcd7e1979e44..6fc8153b7783585e12d785f7605e4d5d0ff698b5 100644
--- a/indra/newview/llsurface.cpp
+++ b/indra/newview/llsurface.cpp
@@ -1162,8 +1162,13 @@ void LLSurface::setWaterHeight(F32 height)
 	if (!mWaterObjp.isNull())
 	{
 		LLVector3 water_pos_region = mWaterObjp->getPositionRegion();
+		bool changed = water_pos_region.mV[VZ] != height;
 		water_pos_region.mV[VZ] = height;
 		mWaterObjp->setPositionRegion(water_pos_region);
+		if (changed)
+		{
+			LLWorld::getInstance()->updateWaterObjects();
+		}
 	}
 	else
 	{
diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp
index fafef84aa22af0ca4cf553a9d3e271d77dfbb2be..d6d38de2257a84ba649436164306b82ef22a284d 100644
--- a/indra/newview/lltexturefetch.cpp
+++ b/indra/newview/lltexturefetch.cpp
@@ -299,6 +299,7 @@ class HTTPGetResponder : public LLCurl::Responder
 	{
 		static LLCachedControl<bool> log_to_viewer_log(gSavedSettings,"LogTextureDownloadsToViewerLog");
 		static LLCachedControl<bool> log_to_sim(gSavedSettings,"LogTextureDownloadsToSimulator");
+		static LLCachedControl<bool> log_texture_traffic(gSavedSettings,"LogTextureNetworkTraffic") ;
 
 		if (log_to_viewer_log || log_to_sim)
 		{
@@ -332,6 +333,16 @@ class HTTPGetResponder : public LLCurl::Responder
 			}
 			
 			S32 data_size = worker->callbackHttpGet(channels, buffer, partial, success);
+			
+			if(log_texture_traffic && data_size > 0)
+			{
+				LLViewerTexture* tex = LLViewerTextureManager::findTexture(mID) ;
+				if(tex)
+				{
+					gTotalTextureBytesPerBoostLevel[tex->getBoostLevel()] += data_size ;
+				}
+			}
+
 			mFetcher->removeFromHTTPQueue(mID, data_size);
 		}
 		else
diff --git a/indra/newview/lltextureview.cpp b/indra/newview/lltextureview.cpp
index c87aff022fcee4d572818b5aa9d8b7b92009033d..b9a15fd1f4dd836c757b739118563ef81efb9e22 100644
--- a/indra/newview/lltextureview.cpp
+++ b/indra/newview/lltextureview.cpp
@@ -514,7 +514,8 @@ void LLGLTexMemBar::draw()
 	F32 cache_max_usage = (F32)BYTES_TO_MEGA_BYTES(LLAppViewer::getTextureCache()->getMaxUsage()) ;
 	S32 line_height = (S32)(LLFontGL::getFontMonospace()->getLineHeight() + .5f);
 	S32 v_offset = (S32)((texture_bar_height + 2.2f) * mTextureView->mNumTextureBars + 2.0f);
-	S32 total_downloaded = BYTES_TO_MEGA_BYTES(gTotalTextureBytes);
+	F32 total_texture_downloaded = (F32)gTotalTextureBytes / (1024 * 1024);
+	F32 total_object_downloaded = (F32)gTotalObjectBytes / (1024 * 1024);
 	//----------------------------------------------------------------------------
 	LLGLSUIDefault gls_ui;
 	LLColor4 text_color(1.f, 1.f, 1.f, 0.75f);
@@ -525,13 +526,13 @@ void LLGLTexMemBar::draw()
 	LLFontGL::getFontMonospace()->renderUTF8(text, 0, 0, v_offset + line_height*6,
 											 text_color, LLFontGL::LEFT, LLFontGL::TOP);
 
-	text = llformat("GL Tot: %d/%d MB Bound: %d/%d MB Raw Tot: %d MB Bias: %.2f Cache: %.1f/%.1f MB Net Tot: %d MB",
+	text = llformat("GL Tot: %d/%d MB Bound: %d/%d MB Raw Tot: %d MB Bias: %.2f Cache: %.1f/%.1f MB Net Tot Tex: %.1f MB Tot Obj: %.1f MB",
 					total_mem,
 					max_total_mem,
 					bound_mem,
 					max_bound_mem,
 					LLImageRaw::sGlobalRawMemory >> 20,	discard_bias,
-					cache_usage, cache_max_usage, total_downloaded);
+					cache_usage, cache_max_usage, total_texture_downloaded, total_object_downloaded);
 	//, cache_entries, cache_max_entries
 
 	LLFontGL::getFontMonospace()->renderUTF8(text, 0, 0, v_offset + line_height*3,
diff --git a/indra/newview/lltoast.cpp b/indra/newview/lltoast.cpp
index c3090cb1fc8057ffe067572075d879a8d8a1fd2c..8176b8c1f96aea6081e6059488303ceb35d695c9 100644
--- a/indra/newview/lltoast.cpp
+++ b/indra/newview/lltoast.cpp
@@ -35,6 +35,13 @@
 
 using namespace LLNotificationsUI;
 
+//--------------------------------------------------------------------------
+LLToastLifeTimer::LLToastLifeTimer(LLToast* toast, F32 period)
+	: mToast(toast),
+	  LLEventTimer(period)
+{
+}
+
 /*virtual*/
 BOOL LLToastLifeTimer::tick()
 {
@@ -45,6 +52,38 @@ BOOL LLToastLifeTimer::tick()
 	return FALSE;
 }
 
+void LLToastLifeTimer::stop()
+{
+	mEventTimer.stop();
+}
+
+void LLToastLifeTimer::start()
+{
+	mEventTimer.start();
+}
+
+void LLToastLifeTimer::restart()
+{
+	mEventTimer.reset();
+}
+
+BOOL LLToastLifeTimer::getStarted()
+{
+	return mEventTimer.getStarted();
+}
+
+void LLToastLifeTimer::setPeriod(F32 period)
+{
+	mPeriod = period;
+}
+
+F32 LLToastLifeTimer::getRemainingTimeF32()
+{
+	F32 et = mEventTimer.getElapsedTimeF32();
+	if (!getStarted() || et > mPeriod) return 0.0f;
+	return mPeriod - et;
+}
+
 //--------------------------------------------------------------------------
 LLToast::Params::Params() 
 :	can_fade("can_fade", true),
@@ -73,7 +112,8 @@ LLToast::LLToast(const LLToast::Params& p)
 	mIsHidden(false),
 	mHideBtnPressed(false),
 	mIsTip(p.is_tip),
-	mWrapperPanel(NULL)
+	mWrapperPanel(NULL),
+	mIsTransparent(false)
 {
 	mTimer.reset(new LLToastLifeTimer(this, p.lifetime_secs));
 
@@ -143,6 +183,7 @@ LLToast::~LLToast()
 void LLToast::hide()
 {
 	setVisible(FALSE);
+	setTransparentState(false);
 	mTimer->stop();
 	mIsHidden = true;
 	mOnFadeSignal(this); 
@@ -166,6 +207,16 @@ void LLToast::onFocusReceived()
 	}
 }
 
+void LLToast::setLifetime(S32 seconds)
+{
+	mToastLifetime = seconds;
+}
+
+void LLToast::setFadingTime(S32 seconds)
+{
+	mToastFadingTime = seconds;
+}
+
 S32 LLToast::getTopPad()
 {
 	if(mWrapperPanel)
@@ -195,13 +246,46 @@ void LLToast::setCanFade(bool can_fade)
 //--------------------------------------------------------------------------
 void LLToast::expire()
 {
-	// if toast has fade property - hide it
-	if(mCanFade)
+	if (mCanFade)
 	{
-		hide();
+		if (mIsTransparent)
+		{
+			hide();
+		}
+		else
+		{
+			setTransparentState(true);
+			mTimer->restart();
+		}
 	}
 }
 
+void LLToast::setTransparentState(bool transparent)
+{
+	setBackgroundOpaque(!transparent);
+	mIsTransparent = transparent;
+
+	if (transparent)
+	{
+		mTimer->setPeriod(mToastFadingTime);
+	}
+	else
+	{
+		mTimer->setPeriod(mToastLifetime);
+	}
+}
+
+F32 LLToast::getTimeLeftToLive()
+{
+	F32 time_to_live = mTimer->getRemainingTimeF32();
+
+	if (!mIsTransparent)
+	{
+		time_to_live += mToastFadingTime;
+	}
+
+	return time_to_live;
+}
 //--------------------------------------------------------------------------
 
 void LLToast::reshapeToPanel()
@@ -245,13 +329,6 @@ void LLToast::draw()
 			drawChild(mHideBtn);
 		}
 	}
-
-	// if timer started and remaining time <= fading time
-	if (mTimer->getStarted() && (mToastLifetime
-			- mTimer->getEventTimer().getElapsedTimeF32()) <= mToastFadingTime)
-	{
-		setBackgroundOpaque(FALSE);
-	}
 }
 
 //--------------------------------------------------------------------------
@@ -267,6 +344,11 @@ void LLToast::setVisible(BOOL show)
 		return;
 	}
 
+	if (show && getVisible())
+	{
+		return;
+	}
+
 	if(show)
 	{
 		setBackgroundOpaque(TRUE);
@@ -372,7 +454,8 @@ void LLNotificationsUI::LLToast::stopFading()
 {
 	if(mCanFade)
 	{
-		stopTimer();
+		setTransparentState(false);
+		mTimer->stop();
 	}
 }
 
@@ -380,7 +463,8 @@ void LLNotificationsUI::LLToast::startFading()
 {
 	if(mCanFade)
 	{
-		resetTimer();
+		setTransparentState(false);
+		mTimer->start();
 	}
 }
 
diff --git a/indra/newview/lltoast.h b/indra/newview/lltoast.h
index 0a96c092a0de0e54d5fc6be1a08bb14ab20548a9..fb534561c93b17589850793a8f9b37a3e4e888a7 100644
--- a/indra/newview/lltoast.h
+++ b/indra/newview/lltoast.h
@@ -49,14 +49,16 @@ class LLToast;
 class LLToastLifeTimer: public LLEventTimer
 {
 public:
-	LLToastLifeTimer(LLToast* toast, F32 period) : mToast(toast), LLEventTimer(period){}
+	LLToastLifeTimer(LLToast* toast, F32 period);
 
 	/*virtual*/
 	BOOL tick();
-	void stop() { mEventTimer.stop(); }
-	void start() { mEventTimer.start(); }
-	void restart() {mEventTimer.reset(); }
-	BOOL getStarted() { return mEventTimer.getStarted(); }
+	void stop();
+	void start();
+	void restart();
+	BOOL getStarted();
+	void setPeriod(F32 period);
+	F32 getRemainingTimeF32();
 
 	LLTimer&  getEventTimer() { return mEventTimer;}
 private :
@@ -80,8 +82,14 @@ class LLToast : public LLModalDialog
 		Optional<LLUUID>				notif_id,	 //notification ID
 										session_id;	 //im session ID
 		Optional<LLNotificationPtr>		notification;
-		Optional<F32>					lifetime_secs,
-										fading_time_secs; // Number of seconds while a toast is fading
+
+		//NOTE: Life time of a toast (i.e. period of time from the moment toast was shown
+		//till the moment when toast was hidden) is the sum of lifetime_secs and fading_time_secs.
+
+		Optional<F32>					lifetime_secs, // Number of seconds while a toast is non-transparent
+										fading_time_secs; // Number of seconds while a toast is transparent
+
+
 		Optional<toast_callback_t>		on_delete_toast,
 										on_mouse_enter;
 		Optional<bool>					can_fade,
@@ -125,10 +133,8 @@ class LLToast : public LLModalDialog
 	LLPanel* getPanel() { return mPanel; }
 	// enable/disable Toast's Hide button
 	void setHideButtonEnabled(bool enabled);
-	// 
-	void resetTimer() { mTimer->start(); }
 	//
-	void stopTimer() { mTimer->stop(); }
+	F32 getTimeLeftToLive();
 	//
 	LLToastLifeTimer* getTimer() { return mTimer.get();}
 	//
@@ -144,6 +150,10 @@ class LLToast : public LLModalDialog
 
 	/*virtual*/ void onFocusReceived();
 
+	void setLifetime(S32 seconds);
+
+	void setFadingTime(S32 seconds);
+
 	/**
 	 * Returns padding between floater top and wrapper_panel top.
 	 * This padding should be taken into account when positioning or reshaping toasts
@@ -196,7 +206,9 @@ class LLToast : public LLModalDialog
 
 	void onToastMouseLeave();
 
-	void	expire();
+	void expire();
+
+	void setTransparentState(bool transparent);
 
 	LLUUID				mNotificationID;
 	LLUUID				mSessionID;
@@ -222,6 +234,7 @@ class LLToast : public LLModalDialog
 	bool		mHideBtnPressed;
 	bool		mIsHidden;  // this flag is TRUE when a toast has faded or was hidden with (x) button (EXT-1849)
 	bool		mIsTip;
+	bool		mIsTransparent;
 
 	commit_signal_t mToastMouseEnterSignal;
 	commit_signal_t mToastMouseLeaveSignal;
diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp
index 40583f05bfa8ab9117f9940ce3b6039d4f426152..1d5caabebbc248cfb0d67cb6584a541cccc61d66 100644
--- a/indra/newview/llviewerdisplay.cpp
+++ b/indra/newview/llviewerdisplay.cpp
@@ -597,7 +597,8 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot)
 
 		S32 water_clip = 0;
 		if ((LLViewerShaderMgr::instance()->getVertexShaderLevel(LLViewerShaderMgr::SHADER_ENVIRONMENT) > 1) &&
-			 gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_WATER))
+			 (gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_WATER) || 
+			  gPipeline.hasRenderType(LLPipeline::RENDER_TYPE_VOIDWATER)))
 		{
 			if (LLViewerCamera::getInstance()->cameraUnderWater())
 			{
@@ -730,7 +731,6 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot)
 		//
 		// Doing this here gives hardware occlusion queries extra time to complete
 		LLAppViewer::instance()->pingMainloopTimeout("Display:UpdateImages");
-		LLError::LLCallStacks::clear() ;
 		
 		{
 			LLMemType mt_iu(LLMemType::MTYPE_DISPLAY_IMAGE_UPDATE);
diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp
index ccf3df827df31c16350c0c520dc9a7af1a9ca064..2874a6ec7935ba82792318255d2ae00fe5093271 100644
--- a/indra/newview/llviewermenu.cpp
+++ b/indra/newview/llviewermenu.cpp
@@ -221,8 +221,6 @@ BOOL check_show_xui_names(void *);
 // Debug UI
 
 void handle_buy_currency_test(void*);
-void handle_save_to_xml(void*);
-void handle_load_from_xml(void*);
 
 void handle_god_mode(void*);
 
@@ -1384,37 +1382,6 @@ class LLAdvancedCheckDebugWindowProc : public view_listener_t
 
 // ------------------------------XUI MENU ---------------------------
 
-//////////////////////
-// LOAD UI FROM XML //
-//////////////////////
-
-
-class LLAdvancedLoadUIFromXML : public view_listener_t
-{
-	bool handleEvent(const LLSD& userdata)
-	{
-		handle_load_from_xml(NULL);
-		return true;
-}
-};
-
-
-
-////////////////////
-// SAVE UI TO XML //
-////////////////////
-
-
-class LLAdvancedSaveUIToXML : public view_listener_t
-{
-	bool handleEvent(const LLSD& userdata)
-	{
-		handle_save_to_xml(NULL);
-		return true;
-}
-};
-
-
 class LLAdvancedSendTestIms : public view_listener_t
 {
 	bool handleEvent(const LLSD& userdata)
@@ -1994,6 +1961,16 @@ class LLAdvancedShowDebugSettings : public view_listener_t
 // VIEW ADMIN OPTIONS //
 ////////////////////////
 
+class LLAdvancedEnableViewAdminOptions : public view_listener_t
+{
+	bool handleEvent(const LLSD& userdata)
+	{
+		// Don't enable in god mode since the admin menu is shown anyway.
+		// Only enable if the user has set the appropriate debug setting.
+		bool new_value = !gAgent.getAgentAccess().isGodlikeWithoutAdminMenuFakery() && gSavedSettings.getBOOL("AdminMenu");
+		return new_value;
+	}
+};
 
 class LLAdvancedToggleViewAdminOptions : public view_listener_t
 {
@@ -2008,7 +1985,7 @@ class LLAdvancedCheckViewAdminOptions : public view_listener_t
 {
 	bool handleEvent(const LLSD& userdata)
 	{
-		bool new_value = check_admin_override(NULL);
+		bool new_value = check_admin_override(NULL) || gAgent.isGodlike();
 		return new_value;
 	}
 };
@@ -4160,6 +4137,11 @@ class LLObjectEnableReturn : public view_listener_t
 {
 	bool handleEvent(const LLSD& userdata)
 	{
+		if (LLSelectMgr::getInstance()->getSelection()->isEmpty())
+		{
+			// Do not enable if nothing selected
+			return false;
+		}
 #ifdef HACKED_GODLIKE_VIEWER
 		bool new_value = true;
 #else
@@ -7183,44 +7165,6 @@ const LLRect LLViewerMenuHolderGL::getMenuRect() const
 	return LLRect(0, getRect().getHeight() - MENU_BAR_HEIGHT, getRect().getWidth(), STATUS_BAR_HEIGHT);
 }
 
-void handle_save_to_xml(void*)
-{
-	LLFloater* frontmost = gFloaterView->getFrontmost();
-	if (!frontmost)
-	{
-        LLNotificationsUtil::add("NoFrontmostFloater");
-		return;
-	}
-
-	std::string default_name = "floater_";
-	default_name += frontmost->getTitle();
-	default_name += ".xml";
-
-	LLStringUtil::toLower(default_name);
-	LLStringUtil::replaceChar(default_name, ' ', '_');
-	LLStringUtil::replaceChar(default_name, '/', '_');
-	LLStringUtil::replaceChar(default_name, ':', '_');
-	LLStringUtil::replaceChar(default_name, '"', '_');
-
-	LLFilePicker& picker = LLFilePicker::instance();
-	if (picker.getSaveFile(LLFilePicker::FFSAVE_XML, default_name))
-	{
-		std::string filename = picker.getFirstFile();
-		LLUICtrlFactory::getInstance()->saveToXML(frontmost, filename);
-	}
-}
-
-void handle_load_from_xml(void*)
-{
-	LLFilePicker& picker = LLFilePicker::instance();
-	if (picker.getOpenFile(LLFilePicker::FFLOAD_XML))
-	{
-		std::string filename = picker.getFirstFile();
-		LLFloater* floater = new LLFloater(LLSD());
-		floater->buildFromFile(filename);
-	}
-}
-
 void handle_web_browser_test(const LLSD& param)
 {
 	std::string url = param.asString();
@@ -8006,8 +7950,6 @@ void initialize_menus()
 
 	// Advanced > XUI
 	commit.add("Advanced.ReloadColorSettings", boost::bind(&LLUIColorTable::loadFromSettings, LLUIColorTable::getInstance()));
-	view_listener_t::addMenu(new LLAdvancedLoadUIFromXML(), "Advanced.LoadUIFromXML");
-	view_listener_t::addMenu(new LLAdvancedSaveUIToXML(), "Advanced.SaveUIToXML");
 	view_listener_t::addMenu(new LLAdvancedToggleXUINames(), "Advanced.ToggleXUINames");
 	view_listener_t::addMenu(new LLAdvancedCheckXUINames(), "Advanced.CheckXUINames");
 	view_listener_t::addMenu(new LLAdvancedSendTestIms(), "Advanced.SendTestIMs");
@@ -8068,6 +8010,7 @@ void initialize_menus()
 	view_listener_t::addMenu(new LLAdvancedCheckShowObjectUpdates(), "Advanced.CheckShowObjectUpdates");
 	view_listener_t::addMenu(new LLAdvancedCompressImage(), "Advanced.CompressImage");
 	view_listener_t::addMenu(new LLAdvancedShowDebugSettings(), "Advanced.ShowDebugSettings");
+	view_listener_t::addMenu(new LLAdvancedEnableViewAdminOptions(), "Advanced.EnableViewAdminOptions");
 	view_listener_t::addMenu(new LLAdvancedToggleViewAdminOptions(), "Advanced.ToggleViewAdminOptions");
 	view_listener_t::addMenu(new LLAdvancedCheckViewAdminOptions(), "Advanced.CheckViewAdminOptions");
 	view_listener_t::addMenu(new LLAdvancedRequestAdminStatus(), "Advanced.RequestAdminStatus");
diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp
index 9b1f2e67c6bf9208f2252cc6f3e60a6c301d2ce9..598ad7afc61538df1776f8f9ca368da938102e51 100644
--- a/indra/newview/llviewermessage.cpp
+++ b/indra/newview/llviewermessage.cpp
@@ -1199,7 +1199,6 @@ void open_inventory_offer(const uuid_vec_t& objects, const std::string& from_nam
 		const BOOL auto_open = 
 			gSavedSettings.getBOOL("ShowInInventory") && // don't open if showininventory is false
 			!(asset_type == LLAssetType::AT_CALLINGCARD) && // don't open if it's a calling card
-			!(item && (item->getInventoryType() == LLInventoryType::IT_ATTACHMENT)) && // don't open if it's an item that's an attachment
 			!from_name.empty(); // don't open if it's not from anyone.
 		LLInventoryPanel *active_panel = LLInventoryPanel::getActiveInventoryPanel(auto_open);
 		if(active_panel)
@@ -1511,7 +1510,12 @@ bool LLOfferInfo::inventory_offer_callback(const LLSD& notification, const LLSD&
 		// MUTE falls through to decline
 	case IOR_DECLINE:
 		{
-			log_message = LLTrans::getString("InvOfferYouDecline") + " " + mDesc + " " + LLTrans::getString("InvOfferFrom") + " " + mFromName +".";
+			{
+				LLStringUtil::format_map_t log_message_args;
+				log_message_args["DESC"] = mDesc;
+				log_message_args["NAME"] = mFromName;
+				log_message = LLTrans::getString("InvOfferDecline", log_message_args);
+			}
 			chat.mText = log_message;
 			if( LLMuteList::getInstance()->isMuted(mFromID ) && ! LLMuteList::getInstance()->isLinden(mFromName) )  // muting for SL-42269
 			{
@@ -1710,8 +1714,12 @@ bool LLOfferInfo::inventory_task_offer_callback(const LLSD& notification, const
 			msg->addBinaryDataFast(_PREHASH_BinaryBucket, EMPTY_BINARY_BUCKET, EMPTY_BINARY_BUCKET_SIZE);
 			// send the message
 			msg->sendReliable(mHost);
-			
-			log_message = LLTrans::getString("InvOfferYouDecline") + " " + mDesc + " " + LLTrans::getString("InvOfferFrom") + " " + mFromName +".";
+			{
+				LLStringUtil::format_map_t log_message_args;
+				log_message_args["DESC"] = mDesc;
+				log_message_args["NAME"] = mFromName;
+				log_message = LLTrans::getString("InvOfferDecline", log_message_args);
+			}
 			LLSD args;
 			args["MESSAGE"] = log_message;
 			LLNotificationsUtil::add("SystemMessage", args);
diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp
index a58b0d68de8d570dca43b817b54b53181d69e7bd..0e1553c421eaedf94121e79de7995ba819f16c71 100644
--- a/indra/newview/llviewerobject.cpp
+++ b/indra/newview/llviewerobject.cpp
@@ -168,8 +168,10 @@ LLViewerObject *LLViewerObject::createObject(const LLUUID &id, const LLPCode pco
 	  res = new LLVOSurfacePatch(id, pcode, regionp); break;
 	case LL_VO_SKY:
 	  res = new LLVOSky(id, pcode, regionp); break;
+	case LL_VO_VOID_WATER:
+		res = new LLVOVoidWater(id, pcode, regionp); break;
 	case LL_VO_WATER:
-	  res = new LLVOWater(id, pcode, regionp); break;
+		res = new LLVOWater(id, pcode, regionp); break;
 	case LL_VO_GROUND:
 	  res = new LLVOGround(id, pcode, regionp); break;
 	case LL_VO_PART_GROUP:
diff --git a/indra/newview/llviewerobject.h b/indra/newview/llviewerobject.h
index 7d697a4a5fd74aff5229b991bea78d13dba3930c..c2475c2709e6d13be27e983de0db30c3317b468d 100644
--- a/indra/newview/llviewerobject.h
+++ b/indra/newview/llviewerobject.h
@@ -131,7 +131,7 @@ class LLViewerObject : public LLPrimitive, public LLRefCount, public LLGLUpdate
 
 	typedef const child_list_t const_child_list_t;
 
-	LLViewerObject(const LLUUID &id, const LLPCode type, LLViewerRegion *regionp, BOOL is_global = FALSE);
+	LLViewerObject(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp, BOOL is_global = FALSE);
 	MEM_TYPE_NEW(LLMemType::MTYPE_OBJECT);
 
 	virtual void markDead();				// Mark this object as dead, and clean up its references
@@ -518,14 +518,14 @@ class LLViewerObject : public LLPrimitive, public LLRefCount, public LLGLUpdate
 	{
 		LL_VO_CLOUDS =				LL_PCODE_APP | 0x20,
 		LL_VO_SURFACE_PATCH =		LL_PCODE_APP | 0x30,
-		//LL_VO_STARS =				LL_PCODE_APP | 0x40,
+		LL_VO_WL_SKY =				LL_PCODE_APP | 0x40,
 		LL_VO_SQUARE_TORUS =		LL_PCODE_APP | 0x50,
 		LL_VO_SKY =					LL_PCODE_APP | 0x60,
-		LL_VO_WATER =				LL_PCODE_APP | 0x70,
-		LL_VO_GROUND =				LL_PCODE_APP | 0x80,
-		LL_VO_PART_GROUP =			LL_PCODE_APP | 0x90,
-		LL_VO_TRIANGLE_TORUS =		LL_PCODE_APP | 0xa0,
-		LL_VO_WL_SKY =				LL_PCODE_APP | 0xb0, // should this be moved to 0x40?
+		LL_VO_VOID_WATER =			LL_PCODE_APP | 0x70,
+		LL_VO_WATER =				LL_PCODE_APP | 0x80,
+		LL_VO_GROUND =				LL_PCODE_APP | 0x90,
+		LL_VO_PART_GROUP =			LL_PCODE_APP | 0xa0,
+		LL_VO_TRIANGLE_TORUS =		LL_PCODE_APP | 0xb0,
 		LL_VO_HUD_PART_GROUP =		LL_PCODE_APP | 0xc0,
 	} EVOType;
 
@@ -717,8 +717,8 @@ class LLViewerObjectMedia
 class LLAlphaObject : public LLViewerObject
 {
 public:
-	LLAlphaObject(const LLUUID &id, const LLPCode type, LLViewerRegion *regionp)
-	: LLViewerObject(id,type,regionp) 
+	LLAlphaObject(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp)
+	: LLViewerObject(id,pcode,regionp) 
 	{ mDepth = 0.f; }
 
 	virtual F32 getPartSize(S32 idx);
@@ -735,8 +735,8 @@ class LLAlphaObject : public LLViewerObject
 class LLStaticViewerObject : public LLViewerObject
 {
 public:
-	LLStaticViewerObject(const LLUUID& id, const LLPCode type, LLViewerRegion* regionp, BOOL is_global = FALSE)
-		: LLViewerObject(id,type,regionp, is_global)
+	LLStaticViewerObject(const LLUUID& id, const LLPCode pcode, LLViewerRegion* regionp, BOOL is_global = FALSE)
+		: LLViewerObject(id,pcode,regionp, is_global)
 	{ }
 
 	virtual void updateDrawable(BOOL force_damped);
diff --git a/indra/newview/llviewerobjectlist.cpp b/indra/newview/llviewerobjectlist.cpp
index b597e6148ece96f0c23841932f50e1d366fa4e18..f9bf0543c45255c945e368332935f45e5f51e3d1 100644
--- a/indra/newview/llviewerobjectlist.cpp
+++ b/indra/newview/llviewerobjectlist.cpp
@@ -165,6 +165,11 @@ BOOL LLViewerObjectList::removeFromLocalIDTable(const LLViewerObject &object)
 	{
 		U32 local_id = object.mLocalID;
 		LLHost region_host = object.getRegion()->getHost();
+		if(!region_host.isOk())
+		{
+			return FALSE ;
+		}
+
 		U32 ip = region_host.getAddress();
 		U32 port = region_host.getPort();
 		U64 ipport = (((U64)ip) << 32) | (U64)port;
diff --git a/indra/newview/llviewerregion.cpp b/indra/newview/llviewerregion.cpp
index 7fb259e012bf48d781eb959f2c2657054dbb3b35..b684206960b329d900492b2f38d23fb8bb2d490f 100644
--- a/indra/newview/llviewerregion.cpp
+++ b/indra/newview/llviewerregion.cpp
@@ -266,6 +266,7 @@ LLViewerRegion::LLViewerRegion(const U64 &handle,
 	//MUST MATCH declaration of eObjectPartitions
 	mObjectPartition.push_back(new LLHUDPartition());		//PARTITION_HUD
 	mObjectPartition.push_back(new LLTerrainPartition());	//PARTITION_TERRAIN
+	mObjectPartition.push_back(new LLVoidWaterPartition());	//PARTITION_VOIDWATER
 	mObjectPartition.push_back(new LLWaterPartition());		//PARTITION_WATER
 	mObjectPartition.push_back(new LLTreePartition());		//PARTITION_TREE
 	mObjectPartition.push_back(new LLParticlePartition());	//PARTITION_PARTICLE
diff --git a/indra/newview/llviewerregion.h b/indra/newview/llviewerregion.h
index 1ba025312b29462efbb899759147cbe3a838e0ec..8b71998f6054ddbaa7fccb8a1ee94ee317a5e093 100644
--- a/indra/newview/llviewerregion.h
+++ b/indra/newview/llviewerregion.h
@@ -73,6 +73,7 @@ class LLViewerRegion: public LLCapabilityProvider // implements this interface
 	{
 		PARTITION_HUD=0,
 		PARTITION_TERRAIN,
+		PARTITION_VOIDWATER,
 		PARTITION_WATER,
 		PARTITION_TREE,
 		PARTITION_PARTICLE,
diff --git a/indra/newview/llviewershadermgr.cpp b/indra/newview/llviewershadermgr.cpp
index d078c153160eabfa54a62f52213620296b4a1495..c1abead36e4c9d10ae9fe4cad57cd4901f4d9eca 100644
--- a/indra/newview/llviewershadermgr.cpp
+++ b/indra/newview/llviewershadermgr.cpp
@@ -335,8 +335,8 @@ void LLViewerShaderMgr::setShaders()
 	}
 	else
 	{
-			LLPipeline::sRenderGlow = 
-			LLPipeline::sWaterReflections = FALSE;
+		LLPipeline::sRenderGlow = FALSE;
+		LLPipeline::sWaterReflections = FALSE;
 	}
 	
 	//hack to reset buffers that change behavior with shaders
diff --git a/indra/newview/llviewerstats.cpp b/indra/newview/llviewerstats.cpp
index 42266ad233145f37c7e9660389d9f37cf0f3013c..46c78e2bb4210c87a55bc605cfd6b9e2b61e467d 100644
--- a/indra/newview/llviewerstats.cpp
+++ b/indra/newview/llviewerstats.cpp
@@ -558,7 +558,7 @@ F32		gWorstLandCompression = 0.f, gWorstWaterCompression = 0.f;
 U32		gTotalWorldBytes = 0, gTotalObjectBytes = 0, gTotalTextureBytes = 0, gSimPingCount = 0;
 U32		gObjectBits = 0;
 F32		gAvgSimPing = 0.f;
-
+U32     gTotalTextureBytesPerBoostLevel[LLViewerTexture::MAX_GL_IMAGE_CATEGORY] = {0};
 
 extern U32  gVisCompared;
 extern U32  gVisTested;
diff --git a/indra/newview/llviewerstats.h b/indra/newview/llviewerstats.h
index ca977d45999ea73dc391ce20c9dd4771a397edeb..3f9cfb9d9b7c96f849146646f6d30b1f2e03ae84 100644
--- a/indra/newview/llviewerstats.h
+++ b/indra/newview/llviewerstats.h
@@ -264,4 +264,6 @@ void send_stats();
 extern std::map<S32,LLFrameTimer> gDebugTimers;
 extern std::map<S32,std::string> gDebugTimerLabel;
 extern U32	gTotalTextureBytes;
+extern U32  gTotalObjectBytes;
+extern U32  gTotalTextureBytesPerBoostLevel[] ;
 #endif // LL_LLVIEWERSTATS_H
diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp
index 5c262838aef80d05cf57b326473e466d5323359b..f96b93da4d4a9c6bebc3fcad33d7e8bef214f412 100644
--- a/indra/newview/llviewertexture.cpp
+++ b/indra/newview/llviewertexture.cpp
@@ -1130,7 +1130,7 @@ void LLViewerFetchedTexture::init(bool firstinit)
 	// does not contain this image.
 	mIsMissingAsset = FALSE;
 
-	mLoadedCallbackDesiredDiscardLevel = 0;
+	mLoadedCallbackDesiredDiscardLevel = S8_MAX;
 	mPauseLoadedCallBacks = TRUE ;
 
 	mNeedsCreateTexture = FALSE;
@@ -1155,9 +1155,11 @@ void LLViewerFetchedTexture::init(bool firstinit)
 
 	mSavedRawImage = NULL ;
 	mForceToSaveRawImage  = FALSE ;
+	mSaveRawImage = FALSE ;
 	mSavedRawDiscardLevel = -1 ;
 	mDesiredSavedRawDiscardLevel = -1 ;
 	mLastReferencedSavedRawImageTime = 0.0f ;
+	mLastCallBackActiveTime = 0.f;
 }
 
 LLViewerFetchedTexture::~LLViewerFetchedTexture()
@@ -1483,56 +1485,57 @@ void LLViewerFetchedTexture::setKnownDrawSize(S32 width, S32 height)
 //virtual
 void LLViewerFetchedTexture::processTextureStats()
 {
+	static LLCachedControl<bool> textures_fullres(gSavedSettings,"TextureLoadFullRes");
+
 	if(mFullyLoaded)
-	{		
-		if(mDesiredDiscardLevel > mMinDesiredDiscardLevel)//need to load more
+	{
+		if(needsToSaveRawImage())//needs to reload
 		{
-			mDesiredDiscardLevel = llmin(mDesiredDiscardLevel, mMinDesiredDiscardLevel) ;
 			mFullyLoaded = FALSE ;
 		}
-	}
-	else
-	{
-		updateVirtualSize() ;
-		
-		static LLCachedControl<bool> textures_fullres(gSavedSettings,"TextureLoadFullRes");
-		
-		if (textures_fullres)
+		else
 		{
-			mDesiredDiscardLevel = 0;
+			return ;
 		}
-		else if(!mFullWidth || !mFullHeight)
+	}
+
+	//updateVirtualSize() ;	
+	
+	if (textures_fullres)
+	{
+		mDesiredDiscardLevel = 0;
+	}
+	else if(!mFullWidth || !mFullHeight)
+	{
+		mDesiredDiscardLevel = 	llmin(getMaxDiscardLevel(), (S32)mLoadedCallbackDesiredDiscardLevel) ;
+	}
+	else
+	{	
+		if(!mKnownDrawWidth || !mKnownDrawHeight || mFullWidth <= mKnownDrawWidth || mFullHeight <= mKnownDrawHeight)
 		{
-			mDesiredDiscardLevel = 	getMaxDiscardLevel() ;
-		}
-		else
-		{	
-			if(!mKnownDrawWidth || !mKnownDrawHeight || mFullWidth <= mKnownDrawWidth || mFullHeight <= mKnownDrawHeight)
+			if (mFullWidth > MAX_IMAGE_SIZE_DEFAULT || mFullHeight > MAX_IMAGE_SIZE_DEFAULT)
 			{
-				if (mFullWidth > MAX_IMAGE_SIZE_DEFAULT || mFullHeight > MAX_IMAGE_SIZE_DEFAULT)
-				{
-					mDesiredDiscardLevel = 1; // MAX_IMAGE_SIZE_DEFAULT = 1024 and max size ever is 2048
-				}
-				else
-				{
-					mDesiredDiscardLevel = 0;
-				}
-			}
-			else if(mKnownDrawSizeChanged)//known draw size is set
-			{			
-				mDesiredDiscardLevel = (S8)llmin(log((F32)mFullWidth / mKnownDrawWidth) / log_2, 
-													 log((F32)mFullHeight / mKnownDrawHeight) / log_2) ;
-				mDesiredDiscardLevel = 	llclamp(mDesiredDiscardLevel, (S8)0, (S8)getMaxDiscardLevel()) ;
-				mDesiredDiscardLevel = llmin(mDesiredDiscardLevel, mMinDesiredDiscardLevel) ;
+				mDesiredDiscardLevel = 1; // MAX_IMAGE_SIZE_DEFAULT = 1024 and max size ever is 2048
 			}
-			mKnownDrawSizeChanged = FALSE ;
-		
-			if(getDiscardLevel() >= 0 && (getDiscardLevel() <= mDesiredDiscardLevel))
+			else
 			{
-				mFullyLoaded = TRUE ;
+				mDesiredDiscardLevel = 0;
 			}
 		}
-	}
+		else if(mKnownDrawSizeChanged)//known draw size is set
+		{			
+			mDesiredDiscardLevel = (S8)llmin(log((F32)mFullWidth / mKnownDrawWidth) / log_2, 
+												 log((F32)mFullHeight / mKnownDrawHeight) / log_2) ;
+			mDesiredDiscardLevel = 	llclamp(mDesiredDiscardLevel, (S8)0, (S8)getMaxDiscardLevel()) ;
+			mDesiredDiscardLevel = llmin(mDesiredDiscardLevel, mMinDesiredDiscardLevel) ;
+		}
+		mKnownDrawSizeChanged = FALSE ;
+	
+		if(getDiscardLevel() >= 0 && (getDiscardLevel() <= mDesiredDiscardLevel))
+		{
+			mFullyLoaded = TRUE ;
+		}
+	}	
 
 	if(mForceToSaveRawImage && mDesiredSavedRawDiscardLevel >= 0) //force to refetch the texture.
 	{
@@ -2074,13 +2077,14 @@ void LLViewerFetchedTexture::setLoadedCallback( loaded_callback_func loaded_call
 	mNeedsAux |= needs_aux;
 	if(keep_imageraw)
 	{
-		forceToSaveRawImage(discard_level, true) ;
+		mSaveRawImage = TRUE ;
 	}
 	if (mNeedsAux && mAuxRawImage.isNull() && getDiscardLevel() >= 0)
 	{
 		// We need aux data, but we've already loaded the image, and it didn't have any
 		llwarns << "No aux data available for callback for image:" << getID() << llendl;
 	}
+	mLastCallBackActiveTime = sCurrentTime ;
 }
 
 void LLViewerFetchedTexture::clearCallbackEntryList()
@@ -2103,9 +2107,8 @@ void LLViewerFetchedTexture::clearCallbackEntryList()
 	}
 	gTextureList.mCallbackList.erase(this);
 		
-	mMinDesiredDiscardLevel = MAX_DISCARD_LEVEL + 1;
 	mLoadedCallbackDesiredDiscardLevel = S8_MAX ;
-	if(mForceToSaveRawImage)
+	if(needsToSaveRawImage())
 	{
 		destroySavedRawImage() ;
 	}
@@ -2151,14 +2154,13 @@ void LLViewerFetchedTexture::deleteCallbackEntry(const LLLoadedCallbackEntry::so
 	{
 		// If we have no callbacks, take us off of the image callback list.
 		gTextureList.mCallbackList.erase(this);
-		mMinDesiredDiscardLevel = MAX_DISCARD_LEVEL + 1;
-
-		if(mForceToSaveRawImage)
+		
+		if(needsToSaveRawImage())
 		{
 			destroySavedRawImage() ;
 		}
 	}
-	else if(mForceToSaveRawImage && mBoostLevel != LLViewerTexture::BOOST_PREVIEW)
+	else if(needsToSaveRawImage() && mBoostLevel != LLViewerTexture::BOOST_PREVIEW)
 	{
 		if(desired_raw_discard != INVALID_DISCARD_LEVEL)
 		{
@@ -2196,7 +2198,7 @@ void LLViewerFetchedTexture::unpauseLoadedCallbacks(const LLLoadedCallbackEntry:
 	mPauseLoadedCallBacks = FALSE ;
 	if(need_raw)
 	{
-		mForceToSaveRawImage = TRUE ;
+		mSaveRawImage = TRUE ;
 	}
 }
 
@@ -2227,16 +2229,23 @@ void LLViewerFetchedTexture::pauseLoadedCallbacks(const LLLoadedCallbackEntry::s
 	{
 		mPauseLoadedCallBacks = TRUE ;//when set, loaded callback is paused.
 		resetTextureStats();
-		mForceToSaveRawImage = FALSE ;
+		mSaveRawImage = FALSE ;
 	}
 }
 
 bool LLViewerFetchedTexture::doLoadedCallbacks()
 {
+	static const F32 MAX_INACTIVE_TIME = 120.f ; //seconds
+
 	if (mNeedsCreateTexture)
 	{
 		return false;
 	}
+	if(sCurrentTime - mLastCallBackActiveTime > MAX_INACTIVE_TIME)
+	{
+		clearCallbackEntryList() ; //remove all callbacks.
+		return false ;
+	}
 
 	bool res = false;
 	
@@ -2302,13 +2311,11 @@ bool LLViewerFetchedTexture::doLoadedCallbacks()
 	bool run_raw_callbacks = false;
 	bool need_readback = false;
 
-	mMinDesiredDiscardLevel = MAX_DISCARD_LEVEL + 1;
 	for(callback_list_t::iterator iter = mLoadedCallbackList.begin();
 		iter != mLoadedCallbackList.end(); )
 	{
 		LLLoadedCallbackEntry *entryp = *iter++;
-		mMinDesiredDiscardLevel = llmin(mMinDesiredDiscardLevel, (S8)entryp->mDesiredDiscard) ;
-
+	
 		if (entryp->mNeedsImageRaw)
 		{
 			if (mNeedsAux)
@@ -2382,7 +2389,8 @@ bool LLViewerFetchedTexture::doLoadedCallbacks()
 				// to satisfy the interested party, then this is the last time that
 				// we're going to call them.
 
-				llassert_always(mRawImage.notNull());
+				mLastCallBackActiveTime = sCurrentTime ;
+				//llassert_always(mRawImage.notNull());
 				if(mNeedsAux && mAuxRawImage.isNull())
 				{
 					llwarns << "Raw Image with no Aux Data for callback" << llendl;
@@ -2417,6 +2425,7 @@ bool LLViewerFetchedTexture::doLoadedCallbacks()
 			LLLoadedCallbackEntry *entryp = *curiter;
 			if (!entryp->mNeedsImageRaw && (entryp->mLastUsedDiscard > gl_discard))
 			{
+				mLastCallBackActiveTime = sCurrentTime ;
 				BOOL final = gl_discard <= entryp->mDesiredDiscard ? TRUE : FALSE;
 				entryp->mLastUsedDiscard = gl_discard;
 				entryp->mCallback(TRUE, this, NULL, NULL, gl_discard, final, entryp->mUserData);
@@ -2436,7 +2445,6 @@ bool LLViewerFetchedTexture::doLoadedCallbacks()
 	if (mLoadedCallbackList.empty())
 	{
 		gTextureList.mCallbackList.erase(this);
-		mMinDesiredDiscardLevel = MAX_DISCARD_LEVEL + 1;
 	}
 
 	// Done with any raw image data at this point (will be re-created if we still have callbacks)
@@ -2516,6 +2524,11 @@ LLImageRaw* LLViewerFetchedTexture::reloadRawImage(S8 discard_level)
 	return mRawImage;
 }
 
+bool LLViewerFetchedTexture::needsToSaveRawImage()
+{
+	return mForceToSaveRawImage || mSaveRawImage ;
+}
+
 void LLViewerFetchedTexture::destroyRawImage()
 {	
 	if (mAuxRawImage.notNull()) sAuxCount--;
@@ -2526,7 +2539,7 @@ void LLViewerFetchedTexture::destroyRawImage()
 
 		if(mIsRawImageValid)
 		{
-			if(mForceToSaveRawImage)
+			if(needsToSaveRawImage())
 			{
 				saveRawImage() ;
 			}		
@@ -2658,7 +2671,7 @@ void LLViewerFetchedTexture::saveRawImage()
 	mSavedRawDiscardLevel = mRawDiscardLevel ;
 	mSavedRawImage = new LLImageRaw(mRawImage->getData(), mRawImage->getWidth(), mRawImage->getHeight(), mRawImage->getComponents()) ;
 
-	if(mSavedRawDiscardLevel <= mDesiredSavedRawDiscardLevel)
+	if(mForceToSaveRawImage && mSavedRawDiscardLevel <= mDesiredSavedRawDiscardLevel)
 	{
 		mForceToSaveRawImage = FALSE ;
 	}
@@ -2691,13 +2704,10 @@ void LLViewerFetchedTexture::forceToSaveRawImage(S32 desired_discard, bool from_
 void LLViewerFetchedTexture::destroySavedRawImage()
 {
 	clearCallbackEntryList() ;
-	//if(mForceToSaveRawImage && mDesiredSavedRawDiscardLevel >= 0 && mDesiredSavedRawDiscardLevel < getDiscardLevel())
-	//{
-	//	return ; //can not destroy the saved raw image before it is fully fetched, otherwise causing callbacks hanging there.
-	//}
-
+	
 	mSavedRawImage = NULL ;
 	mForceToSaveRawImage  = FALSE ;
+	mSaveRawImage = FALSE ;
 	mSavedRawDiscardLevel = -1 ;
 	mDesiredSavedRawDiscardLevel = -1 ;
 	mLastReferencedSavedRawImageTime = 0.0f ;
diff --git a/indra/newview/llviewertexture.h b/indra/newview/llviewertexture.h
index 7cb8bea4c8f91c419ac42d0e77a3f551b987b364..b779396293ed4de7590bd1a35fc35dfb1d66714b 100644
--- a/indra/newview/llviewertexture.h
+++ b/indra/newview/llviewertexture.h
@@ -441,6 +441,7 @@ class LLViewerFetchedTexture : public LLViewerTexture
 
 	LLImageRaw* reloadRawImage(S8 discard_level) ;
 	void destroyRawImage();
+	bool needsToSaveRawImage();
 
 	const std::string& getUrl() const {return mUrl;}
 	//---------------
@@ -532,6 +533,7 @@ class LLViewerFetchedTexture : public LLViewerTexture
 	S8              mLoadedCallbackDesiredDiscardLevel;
 	BOOL            mPauseLoadedCallBacks;
 	callback_list_t mLoadedCallbackList;
+	F32             mLastCallBackActiveTime;
 
 	LLPointer<LLImageRaw> mRawImage;
 	S32 mRawDiscardLevel;
@@ -543,6 +545,7 @@ class LLViewerFetchedTexture : public LLViewerTexture
 	//keep a copy of mRawImage for some special purposes
 	//when mForceToSaveRawImage is set.
 	BOOL mForceToSaveRawImage ;
+	BOOL mSaveRawImage;
 	LLPointer<LLImageRaw> mSavedRawImage;
 	S32 mSavedRawDiscardLevel;
 	S32 mDesiredSavedRawDiscardLevel;
diff --git a/indra/newview/llviewertexturelist.cpp b/indra/newview/llviewertexturelist.cpp
index bbf7c8e60e9c29ecb6e3d0a230227ad4269f4c73..275dfaa99605fcc790dfba0eab076218727fb1b5 100644
--- a/indra/newview/llviewertexturelist.cpp
+++ b/indra/newview/llviewertexturelist.cpp
@@ -1161,6 +1161,8 @@ void LLViewerTextureList::updateMaxResidentTexMem(S32 mem)
 // static
 void LLViewerTextureList::receiveImageHeader(LLMessageSystem *msg, void **user_data)
 {
+	static LLCachedControl<bool> log_texture_traffic(gSavedSettings,"LogTextureNetworkTraffic") ;
+
 	LLFastTimer t(FTM_PROCESS_IMAGES);
 	
 	// Receive image header, copy into image object and decompresses 
@@ -1171,14 +1173,16 @@ void LLViewerTextureList::receiveImageHeader(LLMessageSystem *msg, void **user_d
 	char ip_string[256];
 	u32_to_ip_string(msg->getSenderIP(),ip_string);
 	
+	U32 received_size ;
 	if (msg->getReceiveCompressedSize())
 	{
-		gTextureList.sTextureBits += msg->getReceiveCompressedSize() * 8;
+		received_size = msg->getReceiveCompressedSize() ;		
 	}
 	else
 	{
-		gTextureList.sTextureBits += msg->getReceiveSize() * 8;
+		received_size = msg->getReceiveSize() ;		
 	}
+	gTextureList.sTextureBits += received_size * 8;
 	gTextureList.sTexturePackets++;
 	
 	U8 codec;
@@ -1213,6 +1217,11 @@ void LLViewerTextureList::receiveImageHeader(LLMessageSystem *msg, void **user_d
 		delete [] data;
 		return;
 	}
+	if(log_texture_traffic)
+	{
+		gTotalTextureBytesPerBoostLevel[image->getBoostLevel()] += received_size ;
+	}
+
 	//image->getLastPacketTimer()->reset();
 	bool res = LLAppViewer::getTextureFetch()->receiveImageHeader(msg->getSender(), id, codec, packets, totalbytes, data_size, data);
 	if (!res)
@@ -1224,6 +1233,8 @@ void LLViewerTextureList::receiveImageHeader(LLMessageSystem *msg, void **user_d
 // static
 void LLViewerTextureList::receiveImagePacket(LLMessageSystem *msg, void **user_data)
 {
+	static LLCachedControl<bool> log_texture_traffic(gSavedSettings,"LogTextureNetworkTraffic") ;
+
 	LLMemType mt1(LLMemType::MTYPE_APPFMTIMAGE);
 	LLFastTimer t(FTM_PROCESS_IMAGES);
 	
@@ -1236,14 +1247,16 @@ void LLViewerTextureList::receiveImagePacket(LLMessageSystem *msg, void **user_d
 	char ip_string[256];
 	u32_to_ip_string(msg->getSenderIP(),ip_string);
 	
+	U32 received_size ;
 	if (msg->getReceiveCompressedSize())
 	{
-		gTextureList.sTextureBits += msg->getReceiveCompressedSize() * 8;
+		received_size = msg->getReceiveCompressedSize() ;
 	}
 	else
 	{
-		gTextureList.sTextureBits += msg->getReceiveSize() * 8;
+		received_size = msg->getReceiveSize() ;		
 	}
+	gTextureList.sTextureBits += received_size * 8;
 	gTextureList.sTexturePackets++;
 	
 	//llprintline("Start decode, image header...");
@@ -1277,6 +1290,11 @@ void LLViewerTextureList::receiveImagePacket(LLMessageSystem *msg, void **user_d
 		delete [] data;
 		return;
 	}
+	if(log_texture_traffic)
+	{
+		gTotalTextureBytesPerBoostLevel[image->getBoostLevel()] += received_size ;
+	}
+
 	//image->getLastPacketTimer()->reset();
 	bool res = LLAppViewer::getTextureFetch()->receiveImagePacket(msg->getSender(), id, packet_num, data_size, data);
 	if (!res)
diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp
index ebcb6e3738acf347c573d3bcb145e1d483ff920f..ea407c8f2915e5d03c25d64d2cca399903b20b6a 100644
--- a/indra/newview/llviewerwindow.cpp
+++ b/indra/newview/llviewerwindow.cpp
@@ -306,6 +306,8 @@ class LLDebugText
 
 	void update()
 	{
+		static LLCachedControl<bool> log_texture_traffic(gSavedSettings,"LogTextureNetworkTraffic") ;
+
 		std::string wind_vel_text;
 		std::string wind_vector_text;
 		std::string rwind_vel_text;
@@ -582,6 +584,23 @@ class LLDebugText
 				ypos += y_inc;
 			}
 		}
+		if(log_texture_traffic)
+		{	
+			U32 old_y = ypos ;
+			for(S32 i = LLViewerTexture::BOOST_NONE; i < LLViewerTexture::MAX_GL_IMAGE_CATEGORY; i++)
+			{
+				if(gTotalTextureBytesPerBoostLevel[i] > 0)
+				{
+					addText(xpos, ypos, llformat("Boost_Level %d:  %.3f MB", i, (F32)gTotalTextureBytesPerBoostLevel[i] / (1024 * 1024)));
+					ypos += y_inc;
+				}
+			}
+			if(ypos != old_y)
+			{
+				addText(xpos, ypos, "Network traffic for textures:");
+				ypos += y_inc;
+			}
+		}
 	}
 
 	void draw()
@@ -1404,6 +1423,11 @@ LLViewerWindow::LLViewerWindow(
 		gSavedSettings.setBOOL("ProbeHardwareOnStartup", FALSE);
 	}
 
+	if (!gGLManager.mHasDepthClamp)
+	{
+		LL_INFOS("RenderInit") << "Missing feature GL_ARB_depth_clamp. Void water might disappear in rare cases." << LL_ENDL;
+	}
+	
 	// If we crashed while initializng GL stuff last time, disable certain features
 	if (gSavedSettings.getBOOL("RenderInitError"))
 	{
diff --git a/indra/newview/llvocache.cpp b/indra/newview/llvocache.cpp
index b1c6ea26cc5876277da044e72fb1460732523df9..145ee31260b94e43d1580fe2e6a129501a6f83a0 100644
--- a/indra/newview/llvocache.cpp
+++ b/indra/newview/llvocache.cpp
@@ -28,6 +28,7 @@
 #include "llvocache.h"
 #include "llerror.h"
 #include "llregionhandle.h"
+#include "llviewercontrol.h"
 
 BOOL check_read(LLAPRFile* apr_file, void* src, S32 n_bytes) 
 {
@@ -231,11 +232,11 @@ LLVOCache* LLVOCache::sInstance = NULL;
 
 //static 
 LLVOCache* LLVOCache::getInstance() 
-{
+{	
 	if(!sInstance)
 	{
 		sInstance = new LLVOCache() ;
-}
+	}
 	return sInstance ;
 }
 
@@ -261,13 +262,17 @@ LLVOCache::LLVOCache():
 	mNumEntries(0),
 	mCacheSize(1)
 {
+	mEnabled = gSavedSettings.getBOOL("ObjectCacheEnabled");
 	mLocalAPRFilePoolp = new LLVolatileAPRPool() ;
 }
 
 LLVOCache::~LLVOCache()
 {
-	writeCacheHeader();
-	clearCacheInMemory();
+	if(mEnabled)
+	{
+		writeCacheHeader();
+		clearCacheInMemory();
+	}
 	delete mLocalAPRFilePoolp;
 }
 
@@ -281,7 +286,7 @@ void LLVOCache::setDirNames(ELLPath location)
 
 void LLVOCache::initCache(ELLPath location, U32 size, U32 cache_version)
 {
-	if(mInitialized)
+	if(mInitialized || !mEnabled)
 	{
 		return ;
 	}
@@ -408,6 +413,11 @@ BOOL LLVOCache::checkWrite(LLAPRFile* apr_file, void* src, S32 n_bytes)
 
 void LLVOCache::readCacheHeader()
 {
+	if(!mEnabled)
+	{
+		return ;
+	}
+
 	//clear stale info.
 	clearCacheInMemory();	
 
@@ -452,7 +462,7 @@ void LLVOCache::readCacheHeader()
 
 void LLVOCache::writeCacheHeader()
 {
-	if(mReadOnly)
+	if(mReadOnly || !mEnabled)
 	{
 		return ;
 	}	
@@ -503,6 +513,10 @@ BOOL LLVOCache::updateEntry(const HeaderEntryInfo* entry)
 
 void LLVOCache::readFromCache(U64 handle, const LLUUID& id, LLVOCacheEntry::vocache_entry_map_t& cache_entry_map) 
 {
+	if(!mEnabled)
+	{
+		return ;
+	}
 	llassert_always(mInitialized);
 
 	handle_entry_map_t::iterator iter = mHandleEntryMap.find(handle) ;
@@ -572,6 +586,10 @@ void LLVOCache::purgeEntries()
 
 void LLVOCache::writeToCache(U64 handle, const LLUUID& id, const LLVOCacheEntry::vocache_entry_map_t& cache_entry_map, BOOL dirty_cache) 
 {
+	if(!mEnabled)
+	{
+		return ;
+	}
 	llassert_always(mInitialized);
 
 	if(mReadOnly)
diff --git a/indra/newview/llvocache.h b/indra/newview/llvocache.h
index ccdff5e96ce2a69c3a0945739271553a3c77e479..ed2bc8bafecbeaa49e600cc2afe1d46e93e7c05f 100644
--- a/indra/newview/llvocache.h
+++ b/indra/newview/llvocache.h
@@ -129,6 +129,7 @@ class LLVOCache
 	BOOL checkWrite(LLAPRFile* apr_file, void* src, S32 n_bytes) ;
 	
 private:
+	BOOL                 mEnabled;
 	BOOL                 mInitialized ;
 	BOOL                 mReadOnly ;
 	HeaderMetaInfo       mMetaInfo;
@@ -143,7 +144,7 @@ class LLVOCache
 	static LLVOCache* sInstance ;
 public:
 	static LLVOCache* getInstance() ;
-	static BOOL       hasInstance() ;
+	static BOOL       hasInstance() ;	
 	static void       destroyClass() ;
 };
 
diff --git a/indra/newview/llvosurfacepatch.cpp b/indra/newview/llvosurfacepatch.cpp
index eba600b50a30b87a95873b783662af4847fff869..2eb43984887adacb618d174a8eb69b04eef146aa 100644
--- a/indra/newview/llvosurfacepatch.cpp
+++ b/indra/newview/llvosurfacepatch.cpp
@@ -80,7 +80,7 @@ class LLVertexBufferTerrain : public LLVertexBuffer
 //============================================================================
 
 LLVOSurfacePatch::LLVOSurfacePatch(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp)
-	:	LLStaticViewerObject(id, LL_VO_SURFACE_PATCH, regionp),
+	:	LLStaticViewerObject(id, pcode, regionp),
 		mDirtiedPatch(FALSE),
 		mPool(NULL),
 		mBaseComp(0),
diff --git a/indra/newview/llvowater.cpp b/indra/newview/llvowater.cpp
index 598938b710f4eff12dbc35cf13a0d6a58d8c2299..9280eb8fa48ded86450bab537fc1700b7d93c049 100644
--- a/indra/newview/llvowater.cpp
+++ b/indra/newview/llvowater.cpp
@@ -61,7 +61,8 @@ const F32 WAVE_STEP_INV	= (1. / WAVE_STEP);
 
 
 LLVOWater::LLVOWater(const LLUUID &id, const LLPCode pcode, LLViewerRegion *regionp)
-:	LLStaticViewerObject(id, LL_VO_WATER, regionp)
+:	LLStaticViewerObject(id, pcode, regionp),
+	mRenderType(LLPipeline::RENDER_TYPE_WATER)
 {
 	// Terrain must draw during selection passes so it can block objects behind it.
 	mbCanSelect = FALSE;
@@ -114,7 +115,7 @@ LLDrawable *LLVOWater::createDrawable(LLPipeline *pipeline)
 {
 	pipeline->allocDrawable(this);
 	mDrawable->setLit(FALSE);
-	mDrawable->setRenderType(LLPipeline::RENDER_TYPE_WATER);
+	mDrawable->setRenderType(mRenderType);
 
 	LLDrawPoolWater *pool = (LLDrawPoolWater*) gPipeline.getPool(LLDrawPool::POOL_WATER);
 
@@ -268,6 +269,11 @@ U32 LLVOWater::getPartitionType() const
 	return LLViewerRegion::PARTITION_WATER; 
 }
 
+U32 LLVOVoidWater::getPartitionType() const
+{
+	return LLViewerRegion::PARTITION_VOIDWATER;
+}
+
 LLWaterPartition::LLWaterPartition()
 : LLSpatialPartition(0, FALSE, 0)
 {
@@ -275,3 +281,9 @@ LLWaterPartition::LLWaterPartition()
 	mDrawableType = LLPipeline::RENDER_TYPE_WATER;
 	mPartitionType = LLViewerRegion::PARTITION_WATER;
 }
+
+LLVoidWaterPartition::LLVoidWaterPartition()
+{
+	mDrawableType = LLPipeline::RENDER_TYPE_VOIDWATER;
+	mPartitionType = LLViewerRegion::PARTITION_VOIDWATER;
+}
diff --git a/indra/newview/llvowater.h b/indra/newview/llvowater.h
index beefc3f17f186c79a0ff3f1304c5510c5868fd87..cb9584cabf6e7292da48f95dbabe00f9d0e638d2 100644
--- a/indra/newview/llvowater.h
+++ b/indra/newview/llvowater.h
@@ -29,6 +29,7 @@
 
 #include "llviewerobject.h"
 #include "llviewertexture.h"
+#include "pipeline.h"
 #include "v2math.h"
 
 const U32 N_RES	= 16; //32			// number of subdivisions of wave tile
@@ -77,6 +78,19 @@ class LLVOWater : public LLStaticViewerObject
 protected:
 	BOOL mUseTexture;
 	BOOL mIsEdgePatch;
+	S32  mRenderType; 
 };
 
+class LLVOVoidWater : public LLVOWater
+{
+public:
+	LLVOVoidWater(LLUUID const& id, LLPCode pcode, LLViewerRegion* regionp) : LLVOWater(id, pcode, regionp)
+	{
+		mRenderType = LLPipeline::RENDER_TYPE_VOIDWATER;
+	}
+
+	/*virtual*/ U32 getPartitionType() const;
+};
+
+
 #endif // LL_VOSURFACEPATCH_H
diff --git a/indra/newview/llworld.cpp b/indra/newview/llworld.cpp
index 5760d04a084aff147368f0b11782df586570ced0..8fabaaba8073b4cbc53bbfb69ba5b2196f6707d6 100644
--- a/indra/newview/llworld.cpp
+++ b/indra/newview/llworld.cpp
@@ -55,6 +55,11 @@
 #include "pipeline.h"
 #include "llappviewer.h"		// for do_disconnect()
 
+#include <deque>
+#include <queue>
+#include <map>
+#include <cstring>
+
 //
 // Globals
 //
@@ -121,7 +126,10 @@ void LLWorld::destroyClass()
 		LLViewerRegion* region_to_delete = *region_it++;
 		removeRegion(region_to_delete->getHost());
 	}
-	LLVOCache::getInstance()->destroyClass() ;
+	if(LLVOCache::hasInstance())
+	{
+		LLVOCache::getInstance()->destroyClass() ;
+	}
 	LLViewerPartSim::getInstance()->destroyClass();
 }
 
@@ -834,10 +842,69 @@ F32 LLWorld::getLandFarClip() const
 
 void LLWorld::setLandFarClip(const F32 far_clip)
 {
+	static S32 const rwidth = (S32)REGION_WIDTH_U32;
+	S32 const n1 = (llceil(mLandFarClip) - 1) / rwidth;
+	S32 const n2 = (llceil(far_clip) - 1) / rwidth;
+	bool need_water_objects_update = n1 != n2;
+
 	mLandFarClip = far_clip;
+
+	if (need_water_objects_update)
+	{
+		updateWaterObjects();
+	}
 }
 
+// Some region that we're connected to, but not the one we're in, gave us
+// a (possibly) new water height. Update it in our local copy.
+void LLWorld::waterHeightRegionInfo(std::string const& sim_name, F32 water_height)
+{
+	for (region_list_t::iterator iter = mRegionList.begin(); iter != mRegionList.end(); ++iter)
+	{
+		if ((*iter)->getName() == sim_name)
+		{
+			(*iter)->setWaterHeight(water_height);
+			break;
+		}
+	}
+}
 
+// There are three types of water objects:
+// Region water objects: the water in a region.
+// Hole water objects: water in the void but within current draw distance.
+// Edge water objects: the water outside the draw distance, up till the horizon.
+//
+// For example:
+//
+// -----------------------horizon-------------------------
+// |                 |                 |                 |
+// |  Edge Water     |                 |                 |
+// |                 |                 |                 |
+// |                 |                 |                 |
+// |                 |                 |                 |
+// |                 |                 |                 |
+// |                 |      rwidth     |                 |
+// |                 |     <----->     |                 |
+// -------------------------------------------------------
+// |                 |Hole |other|     |                 |
+// |                 |Water|reg. |     |                 |
+// |                 |-----------------|                 |
+// |                 |other|cur. |<--> |                 |
+// |                 |reg. | reg.|  \__|_ draw distance  |
+// |                 |-----------------|                 |
+// |                 |     |     |<--->|                 |
+// |                 |     |     |  \__|_ range          |
+// -------------------------------------------------------
+// |                 |<----width------>|<--horizon ext.->|
+// |                 |                 |                 |
+// |                 |                 |                 |
+// |                 |                 |                 |
+// |                 |                 |                 |
+// |                 |                 |                 |
+// |                 |                 |                 |
+// |                 |                 |                 |
+// -------------------------------------------------------
+//
 void LLWorld::updateWaterObjects()
 {
 	if (!gAgent.getRegion())
@@ -850,128 +917,265 @@ void LLWorld::updateWaterObjects()
 		return;
 	}
 
-	// First, determine the min and max "box" of water objects
-	S32 min_x = 0;
-	S32 min_y = 0;
-	S32 max_x = 0;
-	S32 max_y = 0;
+	// Region width in meters.
+	S32 const rwidth = (S32)REGION_WIDTH_U32;
+
+	// The distance we might see into the void
+	// when standing on the edge of a region, in meters.
+	S32 const draw_distance = llceil(mLandFarClip);
+
+	// We can only have "holes" in the water (where there no region) if we
+	// can have existing regions around it. Taking into account that this
+	// code is only executed when we enter a region, and not when we walk
+	// around in it, we (only) need to take into account regions that fall
+	// within the draw_distance.
+	//
+	// Set 'range' to draw_distance, rounded up to the nearest multiple of rwidth.
+	S32 const nsims = (draw_distance + rwidth - 1) / rwidth;
+	S32 const range = nsims * rwidth;
+
+	// Get South-West corner of current region.
+	LLViewerRegion const* regionp = gAgent.getRegion();
 	U32 region_x, region_y;
-
-	S32 rwidth = 256;
-
-	// We only want to fill in water for stuff that's near us, say, within 256 or 512m
-	S32 range = LLViewerCamera::getInstance()->getFar() > 256.f ? 512 : 256;
-
-	LLViewerRegion* regionp = gAgent.getRegion();
 	from_region_handle(regionp->getHandle(), &region_x, &region_y);
 
-	min_x = (S32)region_x - range;
-	min_y = (S32)region_y - range;
-	max_x = (S32)region_x + range;
-	max_y = (S32)region_y + range;
+	// The min. and max. coordinates of the South-West corners of the Hole water objects.
+	S32 const min_x = (S32)region_x - range;
+	S32 const min_y = (S32)region_y - range;
+	S32 const max_x = (S32)region_x + range;
+	S32 const max_y = (S32)region_y + range;
+
+	// Attempt to determine a sensible water height for all the
+	// Hole Water objects.
+	//
+	// It make little sense to try to guess what the best water
+	// height should be when that isn't completely obvious: if it's
+	// impossible to satisfy every region's water height without
+	// getting a jump in the water height.
+	//
+	// In order to keep the reasoning simple, we assume something
+	// logical as a group of connected regions, where the coastline
+	// is at the outer edge. Anything more complex that would "break"
+	// under such an assumption would probably break anyway (would
+	// depend on terrain editing and existing mega prims, say, if
+	// anything would make sense at all).
+	//
+	// So, what we do is find all connected regions within the
+	// draw distance that border void, and then pick the lowest
+	// water height of those (coast) regions.
+	S32 const n = 2 * nsims + 1;
+	S32 const origin = nsims + nsims * n;
+	std::vector<F32> water_heights(n * n);
+	std::vector<U8> checked(n * n, 0);		// index = nx + ny * n + origin;
+	U8 const region_bit = 1;
+	U8 const hole_bit = 2;
+	U8 const bordering_hole_bit = 4;
+	U8 const bordering_edge_bit = 8;
+	// Use the legacy waterheight for the Edge water in the case
+	// that we don't find any Hole water at all.
+	F32 water_height = DEFAULT_WATER_HEIGHT;
+	int max_count = 0;
+	LL_DEBUGS("WaterHeight") << "Current region: " << regionp->getName() << "; water height: " << regionp->getWaterHeight() << " m." << LL_ENDL;
+	std::map<S32, int> water_height_counts;
+	typedef std::queue<std::pair<S32, S32>, std::deque<std::pair<S32, S32> > > nxny_pairs_type;
+	nxny_pairs_type nxny_pairs;
+	nxny_pairs.push(nxny_pairs_type::value_type(0, 0));
+	water_heights[origin] = regionp->getWaterHeight();
+	checked[origin] = region_bit;
+	// For debugging purposes.
+	int number_of_connected_regions = 1;
+	int uninitialized_regions = 0;
+	int bordering_hole = 0;
+	int bordering_edge = 0;
+	while(!nxny_pairs.empty())
+	{
+		S32 const nx = nxny_pairs.front().first;
+		S32 const ny = nxny_pairs.front().second;
+		LL_DEBUGS("WaterHeight") << "nx,ny = " << nx << "," << ny << LL_ENDL;
+		S32 const index = nx + ny * n + origin;
+		nxny_pairs.pop();
+		for (S32 dir = 0; dir < 4; ++dir)
+		{
+			S32 const cnx = nx + gDirAxes[dir][0];
+			S32 const cny = ny + gDirAxes[dir][1];
+			LL_DEBUGS("WaterHeight") << "dir = " << dir << "; cnx,cny = " << cnx << "," << cny << LL_ENDL;
+			S32 const cindex = cnx + cny * n + origin;
+			bool is_hole = false;
+			bool is_edge = false;
+			LLViewerRegion* new_region_found = NULL;
+			if (cnx < -nsims || cnx > nsims ||
+			    cny < -nsims || cny > nsims)
+			{
+				LL_DEBUGS("WaterHeight") << "  Edge Water!" << LL_ENDL;
+				// Bumped into Edge water object.
+				is_edge = true;
+			}
+			else if (checked[cindex])
+			{
+				LL_DEBUGS("WaterHeight") << "  Already checked before!" << LL_ENDL;
+				// Already checked.
+				is_hole = (checked[cindex] & hole_bit);
+			}
+			else
+			{
+				S32 x = (S32)region_x + cnx * rwidth;
+				S32 y = (S32)region_y + cny * rwidth;
+				U64 region_handle = to_region_handle(x, y);
+				new_region_found = getRegionFromHandle(region_handle);
+				is_hole = !new_region_found;
+				checked[cindex] = is_hole ? hole_bit : region_bit;
+			}
+			if (is_hole)
+			{
+				// This was a region that borders at least one 'hole'.
+				// Count the found coastline.
+				F32 new_water_height = water_heights[index];
+				LL_DEBUGS("WaterHeight") << "  This is void; counting coastline with water height of " << new_water_height << LL_ENDL;
+				S32 new_water_height_cm = llround(new_water_height * 100);
+				int count = (water_height_counts[new_water_height_cm] += 1);
+				// Just use the lowest water height: this is mainly about the horizon water,
+				// and whatever we do, we don't want it to be possible to look under the water
+				// when looking in the distance: it is better to make a step downwards in water
+				// height when going away from the avie than a step upwards. However, since
+				// everyone is used to DEFAULT_WATER_HEIGHT, don't allow a single region
+				// to drag the water level below DEFAULT_WATER_HEIGHT on it's own.
+				if (bordering_hole == 0 ||			// First time we get here.
+				    (new_water_height >= DEFAULT_WATER_HEIGHT &&
+					 new_water_height < water_height) ||
+				    (new_water_height < DEFAULT_WATER_HEIGHT &&
+					 count > max_count)
+				   )
+				{
+					water_height = new_water_height;
+				}
+				if (count > max_count)
+				{
+					max_count = count;
+				}
+				if (!(checked[index] & bordering_hole_bit))
+				{
+					checked[index] |= bordering_hole_bit;
+					++bordering_hole;
+				}
+			}
+			else if (is_edge && !(checked[index] & bordering_edge_bit))
+			{
+				checked[index] |= bordering_edge_bit;
+				++bordering_edge;
+			}
+			if (!new_region_found)
+			{
+				// Dead end, there is no region here.
+				continue;
+			}
+			// Found a new connected region.
+			++number_of_connected_regions;
+			if (new_region_found->getName().empty())
+			{
+				// Uninitialized LLViewerRegion, don't use it's water height.
+				LL_DEBUGS("WaterHeight") << "  Uninitialized region." << LL_ENDL;
+				++uninitialized_regions;
+				continue;
+			}
+			nxny_pairs.push(nxny_pairs_type::value_type(cnx, cny));
+			water_heights[cindex] = new_region_found->getWaterHeight();
+			LL_DEBUGS("WaterHeight") << "  Found a new region (name: " << new_region_found->getName() << "; water height: " << water_heights[cindex] << " m)!" << LL_ENDL;
+		}
+	}
+	llinfos << "Number of connected regions: " << number_of_connected_regions << " (" << uninitialized_regions <<
+		" uninitialized); number of regions bordering Hole water: " << bordering_hole <<
+		"; number of regions bordering Edge water: " << bordering_edge << llendl;
+	llinfos << "Coastline count (height, count): ";
+	bool first = true;
+	for (std::map<S32, int>::iterator iter = water_height_counts.begin(); iter != water_height_counts.end(); ++iter)
+	{
+		if (!first) llcont << ", ";
+		llcont << "(" << (iter->first / 100.f) << ", " << iter->second << ")";
+		first = false;
+	}
+	llcont << llendl;
+	llinfos << "Water height used for Hole and Edge water objects: " << water_height << llendl;
 
-	F32 height = 0.f;
-	
-	for (region_list_t::iterator iter = mRegionList.begin();
-		 iter != mRegionList.end(); ++iter)
+	// Update all Region water objects.
+	for (region_list_t::iterator iter = mRegionList.begin(); iter != mRegionList.end(); ++iter)
 	{
 		LLViewerRegion* regionp = *iter;
 		LLVOWater* waterp = regionp->getLand().getWaterObj();
-		height += regionp->getWaterHeight();
 		if (waterp)
 		{
 			gObjectList.updateActive(waterp);
 		}
 	}
 
+	// Clean up all existing Hole water objects.
 	for (std::list<LLVOWater*>::iterator iter = mHoleWaterObjects.begin();
-		 iter != mHoleWaterObjects.end(); ++ iter)
+		 iter != mHoleWaterObjects.end(); ++iter)
 	{
 		LLVOWater* waterp = *iter;
 		gObjectList.killObject(waterp);
 	}
 	mHoleWaterObjects.clear();
 
-	// Now, get a list of the holes
-	S32 x, y;
-	for (x = min_x; x <= max_x; x += rwidth)
+	// Let the Edge and Hole water boxes be 1024 meter high so that they
+	// are never too small to be drawn (A LL_VO_*_WATER box has water
+	// rendered on it's bottom surface only), and put their bottom at
+	// the current regions water height.
+	F32 const box_height = 1024;
+	F32 const water_center_z = water_height + box_height / 2;
+
+	// Create new Hole water objects within 'range' where there is no region.
+	for (S32 x = min_x; x <= max_x; x += rwidth)
 	{
-		for (y = min_y; y <= max_y; y += rwidth)
+		for (S32 y = min_y; y <= max_y; y += rwidth)
 		{
 			U64 region_handle = to_region_handle(x, y);
 			if (!getRegionFromHandle(region_handle))
 			{
-				LLVOWater* waterp = (LLVOWater *)gObjectList.createObjectViewer(LLViewerObject::LL_VO_WATER, gAgent.getRegion());
+				LLVOWater* waterp = (LLVOWater*)gObjectList.createObjectViewer(LLViewerObject::LL_VO_VOID_WATER, gAgent.getRegion());
 				waterp->setUseTexture(FALSE);
-				waterp->setPositionGlobal(LLVector3d(x + rwidth/2,
-													 y + rwidth/2,
-													 256.f+DEFAULT_WATER_HEIGHT));
-				waterp->setScale(LLVector3((F32)rwidth, (F32)rwidth, 512.f));
+				waterp->setPositionGlobal(LLVector3d(x + rwidth / 2, y + rwidth / 2, water_center_z));
+				waterp->setScale(LLVector3((F32)rwidth, (F32)rwidth, box_height));
 				gPipeline.createObject(waterp);
 				mHoleWaterObjects.push_back(waterp);
 			}
 		}
 	}
 
-	// Update edge water objects
-	S32 wx, wy;
-	S32 center_x, center_y;
-	wx = (max_x - min_x) + rwidth;
-	wy = (max_y - min_y) + rwidth;
-	center_x = min_x + (wx >> 1);
-	center_y = min_y + (wy >> 1);
-
-	S32 add_boundary[4] = {
-		512 - (max_x - region_x),
-		512 - (max_y - region_y),
-		512 - (region_x - min_x),
-		512 - (region_y - min_y) };
+	// Center of the region.
+	S32 const center_x = region_x + rwidth / 2;
+	S32 const center_y = region_y + rwidth / 2;
+	// Width of the area with Hole water objects.
+	S32 const width = rwidth + 2 * range;
+	S32 const horizon_extend = 2048 + 512 - range;	// Legacy value.
+	// The overlap is needed to get rid of sky pixels being visible between the
+	// Edge and Hole water object at greater distances (due to floating point
+	// round off errors).
+	S32 const edge_hole_overlap = 1;		// Twice the actual overlap.
 		
-	S32 dir;
-	for (dir = 0; dir < 8; dir++)
+	for (S32 dir = 0; dir < 8; ++dir)
 	{
-		S32 dim[2] = { 0 };
-		switch (gDirAxes[dir][0])
-		{
-		case -1: dim[0] = add_boundary[2]; break;
-		case  0: dim[0] = wx; break;
-		default: dim[0] = add_boundary[0]; break;
-		}
-		switch (gDirAxes[dir][1])
-		{
-		case -1: dim[1] = add_boundary[3]; break;
-		case  0: dim[1] = wy; break;
-		default: dim[1] = add_boundary[1]; break;
-		}
+		// Size of the Edge water objects.
+		S32 const dim_x = (gDirAxes[dir][0] == 0) ? width : (horizon_extend + edge_hole_overlap);
+		S32 const dim_y = (gDirAxes[dir][1] == 0) ? width : (horizon_extend + edge_hole_overlap);
+		// And their position.
+		S32 const water_center_x = center_x + (width + horizon_extend) / 2 * gDirAxes[dir][0];
+		S32 const water_center_y = center_y + (width + horizon_extend) / 2 * gDirAxes[dir][1];
 
-		// Resize and reshape the water objects
-		const S32 water_center_x = center_x + llround((wx + dim[0]) * 0.5f * gDirAxes[dir][0]);
-		const S32 water_center_y = center_y + llround((wy + dim[1]) * 0.5f * gDirAxes[dir][1]);
-		
 		LLVOWater* waterp = mEdgeWaterObjects[dir];
 		if (!waterp || waterp->isDead())
 		{
 			// The edge water objects can be dead because they're attached to the region that the
 			// agent was in when they were originally created.
-			mEdgeWaterObjects[dir] = (LLVOWater *)gObjectList.createObjectViewer(LLViewerObject::LL_VO_WATER,
-																				 gAgent.getRegion());
+			mEdgeWaterObjects[dir] = (LLVOWater *)gObjectList.createObjectViewer(LLViewerObject::LL_VO_VOID_WATER, gAgent.getRegion());
 			waterp = mEdgeWaterObjects[dir];
 			waterp->setUseTexture(FALSE);
-			waterp->setIsEdgePatch(TRUE);
+			waterp->setIsEdgePatch(TRUE);		// Mark that this is edge water and not hole water.
 			gPipeline.createObject(waterp);
 		}
 
 		waterp->setRegion(gAgent.getRegion());
-		LLVector3d water_pos(water_center_x, water_center_y, 
-			DEFAULT_WATER_HEIGHT+256.f);
-		LLVector3 water_scale((F32) dim[0], (F32) dim[1], 512.f);
-
-		//stretch out to horizon
-		water_scale.mV[0] += fabsf(2048.f * gDirAxes[dir][0]);
-		water_scale.mV[1] += fabsf(2048.f * gDirAxes[dir][1]);
-
-		water_pos.mdV[0] += 1024.f * gDirAxes[dir][0];
-		water_pos.mdV[1] += 1024.f * gDirAxes[dir][1];
+		LLVector3d water_pos(water_center_x, water_center_y, water_center_z);
+		LLVector3 water_scale((F32) dim_x, (F32) dim_y, box_height);
 
 		waterp->setPositionGlobal(water_pos);
 		waterp->setScale(water_scale);
diff --git a/indra/newview/llworld.h b/indra/newview/llworld.h
index 4465fde210885eb77890928f1540c0e4955a86b3..c60dc8dc292aaa1e2ca621ca72398b02bdc695f8 100644
--- a/indra/newview/llworld.h
+++ b/indra/newview/llworld.h
@@ -137,6 +137,7 @@ class LLWorld : public LLSingleton<LLWorld>
 
 	LLViewerTexture *getDefaultWaterTexture();
 	void updateWaterObjects();
+	void waterHeightRegionInfo(std::string const& sim_name, F32 water_height);
 	void shiftRegions(const LLVector3& offset);
 
 	void setSpaceTimeUSec(const U64 space_time_usec);
diff --git a/indra/newview/llworldmapview.cpp b/indra/newview/llworldmapview.cpp
index 0c17b5e297c00e4001b731d62fa3b5d9e6758718..8ef3a3b839330c34d32282d1d69aacb6402d03e9 100644
--- a/indra/newview/llworldmapview.cpp
+++ b/indra/newview/llworldmapview.cpp
@@ -880,8 +880,10 @@ void LLWorldMapView::drawFrustum()
 	F32 half_width_meters = far_clip_meters * tan( horiz_fov / 2 );
 	F32 half_width_pixels = half_width_meters * meters_to_pixels;
 	
-	F32 ctr_x = getLocalRect().getWidth() * 0.5f + sPanX;
-	F32 ctr_y = getLocalRect().getHeight() * 0.5f + sPanY;
+	// Compute the frustum coordinates. Take the UI scale into account.
+	F32 ui_scale_factor = gSavedSettings.getF32("UIScaleFactor");
+	F32 ctr_x = (getLocalRect().getWidth() * 0.5f + sPanX)  * ui_scale_factor;
+	F32 ctr_y = (getLocalRect().getHeight() * 0.5f + sPanY) * ui_scale_factor;
 
 	gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
 
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index 03e6e657889a593a2758ff6fba5fa23febcef8e2..e6c6c74fcef5050e8b9345faacab6ebd7c9bf44c 100644
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -629,14 +629,14 @@ void LLPipeline::allocateScreenBuffer(U32 resX, U32 resY)
 //static
 void LLPipeline::updateRenderDeferred()
 {
-	BOOL deferred = (gSavedSettings.getBOOL("RenderDeferred") && 
-		LLRenderTarget::sUseFBO &&
-			 LLFeatureManager::getInstance()->isFeatureAvailable("RenderDeferred") &&
-		gSavedSettings.getBOOL("VertexShaderEnable") && 
-		gSavedSettings.getBOOL("RenderAvatarVP") &&
-			 (gSavedSettings.getBOOL("WindLightUseAtmosShaders")) ? TRUE : FALSE) &&
-		!gUseWireframe;
-	
+	BOOL deferred = ((gSavedSettings.getBOOL("RenderDeferred") && 
+					 LLRenderTarget::sUseFBO &&
+					 LLFeatureManager::getInstance()->isFeatureAvailable("RenderDeferred") &&
+					 gSavedSettings.getBOOL("VertexShaderEnable") && 
+					 gSavedSettings.getBOOL("RenderAvatarVP") &&
+					 gSavedSettings.getBOOL("WindLightUseAtmosShaders")) ? TRUE : FALSE) &&
+					!gUseWireframe;
+
 	sRenderDeferred = deferred;			
 }
 
@@ -1638,20 +1638,14 @@ void LLPipeline::updateCull(LLCamera& camera, LLCullResult& result, S32 water_cl
 
 	camera.disableUserClipPlane();
 
-	if (gSky.mVOSkyp.notNull() && gSky.mVOSkyp->mDrawable.notNull())
+	if (hasRenderType(LLPipeline::RENDER_TYPE_SKY) && 
+		gSky.mVOSkyp.notNull() && 
+		gSky.mVOSkyp->mDrawable.notNull())
 	{
-		// Hack for sky - always visible.
-		if (hasRenderType(LLPipeline::RENDER_TYPE_SKY)) 
-		{
-			gSky.mVOSkyp->mDrawable->setVisible(camera);
-			sCull->pushDrawable(gSky.mVOSkyp->mDrawable);
-			gSky.updateCull();
-			stop_glerror();
-		}
-	}
-	else
-	{
-		llinfos << "No sky drawable!" << llendl;
+		gSky.mVOSkyp->mDrawable->setVisible(camera);
+		sCull->pushDrawable(gSky.mVOSkyp->mDrawable);
+		gSky.updateCull();
+		stop_glerror();
 	}
 
 	if (hasRenderType(LLPipeline::RENDER_TYPE_GROUND) && 
@@ -2221,6 +2215,7 @@ void LLPipeline::stateSort(LLCamera& camera, LLCullResult &result)
 					  LLPipeline::RENDER_TYPE_TERRAIN,
 					  LLPipeline::RENDER_TYPE_TREE,
 					  LLPipeline::RENDER_TYPE_SKY,
+					  LLPipeline::RENDER_TYPE_VOIDWATER,
 					  LLPipeline::RENDER_TYPE_WATER,
 					  LLPipeline::END_RENDER_TYPES))
 	{
@@ -5012,6 +5007,10 @@ void LLPipeline::setLight(LLDrawable *drawablep, BOOL is_light)
 void LLPipeline::toggleRenderType(U32 type)
 {
 	gPipeline.mRenderTypeEnabled[type] = !gPipeline.mRenderTypeEnabled[type];
+	if (type == LLPipeline::RENDER_TYPE_WATER)
+	{
+		gPipeline.mRenderTypeEnabled[LLPipeline::RENDER_TYPE_VOIDWATER] = !gPipeline.mRenderTypeEnabled[LLPipeline::RENDER_TYPE_VOIDWATER];
+	}
 }
 
 //static
@@ -7339,6 +7338,7 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in)
 				gPipeline.pushRenderTypeMask();
 
 				clearRenderTypeMask(LLPipeline::RENDER_TYPE_WATER,
+									LLPipeline::RENDER_TYPE_VOIDWATER,
 									LLPipeline::RENDER_TYPE_GROUND,
 									LLPipeline::RENDER_TYPE_SKY,
 									LLPipeline::RENDER_TYPE_CLOUDS,
@@ -7391,6 +7391,7 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in)
 		{
 			camera.setFar(camera_in.getFar());
 			clearRenderTypeMask(LLPipeline::RENDER_TYPE_WATER,
+								LLPipeline::RENDER_TYPE_VOIDWATER,
 								LLPipeline::RENDER_TYPE_GROUND,
 								END_RENDER_TYPES);	
 			stop_glerror();
@@ -7907,6 +7908,7 @@ void LLPipeline::generateGI(LLCamera& camera, LLVector3& lightDir, std::vector<L
 								 LLPipeline::RENDER_TYPE_TREE, 
 								 LLPipeline::RENDER_TYPE_TERRAIN,
 								 LLPipeline::RENDER_TYPE_WATER,
+								 LLPipeline::RENDER_TYPE_VOIDWATER,
 								 LLPipeline::RENDER_TYPE_PASS_ALPHA_SHADOW,
 								 LLPipeline::RENDER_TYPE_AVATAR,
 								 LLPipeline::RENDER_TYPE_PASS_SIMPLE,
@@ -8090,6 +8092,7 @@ void LLPipeline::generateSunShadow(LLCamera& camera)
 					LLPipeline::RENDER_TYPE_TREE, 
 					LLPipeline::RENDER_TYPE_TERRAIN,
 					LLPipeline::RENDER_TYPE_WATER,
+					LLPipeline::RENDER_TYPE_VOIDWATER,
 					LLPipeline::RENDER_TYPE_PASS_ALPHA_SHADOW,
 					LLPipeline::RENDER_TYPE_PASS_SIMPLE,
 					LLPipeline::RENDER_TYPE_PASS_BUMP,
diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h
index b80765dac680c30f118452a506e95a769cbc05c1..790b5956269cc9e72b416bc79b02b5d04c254f4d 100644
--- a/indra/newview/pipeline.h
+++ b/indra/newview/pipeline.h
@@ -359,6 +359,7 @@ class LLPipeline
 		RENDER_TYPE_AVATAR						= LLDrawPool::POOL_AVATAR,
 		RENDER_TYPE_TREE						= LLDrawPool::POOL_TREE,
 		RENDER_TYPE_INVISIBLE					= LLDrawPool::POOL_INVISIBLE,
+		RENDER_TYPE_VOIDWATER					= LLDrawPool::POOL_VOIDWATER,
 		RENDER_TYPE_WATER						= LLDrawPool::POOL_WATER,
  		RENDER_TYPE_ALPHA						= LLDrawPool::POOL_ALPHA,
 		RENDER_TYPE_GLOW						= LLDrawPool::POOL_GLOW,
diff --git a/indra/newview/skins/default/xui/da/strings.xml b/indra/newview/skins/default/xui/da/strings.xml
index 9f4119e73b28f3f9cea79a78b174d4974bb6d383..afd933c7fab406de4f9dd7bf671a1e372513990c 100644
--- a/indra/newview/skins/default/xui/da/strings.xml
+++ b/indra/newview/skins/default/xui/da/strings.xml
@@ -774,7 +774,7 @@
 	<string name="xml_file">
 		XML Fil
 	</string>
-	<string name="dot_raw_file">
+	<string name="raw_file">
 		RAW Fil
 	</string>
 	<string name="compressed_image_files">
diff --git a/indra/newview/skins/default/xui/de/strings.xml b/indra/newview/skins/default/xui/de/strings.xml
index 5949c433fde0431c1cae737b83e2463da7893e8b..f890506a5dd814247edb1599235cf16a24a55d54 100644
--- a/indra/newview/skins/default/xui/de/strings.xml
+++ b/indra/newview/skins/default/xui/de/strings.xml
@@ -807,7 +807,7 @@
 	<string name="xml_file">
 		XML-Datei
 	</string>
-	<string name="dot_raw_file">
+	<string name="raw_file">
 		RAW-Datei
 	</string>
 	<string name="compressed_image_files">
diff --git a/indra/newview/skins/default/xui/en/alert_line_editor.xml b/indra/newview/skins/default/xui/en/alert_line_editor.xml
index 82bf5fc8dad1463c5487051a29d0a955114eabf3..54dbc698c830f7313e2c6ef5762acc45f2b23f33 100644
--- a/indra/newview/skins/default/xui/en/alert_line_editor.xml
+++ b/indra/newview/skins/default/xui/en/alert_line_editor.xml
@@ -4,7 +4,7 @@
   revert_on_esc="true"
   commit_on_focus_lost="true"
   ignore_tab="true"
-  max_length="254"
+  max_length_bytes="254"
   text_pad_right="0"
   text_pad_left="2"
   mouse_opaque="true"/>
diff --git a/indra/newview/skins/default/xui/en/floater_about_land.xml b/indra/newview/skins/default/xui/en/floater_about_land.xml
index 89ed16e7c2060c48d17b040572cc3a6dbf5d9e92..3dd6c6009501e416ea9bd0bf442042d308a8ac79 100644
--- a/indra/newview/skins/default/xui/en/floater_about_land.xml
+++ b/indra/newview/skins/default/xui/en/floater_about_land.xml
@@ -128,7 +128,7 @@
              height="23"
              layout="topleft"
              left_pad="2"
-             max_length="63"
+             max_length_bytes="63"
              name="Name"
              top_delta="0"
              width="365" />
@@ -255,7 +255,6 @@
             </text>
    <!--TODO: HOOK UP GROUP ICON-->
             <text
-             enabled="false"
              follows="left|top"
              height="16"
              left_pad="2"
@@ -1081,7 +1080,7 @@ Leyla Linden               </text>
              follows="left|top"
              height="23"
              layout="topleft"
-             max_length="6"
+             max_length_bytes="6"
              name="clean other time"
              left_pad="0"
              width="46"
@@ -1625,7 +1624,7 @@ Only large parcels can be listed in search.
              height="23"
              layout="topleft"
              left_pad="0"
-             max_length="255"
+             max_length_bytes="255"
              name="media_url"
              select_on_focus="true"
              width="300"
@@ -1666,7 +1665,7 @@ Only large parcels can be listed in search.
              height="20"
              layout="topleft"
              left="110"
-             max_length="255"
+             max_length_bytes="255"
              name="url_description"
              select_on_focus="true"
              tool_tip="Text displayed next to play/load button"
@@ -1821,7 +1820,7 @@ Only large parcels can be listed in search.
              height="23"
              layout="topleft"
              left="100"
-             max_length="255"
+             max_length_bytes="255"
              name="music_url"
              top_delta="0"
              right="-15"
diff --git a/indra/newview/skins/default/xui/en/floater_bulk_perms.xml b/indra/newview/skins/default/xui/en/floater_bulk_perms.xml
index 457142f11c812fd14f24a4cda2b72c988c9011d7..4e0cfb0cd4750e3502e3d5547e327754cbdc5a10 100644
--- a/indra/newview/skins/default/xui/en/floater_bulk_perms.xml
+++ b/indra/newview/skins/default/xui/en/floater_bulk_perms.xml
@@ -7,7 +7,7 @@
  name="floaterbulkperms"
  help_topic="floaterbulkperms"
  title="EDIT CONTENT PERMISSIONS"
- width="300">
+ width="410">
     <floater.string
      name="nothing_to_modify_text">
         Selection contains no editable contents.
@@ -71,7 +71,7 @@
      control_name="BulkChangeIncludeGestures"
      height="16"
      name="check_gesture"
-     left="65"
+     left="95"
      width="16"
      top="25" />
     <icon
@@ -87,7 +87,7 @@
      height="16"
      layout="topleft"
      name="check_notecard"
-     left="65"
+     left="95"
      width="16"
      top_pad="5" />
     <icon
@@ -102,7 +102,7 @@
      control_name="BulkChangeIncludeObjects"
      height="16"
      name="check_object"
-     left="65"
+     left="95"
      top_pad="5"
      width="16" />
    <icon
@@ -117,7 +117,7 @@
      height="16"
      name="check_script"
      top="25"
-     left="120"
+     left="180"
      width="16"
      />
     <icon
@@ -133,7 +133,7 @@
      height="16"
      name="check_sound"
      top_pad="5"
-     left="120"
+     left="180"
      width="16" />
     <icon
      height="16"
@@ -147,7 +147,7 @@
      height="16"
      name="check_texture"
      top_pad="5"
-     left="120"
+     left="180"
      width="16" />
     <icon
      height="16"
@@ -162,7 +162,7 @@
     layout="topleft"
    name="check_all"
      label="√ All"
-     left="180"
+     left="290"
      top="26"
      width="115">
       <button.commit_callback
@@ -221,7 +221,7 @@
      height="28"
      layout="topleft"
      name="AnyoneLabel"
-     left="104"
+     left="124"
      top="110"
      width="92"
      word_wrap="true">
@@ -243,7 +243,7 @@
      layout="topleft"
      name="NextOwnerLabel"
      top="110"
-     left="189"
+     left="275"
      width="92"
      word_wrap="true">
         Next owner:
@@ -292,7 +292,7 @@
      height="23"
      label="OK"
      layout="topleft"
-     left="95"
+     left="205"
      name="apply"
      top_pad="10"
      width="90">
diff --git a/indra/newview/skins/default/xui/en/floater_buy_currency.xml b/indra/newview/skins/default/xui/en/floater_buy_currency.xml
index 637f9f55d400b741501b25bf3f830e681f28b120..cd5922a9a29a4bbd1d96d8f1df1f6ee3931853ee 100644
--- a/indra/newview/skins/default/xui/en/floater_buy_currency.xml
+++ b/indra/newview/skins/default/xui/en/floater_buy_currency.xml
@@ -114,7 +114,7 @@
     </text>
     <line_editor
      type="string"
-     max_length="10"
+     max_length_bytes="10"
      halign="right"
      font="SansSerifMedium"
      select_on_focus="true"
diff --git a/indra/newview/skins/default/xui/en/floater_god_tools.xml b/indra/newview/skins/default/xui/en/floater_god_tools.xml
index dfe3cf44858abd578e494c8f5843325de7a59e44..e7131e20cbd05c92f83f82abd815a184c50c85b4 100644
--- a/indra/newview/skins/default/xui/en/floater_god_tools.xml
+++ b/indra/newview/skins/default/xui/en/floater_god_tools.xml
@@ -73,7 +73,7 @@
              height="20"
              layout="topleft"
              left_pad="0"
-             max_length="63"
+             max_length_bytes="63"
              name="region name"
              top_delta="0"
              width="250">
@@ -236,7 +236,7 @@
              height="16"
              layout="topleft"
              left_delta="108"
-             max_length="10"
+             max_length_bytes="10"
              name="estate"
              top_delta="0"
              width="50" />
@@ -260,7 +260,7 @@
              height="16"
              layout="topleft"
              left_delta="108"
-             max_length="10"
+             max_length_bytes="10"
              name="parentestate"
              tool_tip="This is the parent estate for this region"
              top_delta="0"
@@ -287,7 +287,7 @@
              height="16"
              layout="topleft"
              left_delta="88"
-             max_length="10"
+             max_length_bytes="10"
              name="gridposx"
              tool_tip="This is the grid x position for this region"
              top_delta="0"
@@ -302,7 +302,7 @@
              height="16"
              layout="topleft"
              left_pad="10"
-             max_length="10"
+             max_length_bytes="10"
              name="gridposy"
              tool_tip="This is the grid y position for this region"
              top_delta="0"
@@ -329,7 +329,7 @@
              height="16"
              layout="topleft"
              left_pad="0"
-             max_length="10"
+             max_length_bytes="10"
              name="redirectx"
              width="50">
 			       <line_editor.commit_callback
@@ -342,7 +342,7 @@
              height="16"
              layout="topleft"
              left_pad="10"
-             max_length="10"
+             max_length_bytes="10"
              name="redirecty"
              top_delta="0"
              width="40">
@@ -754,7 +754,7 @@
              height="22"
              layout="topleft"
              left_pad="10"
-             max_length="63"
+             max_length_bytes="63"
              name="parameter"
              top_delta="0"
              width="290" />
diff --git a/indra/newview/skins/default/xui/en/floater_inventory_item_properties.xml b/indra/newview/skins/default/xui/en/floater_inventory_item_properties.xml
index 2ef52bf5391daa614eabd01cb7c38e8e84098680..29f09dd0b27862d4b9498d270d5573113344b5ea 100644
--- a/indra/newview/skins/default/xui/en/floater_inventory_item_properties.xml
+++ b/indra/newview/skins/default/xui/en/floater_inventory_item_properties.xml
@@ -58,7 +58,7 @@
      height="16"
      layout="topleft"
      left_delta="78"
-     max_length="63"
+     max_length_bytes="63"
      name="LabelItemName"
      top_delta="0"
      width="252" />
@@ -81,7 +81,7 @@
      height="16"
      layout="topleft"
      left_delta="78"
-     max_length="127"
+     max_length_bytes="127"
      name="LabelItemDesc"
      top_delta="0"
      width="252" />
@@ -348,7 +348,7 @@
      height="16"
      layout="topleft"
      left_pad="5"
-     max_length="25"
+     max_length_bytes="25"
      name="EditPrice"
      top_delta="0"
      width="242" /-->
diff --git a/indra/newview/skins/default/xui/en/floater_outfit_save_as.xml b/indra/newview/skins/default/xui/en/floater_outfit_save_as.xml
index 1d73d516d0bc6508597f397216462d61e5d67249..068737494f30a34af05f8f04a23782e425659bf3 100644
--- a/indra/newview/skins/default/xui/en/floater_outfit_save_as.xml
+++ b/indra/newview/skins/default/xui/en/floater_outfit_save_as.xml
@@ -50,7 +50,7 @@ as a new Outfit:
      left_delta="0"
      show_text_as_tentative="false"
      top_pad="0"
-     max_length="63"
+     max_length_bytes="63"
      name="name ed"
      width="200">
         [DESC] (new)
diff --git a/indra/newview/skins/default/xui/en/floater_pay.xml b/indra/newview/skins/default/xui/en/floater_pay.xml
index 7ab565313ea6cd55a00d4f0ffebd5e02ade23225..41a7134b1de1bb812a1b585eb27df5fc8373b054 100644
--- a/indra/newview/skins/default/xui/en/floater_pay.xml
+++ b/indra/newview/skins/default/xui/en/floater_pay.xml
@@ -84,7 +84,7 @@
      top_pad="0"
      layout="topleft"
      left="130"
-     max_length="9"
+     max_length_bytes="9"
      name="amount"
      width="80" />
     <button
diff --git a/indra/newview/skins/default/xui/en/floater_pay_object.xml b/indra/newview/skins/default/xui/en/floater_pay_object.xml
index d8cfed7b09ad11f9bbd85ddd60721579408c93bd..d3a35c205171ac2047f4e64e6d7670d3a954dbc8 100644
--- a/indra/newview/skins/default/xui/en/floater_pay_object.xml
+++ b/indra/newview/skins/default/xui/en/floater_pay_object.xml
@@ -117,7 +117,7 @@
      top_pad="0"
      layout="topleft"
      left="120"
-     max_length="9"
+     max_length_bytes="9"
      name="amount"
      width="80" />
     <button
diff --git a/indra/newview/skins/default/xui/en/floater_post_process.xml b/indra/newview/skins/default/xui/en/floater_post_process.xml
index 05559adf89b26933dddb8144418be649807a01db..05943a10d382f0694ad3b1a67d6a727f311a3394 100644
--- a/indra/newview/skins/default/xui/en/floater_post_process.xml
+++ b/indra/newview/skins/default/xui/en/floater_post_process.xml
@@ -416,7 +416,7 @@
              label="Effect Name"
              layout="topleft"
              left_delta="0"
-             max_length="40"
+             max_length_bytes="40"
              name="PPEffectNameEditor"
              tab_group="1"
              top_pad="22"
diff --git a/indra/newview/skins/default/xui/en/floater_postcard.xml b/indra/newview/skins/default/xui/en/floater_postcard.xml
index 6f78363b2535c62556ed02e535402005abd1459d..b4ecedd9815d3bf0fcea79701d3ef0ccabcc9e44 100644
--- a/indra/newview/skins/default/xui/en/floater_postcard.xml
+++ b/indra/newview/skins/default/xui/en/floater_postcard.xml
@@ -78,7 +78,7 @@
      height="20"
      layout="topleft"
      left_delta="108"
-     max_length="100"
+     max_length_bytes="100"
      name="name_form"
      top_delta="-4"
      width="150" />
@@ -99,7 +99,7 @@
      label="Type your subject here."
      layout="topleft"
      left_delta="108"
-     max_length="100"
+     max_length_bytes="100"
      name="subject_form"
      top_delta="-4"
      width="150" />
diff --git a/indra/newview/skins/default/xui/en/floater_preview_animation.xml b/indra/newview/skins/default/xui/en/floater_preview_animation.xml
index 6dc073728b84f1ba94fbc024d8e7c6fb2ce0ea26..65efc46c7173470a8a77183d1374184589451a8b 100644
--- a/indra/newview/skins/default/xui/en/floater_preview_animation.xml
+++ b/indra/newview/skins/default/xui/en/floater_preview_animation.xml
@@ -32,7 +32,7 @@
      height="19"
      layout="topleft"
      left_delta="95"
-     max_length="127"
+     max_length_bytes="127"
      name="desc"
      top="19"
      width="170" />
diff --git a/indra/newview/skins/default/xui/en/floater_preview_gesture.xml b/indra/newview/skins/default/xui/en/floater_preview_gesture.xml
index 19034019883ae0a3ee79985c64710aa492a66e56..a17cf8eea8ba43df2b56bc8ad507f8356cc9758c 100644
--- a/indra/newview/skins/default/xui/en/floater_preview_gesture.xml
+++ b/indra/newview/skins/default/xui/en/floater_preview_gesture.xml
@@ -80,7 +80,7 @@
      height="20"
      layout="topleft"
      left_delta="89"
-     max_length="31"
+     max_length_bytes="31"
      name="trigger_editor"
      top_delta="-4"
      width="175" />
@@ -104,7 +104,7 @@
      height="20"
      layout="topleft"
      left_delta="99"
-     max_length="31"
+     max_length_bytes="31"
      name="replace_editor"
      tool_tip="Replace the trigger word(s) with these words. For example, trigger &apos;hello&apos; replace with &apos;howdy&apos; will turn the chat &apos;I wanted to say hello&apos; into &apos;I wanted to say howdy&apos; as well as playing the gesture"
      top_delta="-4"
@@ -263,7 +263,7 @@
      height="20"
      layout="topleft"
      left_delta="0"
-     max_length="127"
+     max_length_bytes="127"
      name="chat_editor"
      top="330"
      width="100" />
@@ -316,7 +316,7 @@
      height="20"
      layout="topleft"
      left_pad="10"
-     max_length="15"
+     max_length_bytes="15"
      name="wait_time_editor"
      top_delta="1"
      width="50" />
diff --git a/indra/newview/skins/default/xui/en/floater_preview_notecard.xml b/indra/newview/skins/default/xui/en/floater_preview_notecard.xml
index e5a5fab9b9321f8294681324b9fd0895c5506fac..8c9e1d52b33fd39a32dacfab781ac672e8ea4afe 100644
--- a/indra/newview/skins/default/xui/en/floater_preview_notecard.xml
+++ b/indra/newview/skins/default/xui/en/floater_preview_notecard.xml
@@ -56,7 +56,7 @@
      height="22"
      layout="topleft"
      left_pad="0"
-     max_length="127"
+     max_length_bytes="127"
      name="desc"
      width="296" />
     <text_editor
diff --git a/indra/newview/skins/default/xui/en/floater_preview_sound.xml b/indra/newview/skins/default/xui/en/floater_preview_sound.xml
index f3be8c4131fb2c93d638d643a4b6a520932ca81e..62ef4c3097e8cca9a82c10b3a04b43c3ddfe48ab 100644
--- a/indra/newview/skins/default/xui/en/floater_preview_sound.xml
+++ b/indra/newview/skins/default/xui/en/floater_preview_sound.xml
@@ -32,7 +32,7 @@
      height="19"
      layout="topleft"
      left_pad="0"
-     max_length="127"
+     max_length_bytes="127"
      name="desc"
      width="170" />
     <button
diff --git a/indra/newview/skins/default/xui/en/floater_preview_texture.xml b/indra/newview/skins/default/xui/en/floater_preview_texture.xml
index 7fd7eab867599964950d0d1ec348f55bb3d66848..a79d2f63cb346e1419ac5a87b081adae4d74a8cd 100644
--- a/indra/newview/skins/default/xui/en/floater_preview_texture.xml
+++ b/indra/newview/skins/default/xui/en/floater_preview_texture.xml
@@ -40,7 +40,7 @@
      height="19"
      layout="topleft"
      left_pad="0"
-     max_length="127"
+     max_length_bytes="127"
      name="desc"
      width="190" />
     <text
diff --git a/indra/newview/skins/default/xui/en/floater_report_abuse.xml b/indra/newview/skins/default/xui/en/floater_report_abuse.xml
index 47383c80101db97dbcbb0517ee18523b2dfc76c6..e6d749a3f01a93b7f47f0c5964fb9766d117737f 100644
--- a/indra/newview/skins/default/xui/en/floater_report_abuse.xml
+++ b/indra/newview/skins/default/xui/en/floater_report_abuse.xml
@@ -416,7 +416,7 @@
      height="23"
      layout="topleft"
      left="10"
-     max_length="256"
+     max_length_bytes="256"
      name="abuse_location_edit"
      top_pad="0"
      width="313" />
@@ -441,7 +441,7 @@
      height="23"
      layout="topleft"
      left_delta="0"
-     max_length="64"
+     max_length_bytes="64"
      name="summary_edit"
      top_pad="0"
      width="313" />
diff --git a/indra/newview/skins/default/xui/en/floater_script_preview.xml b/indra/newview/skins/default/xui/en/floater_script_preview.xml
index d0cd00d14715b3f3fe9881cefdcf79325b6a1398..8c03b560400a755999f184eb508d9b1cd1987915 100644
--- a/indra/newview/skins/default/xui/en/floater_script_preview.xml
+++ b/indra/newview/skins/default/xui/en/floater_script_preview.xml
@@ -55,7 +55,7 @@
      height="19"
      layout="topleft"
      left_delta="80"
-     max_length="127"
+     max_length_bytes="127"
      name="desc"
      top_delta="0"
      width="394" />
diff --git a/indra/newview/skins/default/xui/en/floater_sound_preview.xml b/indra/newview/skins/default/xui/en/floater_sound_preview.xml
index ca54ee66049019ea9478b12e82be91260d31e5ce..af791466b6bf55e17289f871ea464e7cd1c24028 100644
--- a/indra/newview/skins/default/xui/en/floater_sound_preview.xml
+++ b/indra/newview/skins/default/xui/en/floater_sound_preview.xml
@@ -27,7 +27,7 @@
      height="19"
      layout="topleft"
      left_delta="0"
-     max_length="63"
+     max_length_bytes="63"
      name="name_form"
      top_pad="0"
      width="280" />
@@ -51,7 +51,7 @@
      height="19"
      layout="topleft"
      left_delta="0"
-     max_length="127"
+     max_length_bytes="127"
      name="description_form"
      top_pad="0"
      width="280" />
diff --git a/indra/newview/skins/default/xui/en/floater_tools.xml b/indra/newview/skins/default/xui/en/floater_tools.xml
index 4c508035be42ed9e1b3c12cae79c3d85c7d8f402..f361cb7f8e26639226fa6678826981fdaca3ab45 100644
--- a/indra/newview/skins/default/xui/en/floater_tools.xml
+++ b/indra/newview/skins/default/xui/en/floater_tools.xml
@@ -831,7 +831,7 @@
              follows="left|top|right"
              height="19"
              left_pad="0"
-             max_length="63"
+             max_length_bytes="63"
              name="Object Name"
              select_on_focus="true"
              top_delta="0"
@@ -849,7 +849,7 @@
              follows="left|top|right"
              height="19"
              left_pad="0"
-             max_length="127"
+             max_length_bytes="127"
              name="Object Description"
              select_on_focus="true"
              top_delta="0"
@@ -965,7 +965,7 @@
              top_pad="10"
              left="10"
              name="label click action"
-             width="98">
+             width="118">
                 Click to:
             </text>
             <combo_box
@@ -973,7 +973,7 @@
              height="23"
              layout="topleft"
              name="clickaction"
-             width="168"
+             width="148"
              left_pad="0">
                 <combo_box.item
                  label="Touch  (default)"
@@ -2554,7 +2554,7 @@ even though the user gets a free copy.
              height="16"
              layout="topleft"
              left="10"
-             max_length="63"
+             max_length_bytes="63"
              name="Home Url"
              select_on_focus="true"
              top="134"
diff --git a/indra/newview/skins/default/xui/en/floater_ui_preview.xml b/indra/newview/skins/default/xui/en/floater_ui_preview.xml
index 3b10a57c500268e0a487a273451d90a1030d853e..12c45617530885b9677f4c40f7920e35f816b5db 100644
--- a/indra/newview/skins/default/xui/en/floater_ui_preview.xml
+++ b/indra/newview/skins/default/xui/en/floater_ui_preview.xml
@@ -241,7 +241,7 @@
              height="20"
              layout="topleft"
              left_delta="100"
-             max_length="300"
+             max_length_bytes="300"
              name="executable_path_field"
              select_on_focus="true"
              tool_tip="The full path to an editor (executable) to edit floater XML files (quotes not necessary)"
@@ -280,7 +280,7 @@
              height="20"
              layout="topleft"
              left_delta="100"
-             max_length="300"
+             max_length_bytes="300"
              name="executable_args_field"
              select_on_focus="true"
              tool_tip="Command-line arguments to the editor; use &apos;%FILE%&apos; to refer to the target file; &apos;YourProgram.exe FileName.xml&apos; will be run if this field is empty"
@@ -321,7 +321,7 @@
              height="20"
              layout="topleft"
              left_delta="65"
-             max_length="300"
+             max_length_bytes="300"
              name="vlt_diff_path_field"
              select_on_focus="true"
              tool_tip="The full path to an XML D0 or D1 localization difference file generated by the Viewer Localization Toolkit"
diff --git a/indra/newview/skins/default/xui/en/floater_world_map.xml b/indra/newview/skins/default/xui/en/floater_world_map.xml
index 20629018e2e86086de1f601eafbb874d4405821f..019e7cd032a5e84c9b0ed5c878c98eb23ba60299 100644
--- a/indra/newview/skins/default/xui/en/floater_world_map.xml
+++ b/indra/newview/skins/default/xui/en/floater_world_map.xml
@@ -541,7 +541,7 @@
       halign="right"
       height="16"
       layout="topleft"
-      left="25"
+      left="15"
       name="events_label"
       top_pad="16"
       width="70">
@@ -574,7 +574,8 @@
         left_delta="47"
         max_val="255"
         min_val="0"
-        name="teleport_coordinate_y" >
+        name="teleport_coordinate_y"
+        width="44" >
         <spinner.commit_callback
           function="WMap.Coordinates" />
       </spinner>
@@ -584,12 +585,13 @@
         follows="right|bottom"
         height="23"
         increment="1"
-        initial_value="128"
+        initial_value="23"
         layout="topleft"
         left_delta="47"
-        max_val="255"
+        max_val="4096"
         min_val="0"
-        name="teleport_coordinate_z">
+        name="teleport_coordinate_z"
+        width="55" >
         <spinner.commit_callback
           function="WMap.Coordinates" />
       </spinner>
diff --git a/indra/newview/skins/default/xui/en/menu_add_wearable_gear.xml b/indra/newview/skins/default/xui/en/menu_add_wearable_gear.xml
index 1925d3396fcfa39673474bc58a90c7c8c2f7e667..5033ea95469df1709f97dead6d9734cf22cbedd0 100644
--- a/indra/newview/skins/default/xui/en/menu_add_wearable_gear.xml
+++ b/indra/newview/skins/default/xui/en/menu_add_wearable_gear.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
-<menu
+<toggleable_menu
  layout="topleft"
  name="Add Wearable Gear Menu">
     <menu_item_check
@@ -38,4 +38,4 @@
          function="AddWearable.Gear.Visible"
          parameter="by_type" />
     </menu_item_check>
-</menu>
+</toggleable_menu>
diff --git a/indra/newview/skins/default/xui/en/menu_cof_gear.xml b/indra/newview/skins/default/xui/en/menu_cof_gear.xml
index c2a11a64ecd3dfc360fd064615bf18eebb86a041..a6e9a40e3148f19463169191af4e996b2b39a93f 100644
--- a/indra/newview/skins/default/xui/en/menu_cof_gear.xml
+++ b/indra/newview/skins/default/xui/en/menu_cof_gear.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
-<menu
+<toggleable_menu
  layout="topleft"
  name="Gear COF">
     <menu
@@ -10,4 +10,4 @@
      label="New Body Parts"
      layout="topleft"
      name="COF.Geear.New_Body_Parts" />
-</menu>
+</toggleable_menu>
diff --git a/indra/newview/skins/default/xui/en/menu_gesture_gear.xml b/indra/newview/skins/default/xui/en/menu_gesture_gear.xml
index 649f0edff77ecb5308f632a06b884af951698959..b08d21e8f4bbcbb46e4f0076034ee899603fd1cb 100644
--- a/indra/newview/skins/default/xui/en/menu_gesture_gear.xml
+++ b/indra/newview/skins/default/xui/en/menu_gesture_gear.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
-<menu
+<toggleable_menu
  layout="topleft"
  mouse_opaque="false"
  name="menu_gesture_gear"
@@ -62,4 +62,4 @@
          function="Gesture.EnableAction"
          parameter="edit_gesture" />
     </menu_item_call>
-</menu>
+</toggleable_menu>
diff --git a/indra/newview/skins/default/xui/en/menu_inspect_avatar_gear.xml b/indra/newview/skins/default/xui/en/menu_inspect_avatar_gear.xml
index 334decdf58eacb988148ab9b3658ccc54f00feae..58d58a6ca9bd30acd7254a954402e235df14eee1 100644
--- a/indra/newview/skins/default/xui/en/menu_inspect_avatar_gear.xml
+++ b/indra/newview/skins/default/xui/en/menu_inspect_avatar_gear.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
-<menu
+<toggleable_menu
          create_jump_keys="true"
          layout="topleft"
          mouse_opaque="false"
@@ -124,4 +124,4 @@
     <menu_item_call.on_click
      function="InspectAvatar.Share"/>
   </menu_item_call>
-</menu>
+</toggleable_menu>
diff --git a/indra/newview/skins/default/xui/en/menu_inspect_object_gear.xml b/indra/newview/skins/default/xui/en/menu_inspect_object_gear.xml
index 76f68c6d4bab1b8bcae779899d7df236bbefb0dd..f818ebe2d7dabe49187173fb8c16e601e59b639d 100644
--- a/indra/newview/skins/default/xui/en/menu_inspect_object_gear.xml
+++ b/indra/newview/skins/default/xui/en/menu_inspect_object_gear.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
-<menu
+<toggleable_menu
    create_jump_keys="true"
    layout="topleft"
    mouse_opaque="false"
@@ -136,4 +136,4 @@
     <menu_item_call.on_click
      function="InspectObject.MoreInfo"/>
   </menu_item_call>
-</menu>
+</toggleable_menu>
diff --git a/indra/newview/skins/default/xui/en/menu_inspect_self_gear.xml b/indra/newview/skins/default/xui/en/menu_inspect_self_gear.xml
index 30c2cde552d3f83777b0bc60daf2b96404e8ec6a..50ad3f834e8383655e493aef9bb24d9e3825399a 100644
--- a/indra/newview/skins/default/xui/en/menu_inspect_self_gear.xml
+++ b/indra/newview/skins/default/xui/en/menu_inspect_self_gear.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
-<menu
+<toggleable_menu
          create_jump_keys="true"
          layout="topleft"
          mouse_opaque="false"
@@ -63,4 +63,4 @@
     <menu_item_call.on_visible
      function="IsGodCustomerService"/>
   </menu_item_call>
-</menu>
+</toggleable_menu>
diff --git a/indra/newview/skins/default/xui/en/menu_inventory_gear_default.xml b/indra/newview/skins/default/xui/en/menu_inventory_gear_default.xml
index c3947000816edb47eaa692dada293ee85067a293..679d5bc82e4582d588fef5630463de6ff410aea4 100644
--- a/indra/newview/skins/default/xui/en/menu_inventory_gear_default.xml
+++ b/indra/newview/skins/default/xui/en/menu_inventory_gear_default.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
-<menu
+<toggleable_menu
  bottom="806"
  layout="topleft"
  left="0"
@@ -125,4 +125,4 @@
          function="Inventory.GearDefault.Custom.Action"
          parameter="empty_trash" />
     </menu_item_call>
-</menu>
+</toggleable_menu>
diff --git a/indra/newview/skins/default/xui/en/menu_outfit_gear.xml b/indra/newview/skins/default/xui/en/menu_outfit_gear.xml
index 732b8a788d6a04f96bd3d92add48839fb21dd424..5fc25b8f0f9c68b738b7297f07c3fff6473d7952 100644
--- a/indra/newview/skins/default/xui/en/menu_outfit_gear.xml
+++ b/indra/newview/skins/default/xui/en/menu_outfit_gear.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
-<menu
+<toggleable_menu
  layout="topleft"
  visible="false"
  name="Gear Outfit">
@@ -212,4 +212,4 @@
          function="Gear.OnVisible"
          parameter="delete" />
     </menu_item_call>
-</menu>
+</toggleable_menu>
diff --git a/indra/newview/skins/default/xui/en/menu_people_friends_view_sort.xml b/indra/newview/skins/default/xui/en/menu_people_friends_view_sort.xml
index 22796f7b68992c5e9102ca5d4ae6c2bbcd8e4d07..29eeb93ac1509adecd912a65ae41664de3c426cf 100644
--- a/indra/newview/skins/default/xui/en/menu_people_friends_view_sort.xml
+++ b/indra/newview/skins/default/xui/en/menu_people_friends_view_sort.xml
@@ -1,5 +1,6 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
-<menu name="menu_group_plus"
+<toggleable_menu
+     name="menu_group_plus"
      left="0" bottom="0" visible="false"
      mouse_opaque="false">
   <menu_item_check
@@ -43,4 +44,4 @@
   <menu_item_call name="show_blocked_list" label="Show Blocked Residents &amp; Objects">
     <menu_item_call.on_click function="SideTray.ShowPanel" parameter="panel_block_list_sidetray" />
   </menu_item_call>
-</menu>
+</toggleable_menu>
diff --git a/indra/newview/skins/default/xui/en/menu_people_groups_view_sort.xml b/indra/newview/skins/default/xui/en/menu_people_groups_view_sort.xml
index 2efb204ffbd578cd3b94874e4948e952ed33b56e..c710fe3b9b71ed820e533613e3c55f992cf04240 100644
--- a/indra/newview/skins/default/xui/en/menu_people_groups_view_sort.xml
+++ b/indra/newview/skins/default/xui/en/menu_people_groups_view_sort.xml
@@ -1,5 +1,6 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
-<menu name="menu_group_plus"
+<toggleable_menu 
+     name="menu_group_plus"
      left="0" bottom="0" visible="false"
      mouse_opaque="false">
   <menu_item_check
@@ -22,4 +23,4 @@
       <menu_item_call.on_enable
        function="People.Group.Minus.Enable"/>
   </menu_item_call>
-</menu>
+</toggleable_menu>
diff --git a/indra/newview/skins/default/xui/en/menu_people_nearby_view_sort.xml b/indra/newview/skins/default/xui/en/menu_people_nearby_view_sort.xml
index 69b383173869479717b71910e98f69e70fb565b6..f9db64b5241f6e19603a0a6f55d23befcaf02f57 100644
--- a/indra/newview/skins/default/xui/en/menu_people_nearby_view_sort.xml
+++ b/indra/newview/skins/default/xui/en/menu_people_nearby_view_sort.xml
@@ -1,5 +1,6 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
-<menu name="menu_group_plus"
+<toggleable_menu
+     name="menu_group_plus"
      left="0" bottom="0" visible="false"
      mouse_opaque="false">
   <menu_item_check
@@ -45,4 +46,4 @@
   <menu_item_call name="show_blocked_list" label="Show Blocked Residents &amp; Objects">
     <menu_item_call.on_click function="SideTray.ShowPanel" userdata="panel_block_list_sidetray" />
   </menu_item_call>
-</menu>
+</toggleable_menu>
diff --git a/indra/newview/skins/default/xui/en/menu_people_recent_view_sort.xml b/indra/newview/skins/default/xui/en/menu_people_recent_view_sort.xml
index 5c9555db92edad1c954c71d3b88e0734df6e907f..0634e3bd3b711f8c4de23df7c1f78b3d272845d5 100644
--- a/indra/newview/skins/default/xui/en/menu_people_recent_view_sort.xml
+++ b/indra/newview/skins/default/xui/en/menu_people_recent_view_sort.xml
@@ -1,5 +1,6 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
-<menu name="menu_group_plus"
+<toggleable_menu 
+     name="menu_group_plus"
      left="0" bottom="0" visible="false"
      mouse_opaque="false">
   <menu_item_check
@@ -35,4 +36,4 @@
   <menu_item_call name="show_blocked_list" label="Show Blocked Residents &amp; Objects">
     <menu_item_call.on_click function="SideTray.ShowPanel" userdata="panel_block_list_sidetray" />
   </menu_item_call>
-</menu>
+</toggleable_menu>
diff --git a/indra/newview/skins/default/xui/en/menu_places_gear_folder.xml b/indra/newview/skins/default/xui/en/menu_places_gear_folder.xml
index 77cc3910fd384208b1f3f9fffcc85966280715a9..6f46165883e4ac868caec8df4b2c280a480d99d4 100644
--- a/indra/newview/skins/default/xui/en/menu_places_gear_folder.xml
+++ b/indra/newview/skins/default/xui/en/menu_places_gear_folder.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
-<menu
+<toggleable_menu
  bottom="806"
  layout="topleft"
  left="0"
@@ -145,4 +145,4 @@
          function="Places.LandmarksGear.Folding.Action"
          parameter="sort_by_date" />
     </menu_item_check>
-</menu>
+</toggleable_menu>
diff --git a/indra/newview/skins/default/xui/en/menu_places_gear_landmark.xml b/indra/newview/skins/default/xui/en/menu_places_gear_landmark.xml
index 4b8bc8132fc511bac8f6362868546f3744cb1efd..121e7cc07ac23761271bf7cae52f205501bc3561 100644
--- a/indra/newview/skins/default/xui/en/menu_places_gear_landmark.xml
+++ b/indra/newview/skins/default/xui/en/menu_places_gear_landmark.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
-<menu
+<toggleable_menu
  bottom="806"
  layout="topleft"
  left="0"
@@ -174,4 +174,4 @@
          function="Places.LandmarksGear.Enable"
          parameter="create_pick" />
     </menu_item_call>
-</menu>
+</toggleable_menu>
diff --git a/indra/newview/skins/default/xui/en/menu_teleport_history_gear.xml b/indra/newview/skins/default/xui/en/menu_teleport_history_gear.xml
index 134b3315144bb567a17fb9b29df79c8ce05cf877..bc7d4fe33be86e06a054b80fbf662d24280ade0e 100644
--- a/indra/newview/skins/default/xui/en/menu_teleport_history_gear.xml
+++ b/indra/newview/skins/default/xui/en/menu_teleport_history_gear.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
-<menu
+<toggleable_menu
  name="Teleport History Gear Context Menu"
  left="0"
  bottom="0"
@@ -33,4 +33,4 @@
         <menu_item_call.on_click
          function="TeleportHistory.ClearTeleportHistory" />
     </menu_item_call>    
-</menu>
+</toggleable_menu>
diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml
index ce628d93b578abca7fe0c6d8be645c1d1cadaea7..b36cf13f1bb194c8d36fd583a539694781663911 100644
--- a/indra/newview/skins/default/xui/en/menu_viewer.xml
+++ b/indra/newview/skins/default/xui/en/menu_viewer.xml
@@ -2761,18 +2761,6 @@
                  function="Floater.Show"
                  parameter="font_test" />
             </menu_item_call>
-            <menu_item_call
-             label="Load from XML"
-             name="Load from XML">
-                <menu_item_call.on_click
-                 function="Advanced.LoadUIFromXML" />
-            </menu_item_call>
-            <menu_item_call
-             label="Save to XML"
-             name="Save to XML">
-                <menu_item_call.on_click
-                 function="Advanced.SaveUIToXML" />
-            </menu_item_call>
             <menu_item_check
              label="Show XUI Names"
              name="Show XUI Names">
@@ -3070,15 +3058,6 @@
 
         <menu_item_separator/>
 
-        <menu_item_check
-         label="Show Admin Menu"
-         name="View Admin Options">
-            <menu_item_check.on_check
-             function="Advanced.CheckViewAdminOptions"
-             parameter="ViewAdminOptions" />
-            <menu_item_check.on_click
-             function="Advanced.ToggleViewAdminOptions" />
-        </menu_item_check>
         <menu_item_call
          label="Request Admin Status"
          name="Request Admin Options"
@@ -3093,6 +3072,17 @@
             <menu_item_call.on_click
              function="Advanced.LeaveAdminStatus" />
         </menu_item_call>
+        <menu_item_check
+         label="Show Admin Menu"
+         name="View Admin Options">
+            <menu_item_check.on_enable
+             function="Advanced.EnableViewAdminOptions" />
+            <menu_item_check.on_check
+             function="Advanced.CheckViewAdminOptions"
+             parameter="ViewAdminOptions" />
+            <menu_item_check.on_click
+             function="Advanced.ToggleViewAdminOptions" />
+        </menu_item_check>
     </menu>
     <menu
      create_jump_keys="true"
diff --git a/indra/newview/skins/default/xui/en/menu_wearing_gear.xml b/indra/newview/skins/default/xui/en/menu_wearing_gear.xml
index 84ab16c70954eb1bfed6ac6bde375129bcad60a8..0ac2c14253500db711a98e9ccf4186ebe2285a3e 100644
--- a/indra/newview/skins/default/xui/en/menu_wearing_gear.xml
+++ b/indra/newview/skins/default/xui/en/menu_wearing_gear.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
-<menu
+<toggleable_menu
  layout="topleft"
  visible="false"
  name="Gear Wearing">
@@ -20,4 +20,4 @@
          function="Gear.OnEnable"
          parameter="take_off" />
     </menu_item_call>
-</menu>
+</toggleable_menu>
diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml
index 83cbcb334489edd2c7a671b5b8f78be571ca44eb..1f747ab997559dd037f844141f1d0b6e192ec7dc 100644
--- a/indra/newview/skins/default/xui/en/notifications.xml
+++ b/indra/newview/skins/default/xui/en/notifications.xml
@@ -1365,6 +1365,14 @@ Could not find &apos;data&apos; chunk in WAV header:
 [FILE]
   </notification>
 
+  <notification
+   icon="alertmodal.tga"
+   name="SoundFileInvalidChunkSize"
+   type="alertmodal">
+Wrong chunk size in WAV file:
+[FILE]
+  </notification>
+
   <notification
    icon="alertmodal.tga"
    name="SoundFileInvalidTooLong"
@@ -6331,7 +6339,6 @@ You sent out an update of your appearance after [TIME] seconds.
 [STATUS]
   </notification>
 
-
   <notification
    icon="notifytip.tga"
    name="AvatarRezCloudNotification"
diff --git a/indra/newview/skins/default/xui/en/panel_edit_classified.xml b/indra/newview/skins/default/xui/en/panel_edit_classified.xml
index 5934956559bb680362785a699e1b71f344b8f749..ce0438fbc98f16832ea3a6705163d48b469246af 100644
--- a/indra/newview/skins/default/xui/en/panel_edit_classified.xml
+++ b/indra/newview/skins/default/xui/en/panel_edit_classified.xml
@@ -119,7 +119,7 @@
          layout="topleft"
          left="10"
          top_pad="2"
-         max_length="30"
+         max_length_bytes="30"
          name="classified_name"
          prevalidate_callback="ascii"
          text_color="black"
diff --git a/indra/newview/skins/default/xui/en/panel_edit_gloves.xml b/indra/newview/skins/default/xui/en/panel_edit_gloves.xml
index a490f27b9facffd2d4fe5d886e91b2b72010c125..8c0c543d716fe1c2e4164e8475746a040b4066d2 100644
--- a/indra/newview/skins/default/xui/en/panel_edit_gloves.xml
+++ b/indra/newview/skins/default/xui/en/panel_edit_gloves.xml
@@ -26,7 +26,7 @@
         default_image_name="Default"
         follows="left|top"
         height="80"
-        label="Fabric"
+        label="Texture"
         layout="topleft"
         left="10"
         name="Fabric"
diff --git a/indra/newview/skins/default/xui/en/panel_edit_jacket.xml b/indra/newview/skins/default/xui/en/panel_edit_jacket.xml
index 929cdffb3d558c579b4edb85168d4440830d08e0..8e8d8e6505e60455425dcb2207c216f4567b3825 100644
--- a/indra/newview/skins/default/xui/en/panel_edit_jacket.xml
+++ b/indra/newview/skins/default/xui/en/panel_edit_jacket.xml
@@ -26,7 +26,7 @@
         default_image_name="Default"
         follows="left|top"
         height="80"
-        label="Upper Fabric"
+        label="Upper Texture"
         layout="topleft"
         left="25"
         name="Upper Fabric"
@@ -41,7 +41,7 @@
         default_image_name="Default"
         follows="left|top"
         height="80"
-        label="Lower Fabric"
+        label="Lower Texture"
         layout="topleft"
         left_pad="20"
         name="Lower Fabric"
diff --git a/indra/newview/skins/default/xui/en/panel_edit_pants.xml b/indra/newview/skins/default/xui/en/panel_edit_pants.xml
index f22cf983aa99f89dcf408df7b1750ff0dfa9f15d..dd749a92596747d72091904363ec3683c72f4afb 100644
--- a/indra/newview/skins/default/xui/en/panel_edit_pants.xml
+++ b/indra/newview/skins/default/xui/en/panel_edit_pants.xml
@@ -26,7 +26,7 @@
         default_image_name="Default"
         follows="left|top"
         height="80"
-        label="Fabric"
+        label="Texture"
         layout="topleft"
         left="10"
         name="Fabric"
diff --git a/indra/newview/skins/default/xui/en/panel_edit_pick.xml b/indra/newview/skins/default/xui/en/panel_edit_pick.xml
index c4b831b71c4f4319c562520ddcaa58b79deebef5..a284d3ccc029c846290f6fc567514aa6d4b92c41 100644
--- a/indra/newview/skins/default/xui/en/panel_edit_pick.xml
+++ b/indra/newview/skins/default/xui/en/panel_edit_pick.xml
@@ -104,7 +104,7 @@
          layout="topleft"
          left="10"
          top_pad="2"
-         max_length="63"
+         max_length_bytes="63"
          name="pick_name"
          text_color="black"
          width="273" />
diff --git a/indra/newview/skins/default/xui/en/panel_edit_shirt.xml b/indra/newview/skins/default/xui/en/panel_edit_shirt.xml
index 85823073b5948bbddffcdb1cb31fad3ac7e5124a..5424b805e18ad4542d0ef7903d43c18dcb38bfeb 100644
--- a/indra/newview/skins/default/xui/en/panel_edit_shirt.xml
+++ b/indra/newview/skins/default/xui/en/panel_edit_shirt.xml
@@ -26,7 +26,7 @@
         default_image_name="Default"
         follows="left|top"
         height="80"
-        label="Fabric"
+        label="Texture"
         layout="topleft"
         left="10"
         name="Fabric"
diff --git a/indra/newview/skins/default/xui/en/panel_edit_shoes.xml b/indra/newview/skins/default/xui/en/panel_edit_shoes.xml
index b26fde68f187d4da393ae367e600fa12d0a7e957..859e7454a4c9154a3a7e0106122bd1fba9447585 100644
--- a/indra/newview/skins/default/xui/en/panel_edit_shoes.xml
+++ b/indra/newview/skins/default/xui/en/panel_edit_shoes.xml
@@ -26,7 +26,7 @@
         default_image_name="Default"
         follows="left|top"
         height="80"
-        label="Fabric"
+        label="Texture"
         layout="topleft"
         left="10"
         name="Fabric"
diff --git a/indra/newview/skins/default/xui/en/panel_edit_skirt.xml b/indra/newview/skins/default/xui/en/panel_edit_skirt.xml
index bb8e0dca07c8265f010186340a1aa6863e5c39d5..76d66cc5dcf0c618ff16aaf37d08ef3fc9468612 100644
--- a/indra/newview/skins/default/xui/en/panel_edit_skirt.xml
+++ b/indra/newview/skins/default/xui/en/panel_edit_skirt.xml
@@ -26,7 +26,7 @@
         default_image_name="Default"
         follows="left|top"
         height="80"
-        label="Fabric"
+        label="Texture"
         layout="topleft"
         left="10"
         name="Fabric"
diff --git a/indra/newview/skins/default/xui/en/panel_edit_socks.xml b/indra/newview/skins/default/xui/en/panel_edit_socks.xml
index d813d94d93f0e6660ded0daee09af76a9f27579a..5f978174b3a2c0befa7c19ef71b458c22fedf2a4 100644
--- a/indra/newview/skins/default/xui/en/panel_edit_socks.xml
+++ b/indra/newview/skins/default/xui/en/panel_edit_socks.xml
@@ -26,7 +26,7 @@
         default_image_name="Default"
         follows="left|top"
         height="80"
-        label="Fabric"
+        label="Texture"
         layout="topleft"
         left="10"
         name="Fabric"
diff --git a/indra/newview/skins/default/xui/en/panel_edit_underpants.xml b/indra/newview/skins/default/xui/en/panel_edit_underpants.xml
index 19225e975717889a9a42c9860d3c33a24eedb0e3..16f28377fb6319a429a16a1412f1687456b490ba 100644
--- a/indra/newview/skins/default/xui/en/panel_edit_underpants.xml
+++ b/indra/newview/skins/default/xui/en/panel_edit_underpants.xml
@@ -26,7 +26,7 @@
              default_image_name="Default"
              follows="left|top"
              height="80"
-             label="Fabric"
+             label="Texture"
              layout="topleft"
              left="10"
              name="Fabric"
diff --git a/indra/newview/skins/default/xui/en/panel_edit_undershirt.xml b/indra/newview/skins/default/xui/en/panel_edit_undershirt.xml
index 720a55dcc201b145ed08440740cd129660982a2f..059485cfb4eed75a941944633cb952dfd78910a6 100644
--- a/indra/newview/skins/default/xui/en/panel_edit_undershirt.xml
+++ b/indra/newview/skins/default/xui/en/panel_edit_undershirt.xml
@@ -26,7 +26,7 @@
         default_image_name="Default"
         follows="left|top"
         height="80"
-        label="Fabric"
+        label="Texture"
         layout="topleft"
         left="10"
         name="Fabric"
diff --git a/indra/newview/skins/default/xui/en/panel_edit_wearable.xml b/indra/newview/skins/default/xui/en/panel_edit_wearable.xml
index b8ef612c6ca8b65edf66f680fea50d4ec7abd1ba..b3e9586ee9347ce30347082e409c33cba3c1dd4b 100644
--- a/indra/newview/skins/default/xui/en/panel_edit_wearable.xml
+++ b/indra/newview/skins/default/xui/en/panel_edit_wearable.xml
@@ -241,7 +241,7 @@
          height="23"
          layout="topleft"
          left="10"
-         max_length="63"
+         max_length_bytes="63"
          name="description"
          prevalidate_callback="ascii"
          select_on_focus="true"
diff --git a/indra/newview/skins/default/xui/en/panel_group_info_sidetray.xml b/indra/newview/skins/default/xui/en/panel_group_info_sidetray.xml
index 3ded5c6678c16c0e53fd5f6424e11a87a6177555..0347d2feec5e540a038751245893cf536325cacf 100644
--- a/indra/newview/skins/default/xui/en/panel_group_info_sidetray.xml
+++ b/indra/newview/skins/default/xui/en/panel_group_info_sidetray.xml
@@ -71,7 +71,7 @@ background_visible="true"
      label="Type your new group name here"
      layout="topleft"
      left_delta="10"
-     max_length="35"
+     max_length_bytes="35"
      name="group_name_editor"
      top_delta="5"
      width="270"
diff --git a/indra/newview/skins/default/xui/en/panel_group_land_money.xml b/indra/newview/skins/default/xui/en/panel_group_land_money.xml
index 2e57c85d6f71201e567f10577bb4b2564ab0d2a9..1270a21710bfafc03a7b9c1be88f51588cc414e8 100644
--- a/indra/newview/skins/default/xui/en/panel_group_land_money.xml
+++ b/indra/newview/skins/default/xui/en/panel_group_land_money.xml
@@ -184,7 +184,7 @@
      height="19"
      layout="topleft"
      left_pad="5"
-     max_length="10"
+     max_length_bytes="10"
      name="your_contribution_line_editor"
      top_delta="0"
      width="80" />
diff --git a/indra/newview/skins/default/xui/en/panel_group_notices.xml b/indra/newview/skins/default/xui/en/panel_group_notices.xml
index 41f2b28004ad97a98051403d73bfd6347c4cdaf8..600b0e3b71ddac9cf9b6dc38b7179dfc6ae43865 100644
--- a/indra/newview/skins/default/xui/en/panel_group_notices.xml
+++ b/indra/newview/skins/default/xui/en/panel_group_notices.xml
@@ -138,7 +138,7 @@ Maximum 200 per group daily
          height="16"
          layout="topleft"
          left_pad="3"
-         max_length="63"
+         max_length_bytes="63"
          name="create_subject"
          prevalidate_callback="ascii"
          width="220" />
@@ -180,7 +180,7 @@ Maximum 200 per group daily
          enabled="false"
          height="19"
          layout="topleft"
-         max_length="90"
+         max_length_bytes="90"
          mouse_opaque="false"
          name="create_inventory_name"
          top_pad="2"
@@ -307,7 +307,7 @@ Maximum 200 per group daily
          height="20"
          layout="topleft"
          left_pad="3"
-         max_length="63"
+         max_length_bytes="63"
          name="view_subject"
          top_delta="-1"
          visible="false"
@@ -341,7 +341,7 @@ Maximum 200 per group daily
          height="20"
          layout="topleft"
          left="5"
-         max_length="63"
+         max_length_bytes="63"
          mouse_opaque="false"
          name="view_inventory_name"
          top_pad="8"
diff --git a/indra/newview/skins/default/xui/en/panel_group_roles.xml b/indra/newview/skins/default/xui/en/panel_group_roles.xml
index 074e9bf5e5813d041c9f2720a133d6ea3e1d1fd6..a7178dc28864d56fb5aae93571ee6431e6d5d396 100644
--- a/indra/newview/skins/default/xui/en/panel_group_roles.xml
+++ b/indra/newview/skins/default/xui/en/panel_group_roles.xml
@@ -390,7 +390,7 @@ things in this group. There&apos;s a broad variety of Abilities.
          left="0"
          follows="left|top|right"
          right="-1"
-         max_length="20"
+         max_length_bytes="20"
          name="role_name"
          top_pad="0"
          width="300">
@@ -413,7 +413,7 @@ things in this group. There&apos;s a broad variety of Abilities.
          left="0"
          follows="left|top|right"
          right="-1"
-         max_length="20"
+         max_length_bytes="20"
          name="role_title"
          top_pad="0"
          width="300">
diff --git a/indra/newview/skins/default/xui/en/panel_landmark_info.xml b/indra/newview/skins/default/xui/en/panel_landmark_info.xml
index f8635b9edbdbf03fa8405341a24b181377450c0a..6ee2abc70fe233329979d1809f99dca8e33c345d 100644
--- a/indra/newview/skins/default/xui/en/panel_landmark_info.xml
+++ b/indra/newview/skins/default/xui/en/panel_landmark_info.xml
@@ -252,7 +252,7 @@
                  height="22"
                  layout="topleft"
                  left="0"
-                 max_length="63"
+                 max_length_bytes="63"
                  name="title_editor"
                  prevalidate_callback="ascii"
                  text_readonly_color="white"
diff --git a/indra/newview/skins/default/xui/en/panel_landmarks.xml b/indra/newview/skins/default/xui/en/panel_landmarks.xml
index 2ae46f79a58f328081b198555b649e6280183387..2a5933e3e93bbc9f5ebe13b07809b2d47beb17a5 100644
--- a/indra/newview/skins/default/xui/en/panel_landmarks.xml
+++ b/indra/newview/skins/default/xui/en/panel_landmarks.xml
@@ -115,7 +115,7 @@
 		       layout="topleft"
 		       name="options_gear_btn_panel"
 		       width="32">
-		          <button
+		          <menu_button
 		           follows="bottom|left"
 		           tool_tip="Show additional options"
 		           height="25"
diff --git a/indra/newview/skins/default/xui/en/panel_login.xml b/indra/newview/skins/default/xui/en/panel_login.xml
index a5d730711c4b4cbc0be088413779769ed093b30d..b181ca3bbad8db1defeb8ea60aceacf2e4d1ac28 100644
--- a/indra/newview/skins/default/xui/en/panel_login.xml
+++ b/indra/newview/skins/default/xui/en/panel_login.xml
@@ -69,7 +69,7 @@ follows="left|bottom"
 height="22"
 label="bobsmith12 or Steller Sunshine"
 left_delta="0"
-max_length="63"
+max_length_bytes="63"
 name="username_edit"
 prevalidate_callback="ascii" 
 select_on_focus="true"
@@ -89,7 +89,7 @@ top="20"
 <line_editor
 follows="left|bottom"
   height="22"
-  max_length="16"
+  max_length_bytes="16"
 name="password_edit"
 select_on_focus="true"
   top_pad="0"
diff --git a/indra/newview/skins/default/xui/en/panel_main_inventory.xml b/indra/newview/skins/default/xui/en/panel_main_inventory.xml
index 16529f4064b0c30d97265c22b5ce86aeefade544..2b6e082542aedf2cdd56fa7b37e56eba58e2140b 100644
--- a/indra/newview/skins/default/xui/en/panel_main_inventory.xml
+++ b/indra/newview/skins/default/xui/en/panel_main_inventory.xml
@@ -119,7 +119,7 @@
        layout="topleft"
        name="options_gear_btn_panel"
        width="32">
-          <button
+          <menu_button
            follows="bottom|left"
            tool_tip="Show additional options"
            height="25"
diff --git a/indra/newview/skins/default/xui/en/panel_nearby_chat_bar.xml b/indra/newview/skins/default/xui/en/panel_nearby_chat_bar.xml
index 55df70eb71009f68c73952c8291b911be9e78747..5871eb06540206df6e97c633b4ae6d26c1bef293 100644
--- a/indra/newview/skins/default/xui/en/panel_nearby_chat_bar.xml
+++ b/indra/newview/skins/default/xui/en/panel_nearby_chat_bar.xml
@@ -17,7 +17,7 @@
      layout="topleft"
      left_delta="3"
      left="0"
-     max_length="1024"
+     max_length_bytes="1023"
      name="chat_box"
      text_pad_left="5"
      text_pad_right="25"
diff --git a/indra/newview/skins/default/xui/en/panel_outfit_edit.xml b/indra/newview/skins/default/xui/en/panel_outfit_edit.xml
index bc050f9ad1c80afe0734c542f86349a9a7471239..f4dee9cd55f30c69e17d600b3fb855ac4703f79a 100644
--- a/indra/newview/skins/default/xui/en/panel_outfit_edit.xml
+++ b/indra/newview/skins/default/xui/en/panel_outfit_edit.xml
@@ -378,7 +378,7 @@ It is calculated as border_size + 2*UIResizeBarOverlap
      name="no_add_wearables_button_bar"
      top_pad="0"
      width="313">
-        <button
+        <menu_button
          follows="bottom|left"
          height="25"
          image_hover_unselected="Toolbar_Left_Over"
@@ -426,7 +426,7 @@ It is calculated as border_size + 2*UIResizeBarOverlap
      top_delta="0"
      visible="false"
      width="313">
-        <button
+        <menu_button
          follows="bottom|left"
          height="25"
          image_hover_unselected="Toolbar_Left_Over"
diff --git a/indra/newview/skins/default/xui/en/panel_outfits_list.xml b/indra/newview/skins/default/xui/en/panel_outfits_list.xml
index d18f0d57ca629efd4f4e2cdef1515170c6aacfbb..9f98019c948ad53a4d746444516041c5736d2a60 100644
--- a/indra/newview/skins/default/xui/en/panel_outfits_list.xml
+++ b/indra/newview/skins/default/xui/en/panel_outfits_list.xml
@@ -35,7 +35,7 @@
 	 visible="true"
 	 name="bottom_panel"
 	 width="312">
-     <button
+     <menu_button
        follows="bottom|left"
        tool_tip="Show additional options"
        height="25"
diff --git a/indra/newview/skins/default/xui/en/panel_outfits_wearing.xml b/indra/newview/skins/default/xui/en/panel_outfits_wearing.xml
index 2fbbf6610c786f14c2778635c3fb07116756f8d1..d85b778db2174ab3f0a7a8cdd59e4c1203998355 100644
--- a/indra/newview/skins/default/xui/en/panel_outfits_wearing.xml
+++ b/indra/newview/skins/default/xui/en/panel_outfits_wearing.xml
@@ -29,7 +29,7 @@
      name="bottom_panel"
      top_pad="0"
      width="312">
-        <button
+        <menu_button
          follows="bottom|left"
          height="25"
          image_hover_unselected="Toolbar_Left_Over"
diff --git a/indra/newview/skins/default/xui/en/panel_people.xml b/indra/newview/skins/default/xui/en/panel_people.xml
index e7a0b768c68e0f1d1c6089b33df38d430177d693..68c423d7dd65cfcf26c4f915c9c339c1050ccc93 100644
--- a/indra/newview/skins/default/xui/en/panel_people.xml
+++ b/indra/newview/skins/default/xui/en/panel_people.xml
@@ -114,7 +114,7 @@ Looking for people to hang out with? Try the [secondlife:///app/worldmap World M
              name="bottom_panel"
              top_pad="0"
              width="313">
-             <button
+             <menu_button
              follows="bottom|left"
              height="25"
              image_hover_unselected="Toolbar_Left_Over"
@@ -242,7 +242,7 @@ Looking for people to hang out with? Try the [secondlife:///app/worldmap World M
 				       layout="topleft"
 				       name="options_gear_btn_panel"
 				       width="32">
-				          <button
+				          <menu_button
 				           follows="bottom|left"
 				           tool_tip="Show additional options"
 				           height="25"
@@ -307,7 +307,7 @@ Looking for people to hang out with? Try the [secondlife:///app/worldmap World M
 				           image_unselected="Toolbar_Right_Off"
 				           left="0"
 				           layout="topleft"
-				           name="trash_btn"
+				           name="del_btn"
 				           tool_tip="Remove selected person from your Friends list"
 				           top="0"
 				           width="31"/>
@@ -407,7 +407,7 @@ Looking for people to hang out with? Try the [secondlife:///app/worldmap World M
              name="bottom_panel"
              top_pad="0"
              width="313">
-               <button
+               <menu_button
                follows="bottom|left"
                tool_tip="Options"
                height="25"
@@ -490,7 +490,7 @@ Looking for people to hang out with? Try the [secondlife:///app/worldmap World M
              name="bottom_panel"
              top_pad="0"
              width="313">
-               <button
+               <menu_button
                follows="bottom|left"
                tool_tip="Options"
                height="25"
@@ -499,7 +499,6 @@ Looking for people to hang out with? Try the [secondlife:///app/worldmap World M
                image_selected="Toolbar_Left_Selected"
                image_unselected="Toolbar_Left_Off"
                layout="topleft"
-               left="3"
                name="recent_viewsort_btn"
                top="1"
                width="31" />
diff --git a/indra/newview/skins/default/xui/en/panel_preferences_advanced.xml b/indra/newview/skins/default/xui/en/panel_preferences_advanced.xml
index 7d9bd1bf2aafc336bd157341b77a2035c2778299..9d496575c9782492ceea67b4196acf14f5af00e4 100644
--- a/indra/newview/skins/default/xui/en/panel_preferences_advanced.xml
+++ b/indra/newview/skins/default/xui/en/panel_preferences_advanced.xml
@@ -280,7 +280,7 @@ Automatic position for:
      enabled_control="EnableVoiceChat"
      height="23"
      left="80"
-     max_length="200"
+     max_length_bytes="200"
      name="modifier_combo"
      label="Push-to-Speak trigger"
      top_pad="5"
diff --git a/indra/newview/skins/default/xui/en/panel_preferences_chat.xml b/indra/newview/skins/default/xui/en/panel_preferences_chat.xml
index 31e160ec3347e469b34a4f2e2a1498eb5c69c090..85824c2576d49d70d2fee7330648d74bb779fd75 100644
--- a/indra/newview/skins/default/xui/en/panel_preferences_chat.xml
+++ b/indra/newview/skins/default/xui/en/panel_preferences_chat.xml
@@ -308,6 +308,38 @@
      width="95">
         URLs
     </text>
+    <spinner
+     control_name="NearbyToastLifeTime"
+     decimal_digits="0"
+     follows="left|top"
+     height="23"
+     increment="1"
+     initial_value="23"
+     label="Nearby chat toasts life time:"
+     label_width="190"
+     layout="topleft"
+     left="290"
+     max_val="60"
+     min_val="1"
+     name="nearby_toasts_lifetime"
+     top_pad="33"
+     width="210" />
+    <spinner
+     control_name="NearbyToastFadingTime"
+     decimal_digits="0"
+     follows="left|top"
+     height="23"
+     increment="1"
+     initial_value="3"
+     label="Nearby chat toasts fading time:"
+     label_width="190"
+     layout="topleft"
+     left_delta="00"
+     max_val="60"
+     min_val="0"
+     name="nearby_toasts_fadingtime"
+     top_pad="15"
+     width="210" />
     <check_box
      control_name="PlayTypingAnim"
      height="16"
@@ -316,7 +348,7 @@
      layout="topleft"
      left="30"
      name="play_typing_animation"
-     top_pad="32"
+     top="205"
      width="400" />
     <check_box
      enabled="false"
@@ -343,7 +375,7 @@
      left="30"
      height="20"
      width="170"
-     top_pad="14">
+     top_pad="7">
      Show IMs in:
     </text>
     <text
@@ -359,14 +391,14 @@
       (requires restart)
       </text>
     <radio_group
+     follows="left|top"
      height="30"
-     layout="topleft"
      left="40"
      control_name="ChatWindow"
      name="chat_window"
      top_pad="0"
      tool_tip="Show your Instant Messages in separate floaters, or in one floater with many tabs (Requires restart)"
-     width="331">
+     width="150">
      <radio_item
       height="16"
       label="Separate windows"
@@ -386,6 +418,36 @@
       top_pad="5"
       width="150" />
     </radio_group>
+    <text
+     name="disable_toast_label"
+     follows="left|top"
+     layout="topleft"
+     top_delta="-22" 
+     left="280" 
+     height="10"
+     width="180">
+      Enable Incoming Chat popups:
+      </text>
+    <check_box
+     control_name="EnableGroupChatPopups"
+     name="EnableGroupChatPopups"
+     label="Group Chats" 
+     layout="topleft"
+     top_delta="18" 
+     left="295" 
+     height="20"
+     tool_tip="Check to see popups when a Group Chat message arrives"
+     width="400" />
+    <check_box
+     control_name="EnableIMChatPopups"
+     name="EnableIMChatPopups"
+     label="IM Chats" 
+     layout="topleft"
+     top_delta="22" 
+     left="295" 
+     height="20"
+     tool_tip="Check to see popups when an instant message arrives"
+     width="400" />
     <check_box
      control_name="TranslateChat"
      enabled="true"
@@ -488,4 +550,4 @@
          name="Korean"
          value="ko" />
     </combo_box>
-</panel>
+</panel>
\ No newline at end of file
diff --git a/indra/newview/skins/default/xui/en/panel_prim_media_controls.xml b/indra/newview/skins/default/xui/en/panel_prim_media_controls.xml
index b25fd695c96cc6151f36cff0b567a9c48a990812..273c2524742b21ede2e5d50feec5021b124d450a 100644
--- a/indra/newview/skins/default/xui/en/panel_prim_media_controls.xml
+++ b/indra/newview/skins/default/xui/en/panel_prim_media_controls.xml
@@ -319,7 +319,7 @@
 		min_width="90">
 	  <line_editor 
 		  name="media_address_url"
-		  max_length="1024"
+		  max_length_bytes="1023"
 		  follows="top|left|right" 
 		  height="22"
 		  top="0"
diff --git a/indra/newview/skins/default/xui/en/panel_script_ed.xml b/indra/newview/skins/default/xui/en/panel_script_ed.xml
index c5c66c04d500a1b1f92972d10a9ede123f131ca0..1e332a40c2ef6101a38df83a021dcd51edc594e0 100644
--- a/indra/newview/skins/default/xui/en/panel_script_ed.xml
+++ b/indra/newview/skins/default/xui/en/panel_script_ed.xml
@@ -141,6 +141,7 @@
      layout="topleft"
      max_length="65536"
      name="Script Editor"
+     text_readonly_color="DkGray"
      width="487"
      show_line_numbers="true" 
      word_wrap="true">
diff --git a/indra/newview/skins/default/xui/en/panel_teleport_history.xml b/indra/newview/skins/default/xui/en/panel_teleport_history.xml
index bf09836e87853bcd903061f309d8777fc041ec1e..768efc2f3f116098c3a1bd45191d549b546d272d 100644
--- a/indra/newview/skins/default/xui/en/panel_teleport_history.xml
+++ b/indra/newview/skins/default/xui/en/panel_teleport_history.xml
@@ -157,7 +157,7 @@
      left="3"
      name="bottom_panel"
      width="313">
-        <button
+        <menu_button
          follows="bottom|left"
          tool_tip="Show additional options"
          height="25"
diff --git a/indra/newview/skins/default/xui/en/sidepanel_item_info.xml b/indra/newview/skins/default/xui/en/sidepanel_item_info.xml
index 8760c911dcfb039220de9250574dcb5533e3e3f7..6940d1549ba249b9ccdb397810dc3312ceb5fc9d 100644
--- a/indra/newview/skins/default/xui/en/sidepanel_item_info.xml
+++ b/indra/newview/skins/default/xui/en/sidepanel_item_info.xml
@@ -118,7 +118,7 @@
                  height="20"
                  layout="topleft"
                  left_delta="78"
-                 max_length="63"
+                 max_length_bytes="63"
                  name="LabelItemName"
                  top_delta="0"
                  width="210" />
@@ -141,7 +141,7 @@
                  height="23"
                  layout="topleft"
                  left_delta="78"
-                 max_length="127"
+                 max_length_bytes="127"
                  name="LabelItemDesc"
                  top_delta="-5"
                  width="210" />
diff --git a/indra/newview/skins/default/xui/en/sidepanel_task_info.xml b/indra/newview/skins/default/xui/en/sidepanel_task_info.xml
index a2f7edb1675f5a91d911ccbd8dfae64ec44b5119..ca63d2df3962f8fe89ac06b57d2d497c7ea92cc5 100644
--- a/indra/newview/skins/default/xui/en/sidepanel_task_info.xml
+++ b/indra/newview/skins/default/xui/en/sidepanel_task_info.xml
@@ -118,7 +118,7 @@
 		     height="20"
 		     layout="topleft"
 	    	 left_delta="78"
-		     max_length="63"
+		     max_length_bytes="63"
              name="Object Name"
 	    	 top_delta="0"
 		     width="225" />
@@ -143,7 +143,7 @@
              name="Object Description"
              select_on_focus="true"
     		 left_delta="78"
-		     max_length="127"
+		     max_length_bytes="127"
 	    	 top_delta="-5"
 	    	 width="225"/>
 	    <text
diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml
index 7f48d60ab2849594dad2987287cf43bc1fe59196..1ec0d34d9a6cfa2e6153fb8ad8dbe7e292ce6a05 100644
--- a/indra/newview/skins/default/xui/en/strings.xml
+++ b/indra/newview/skins/default/xui/en/strings.xml
@@ -338,7 +338,7 @@
 	<string name="avi_movie_file">AVI Movie File</string>
 	<string name="xaf_animation_file">XAF Anim File</string>
 	<string name="xml_file">XML File</string>
-	<string name="dot_raw_file">RAW File</string>
+	<string name="raw_file">RAW File</string>
 	<string name="compressed_image_files">Compressed Images</string>
 	<string name="load_files">Load Files</string>
 	<string name="choose_the_directory">Choose Directory</string>
@@ -2279,8 +2279,7 @@ Requests name of an avatar.  When data is available the dataserver event will be
 	<string name="InvOfferOwnedBy">owned by</string>
 	<string name="InvOfferOwnedByUnknownUser">owned by an unknown user</string>
 	<string name="InvOfferGaveYou">gave you</string>
-	<string name="InvOfferYouDecline">You decline</string>
-	<string name="InvOfferFrom">from</string>
+	<string name="InvOfferDecline">You decline [DESC] from &lt;nolink&gt;[NAME]&lt;/nolink&gt;.</string>
 
 	<!-- group money -->
 	<string name="GroupMoneyTotal">Total</string>
diff --git a/indra/newview/skins/default/xui/en/widgets/avatar_list_item.xml b/indra/newview/skins/default/xui/en/widgets/avatar_list_item.xml
index ed8df69bf40f04b4fd8a371a3d0f0fb60f74aa47..1bb3188cc8aee74c2a02b87b84541b6683712323 100644
--- a/indra/newview/skins/default/xui/en/widgets/avatar_list_item.xml
+++ b/indra/newview/skins/default/xui/en/widgets/avatar_list_item.xml
@@ -1,5 +1,6 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
 <avatar_list_item
+ name_right_pad="5"
  height="0"
  layout="topleft"
  left="0"
diff --git a/indra/newview/skins/default/xui/es/floater_tools.xml b/indra/newview/skins/default/xui/es/floater_tools.xml
index 9b25c4bdd104a737215c423d0d445311f5a92631..d85b43b7e8688ee658e20cb699a1989d6b7c0486 100644
--- a/indra/newview/skins/default/xui/es/floater_tools.xml
+++ b/indra/newview/skins/default/xui/es/floater_tools.xml
@@ -186,10 +186,10 @@
 			<button label="Configurar..." label_selected="Configurar..." name="button set group" tool_tip="Elige un grupo con el que compartir los permisos de este objeto"/>
 			<check_box label="Compartir" name="checkbox share with group" tool_tip="Permite que todos los miembros del grupo compartan tus permisos de modificación en este objeto. Debes transferirlo para activar las restricciones según los roles."/>
 			<button label="Transferir" label_selected="Transferir" name="button deed" tool_tip="La transferencia entrega este objeto con los permisos del próximo propietario. Los objetos compartidos por el grupo pueden ser transferidos por un oficial del grupo."/>
-			<text name="label click action" width="180">
+			<text name="label click action">
 				Al tocarlo:
 			</text>
-			<combo_box name="clickaction" width="192">
+			<combo_box name="clickaction">
 				<combo_box.item label="Tocarlo (por defecto)" name="Touch/grab(default)"/>
 				<combo_box.item label="Sentarse en el objeto" name="Sitonobject"/>
 				<combo_box.item label="Comprar el objeto" name="Buyobject"/>
diff --git a/indra/newview/skins/default/xui/es/strings.xml b/indra/newview/skins/default/xui/es/strings.xml
index a1a7d9e193ee94450e2b5a024dccd37f510f7a54..0be827f5f7323f7978fc05addc61fd5345110a6f 100644
--- a/indra/newview/skins/default/xui/es/strings.xml
+++ b/indra/newview/skins/default/xui/es/strings.xml
@@ -786,7 +786,7 @@
 	<string name="xml_file">
 		Archivo XML
 	</string>
-	<string name="dot_raw_file">
+	<string name="raw_file">
 		Archivo RAW
 	</string>
 	<string name="compressed_image_files">
diff --git a/indra/newview/skins/default/xui/fr/floater_tools.xml b/indra/newview/skins/default/xui/fr/floater_tools.xml
index eeb7b8ffaa8d4775eaae7d52e9dcb9a7ee389cc5..46a27e960cf5742098fe8114fbff081b0c44a148 100644
--- a/indra/newview/skins/default/xui/fr/floater_tools.xml
+++ b/indra/newview/skins/default/xui/fr/floater_tools.xml
@@ -189,7 +189,7 @@
 			<text name="label click action">
 				Cliquer pour :
 			</text>
-			<combo_box name="clickaction" width="178">
+			<combo_box name="clickaction">
 				<combo_box.item label="Toucher (par défaut)" name="Touch/grab(default)"/>
 				<combo_box.item label="S&apos;asseoir sur l&apos;objet" name="Sitonobject"/>
 				<combo_box.item label="Acheter l&apos;objet" name="Buyobject"/>
diff --git a/indra/newview/skins/default/xui/fr/strings.xml b/indra/newview/skins/default/xui/fr/strings.xml
index 20f007a54e950525cf49e82eeabe3a654a345006..d6c701dc904a7c84f270387f976607f75fe62c8e 100644
--- a/indra/newview/skins/default/xui/fr/strings.xml
+++ b/indra/newview/skins/default/xui/fr/strings.xml
@@ -807,7 +807,7 @@
 	<string name="xml_file">
 		Fichier XML
 	</string>
-	<string name="dot_raw_file">
+	<string name="raw_file">
 		Fichier RAW
 	</string>
 	<string name="compressed_image_files">
diff --git a/indra/newview/skins/default/xui/it/strings.xml b/indra/newview/skins/default/xui/it/strings.xml
index 4fc0d19199bf4e71f5a095d45d91fc589d619017..9dbfc2b79c9851acc3fe9d559ad8819c6a9d5744 100644
--- a/indra/newview/skins/default/xui/it/strings.xml
+++ b/indra/newview/skins/default/xui/it/strings.xml
@@ -783,7 +783,7 @@
 	<string name="xml_file">
 		File XML
 	</string>
-	<string name="dot_raw_file">
+	<string name="raw_file">
 		File RAW
 	</string>
 	<string name="compressed_image_files">
diff --git a/indra/newview/skins/default/xui/ja/floater_bulk_perms.xml b/indra/newview/skins/default/xui/ja/floater_bulk_perms.xml
index be24960c6ef6328bd14010333be37cdabf3b6c6f..d8d0164618177e41c4c3723ce8f1cb9467a36fa8 100644
--- a/indra/newview/skins/default/xui/ja/floater_bulk_perms.xml
+++ b/indra/newview/skins/default/xui/ja/floater_bulk_perms.xml
@@ -43,7 +43,7 @@
 		全員:
 	</text>
 	<check_box label="コピー" name="everyone_copy"/>
-	<text name="NextOwnerLabel" left="160">
+	<text name="NextOwnerLabel">
 		次の所有者:
 	</text>
 	<check_box label="修正" name="next_owner_modify"/>
diff --git a/indra/newview/skins/default/xui/ja/strings.xml b/indra/newview/skins/default/xui/ja/strings.xml
index 072ae6c63033a4dbae643bbf84fea89670d40c39..92bbedaee52e06dea5bbe63088ba4cf8c2cb54ee 100644
--- a/indra/newview/skins/default/xui/ja/strings.xml
+++ b/indra/newview/skins/default/xui/ja/strings.xml
@@ -798,7 +798,7 @@
 	<string name="xml_file">
 		XML ファイル
 	</string>
-	<string name="dot_raw_file">
+	<string name="raw_file">
 		RAW ファイル
 	</string>
 	<string name="compressed_image_files">
diff --git a/indra/newview/skins/default/xui/nl/floater_tools.xml b/indra/newview/skins/default/xui/nl/floater_tools.xml
index 212cac0a5ba59a3b230fd15b199c1885eb719142..d49ffc2f51225369b1385b6bd5c40ccaa7b3c81a 100644
--- a/indra/newview/skins/default/xui/nl/floater_tools.xml
+++ b/indra/newview/skins/default/xui/nl/floater_tools.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<floater name="toolbox floater" title="" short_title="BOUWEN" width="288">
+<floater name="toolbox floater" title="" short_title="BOUWEN" height="587">
 	<button label="" label_selected="" name="button focus" tool_tip="Focus"/>
 	<button label="" label_selected="" name="button move" tool_tip="Verplaats"/>
 	<button label="" label_selected="" name="button edit" tool_tip="Bewerk"/>
@@ -25,7 +25,7 @@
 	<text name="text ruler mode">
 		Liniaal:
 	</text>
-	<combo_box name="combobox grid mode" width="78" left_delta="38">
+	<combo_box name="combobox grid mode">
 		<combo_box.item name="World" label="Wereld"
 		/>
 		<combo_box.item name="Local" label="Lokaal"
@@ -81,13 +81,13 @@
 	<text name="Strength:">
 		Sterkte
 	</text>
-	<text name="obj_count" left="134">
+	<text name="obj_count" top_pad="15">
 		Geselecteerde objecten: [COUNT]
 	</text>
-	<text name="prim_count" left="134">
+	<text name="prim_count">
 		primitieven: [COUNT]
 	</text>
-	<tab_container name="Object Info Tabs" tab_max_width="62" tab_min_width="30" width="288">
+	<tab_container name="Object Info Tabs" tab_max_width="62" tab_min_width="30" top="180">
 		<panel label="Algemeen" name="General">
 			<text name="Name:">
 				Naam:
@@ -115,19 +115,19 @@
 			<text name="Group Name Proxy">
 				De Lindens
 			</text>
-			<button label="Instellen..." label_selected="Instellen..." name="button set group"/>
+			<button label="Instellen..." label_selected="Instellen..." name="button set group" left_pad="13"/>
 			<text name="Permissions:">
 				Permissies:
 			</text>
 
-			<check_box label="Deel met groep" name="checkbox share with group" tool_tip="Alle leden van de ingestelde groep toestaan om te delen en uw permissies voor dit object te gebruiken. U moet &apos;Overdragen&apos; om rolbeperkingen in te schakelen."/>
+			<check_box label="Deel met groep" name="checkbox share with group" tool_tip="Alle leden van de ingestelde groep toestaan om te delen en uw permissies voor dit object te gebruiken. U moet &apos;Overdragen&apos; om rolbeperkingen in te schakelen." left="100"/>
 			<string name="text deed continued">
 				Overdragen...
 			</string>
 			<string name="text deed">
 				Overdragen
 			</string>
-			<button label="Overdragen..." label_selected="Overdragen..." name="button deed" tool_tip="Groepgedeelde objecten kunnen door een groepofficier worden overgedragen"/>
+			<button label="Overdragen..." label_selected="Overdragen..." name="button deed" tool_tip="Groepgedeelde objecten kunnen door een groepofficier worden overgedragen" left_pad="19"/>
 			<check_box label="Iedereen mag verplaatsen" name="checkbox allow everyone move"/>
 			<check_box label="Iedereen mag kopiëren" name="checkbox allow everyone copy"/>
 			<check_box label="Toon in zoeken" name="search_check" tool_tip="Laat mensen dit object zien in zoekresultaten"/>
@@ -144,7 +144,7 @@
 			<text name="label click action">
 				Wanneer links-geklikt:
 			</text>
-			<combo_box name="clickaction" width="178">
+			<combo_box name="clickaction">
 				<combo_box.item name="Touch/grab(default)" label="Aanraken/pakken (standaard)"
 				/>
 				<combo_box.item name="Sitonobject" label="Zit op object"
@@ -406,7 +406,7 @@
 			<text name="glow label">
 				Gloed
 			</text>
-			<check_box label="Volledige helderheid" name="checkbox fullbright"/>
+			<check_box label="Volledige helderheid" name="checkbox fullbright" left_delta="-10"/>
 			<text name="tex gen">
 				Mapping
 			</text>
diff --git a/indra/newview/skins/default/xui/nl/notifications.xml b/indra/newview/skins/default/xui/nl/notifications.xml
index a282c7036450ebc37f7ea0bcc59eac4ea681399d..b4b56a035ff55204ce95f82819382f57d08f8a3b 100644
--- a/indra/newview/skins/default/xui/nl/notifications.xml
+++ b/indra/newview/skins/default/xui/nl/notifications.xml
@@ -2409,10 +2409,10 @@ Wilt u de [SECOND_LIFE] website bezoeken om dit in te stellen?
 		Onderwerp: [SUBJECT], Bericht: [MESSAGE]
 	</notification>
 	<notification name="FriendOnline">
-		[FIRST] [LAST] is Online
+		[NAME] is Online
 	</notification>
 	<notification name="FriendOffline">
-		[FIRST] [LAST] is Offline
+		[NAME] is Offline
 	</notification>
 	<notification name="AddSelfFriend">
 		U kunt uzelf niet als vriend toevoegen.
@@ -2574,7 +2574,7 @@ Indien u streaming media wilt zien op percelen die dit ondersteunen, dient u naa
 		De objecten die uw eigendom zijn op het geselecteerde perceel zijn geretourneerd naar uw inventaris.
 	</notification>
 	<notification name="OtherObjectsReturned">
-		De objecten op het geselecteerde perceel dat het eigendom is van [FIRST] [LAST], zijn geretourneerd naar zijn of haar inventaris.
+		De objecten op het geselecteerde perceel dat het eigendom is van [NAME], zijn geretourneerd naar zijn of haar inventaris.
 	</notification>
 	<notification name="OtherObjectsReturned2">
 		De objecten op het geselecteerde perceel dat het eigendom is van inwoner &apos;[NAME]&apos;, zijn geretourneerd naar hun eigenaar.
@@ -2701,7 +2701,7 @@ Probeer het alstublieft opnieuw over enkele ogenblikken.
 		Geen geldig perceel kon gevonden worden.
 	</notification>
 	<notification name="ObjectGiveItem">
-		Een object genaamd [OBJECTFROMNAME], eigendom van [FIRST] [LAST], heeft u een [OBJECTTYPE] genaamd [OBJECTNAME] gegeven.
+		Een object genaamd &lt;nolink&gt;[OBJECTFROMNAME]&lt;/nolink&gt;, eigendom van [NAME_SLURL], heeft u een [OBJECTTYPE] genaamd [ITEM_SLURL] gegeven.
 		<form name="form">
 			<button name="Keep" text="Behouden"/>
 			<button name="Discard" text="Afwijzen"/>
@@ -2840,7 +2840,7 @@ Dit verzoek inwilligen?
 		</form>
 	</notification>
 	<notification name="ScriptDialog">
-		[FIRST] [LAST]&apos;s &apos;[TITLE]&apos;
+		[NAME]&apos;s &apos;&lt;nolink&gt;[TITLE]&lt;/nolink&gt;&apos;
 [MESSAGE]
 		<form name="form">
 			<button name="Ignore" text="Negeren"/>
@@ -2941,13 +2941,13 @@ Klik Accepteren om deel te nemen aan dit gesprek of Afwijzen om de uitnodiging a
 		</form>
 	</notification>
 	<notification name="AutoUnmuteByIM">
-		Er is een instant message naar [FIRST] [LAST] gestuurd, waardoor deze automatisch van de negeerlijst is gehaald.
+		Er is een instant message naar [NAME] gestuurd, waardoor deze automatisch van de negeerlijst is gehaald.
 	</notification>
 	<notification name="AutoUnmuteByMoney">
-		Er is geld gegeven aan [FIRST] [LAST], waardoor deze automatisch van de negeerlijst is gehaald.
+		Er is geld gegeven aan [NAME], waardoor deze automatisch van de negeerlijst is gehaald.
 	</notification>
 	<notification name="AutoUnmuteByInventory">
-		Er is inventaris aangeboden aan [FIRST] [LAST], waardoor deze automatisch van de negeerlijst is gehaald.
+		Er is inventaris aangeboden aan [NAME], waardoor deze automatisch van de negeerlijst is gehaald.
 	</notification>
 	<notification name="VoiceInviteGroup">
 		[NAME] doet nu mee met een Voice chat gesprek binnen de groep [GROUP].
diff --git a/indra/newview/skins/default/xui/nl/strings.xml b/indra/newview/skins/default/xui/nl/strings.xml
index 1ee26c3f24f1eeb18a3e9cbc02c49e6bba2685e6..844945913fb31a86cd49de3a36f5585b8f95f6cb 100644
--- a/indra/newview/skins/default/xui/nl/strings.xml
+++ b/indra/newview/skins/default/xui/nl/strings.xml
@@ -665,7 +665,7 @@
 	<string name="xml_file">
 		XML bestand
 	</string>
-	<string name="dot_raw_file">
+	<string name="raw_file">
 		RAW bestand
 	</string>
 	<string name="compressed_image_files">
diff --git a/indra/newview/skins/default/xui/pl/strings.xml b/indra/newview/skins/default/xui/pl/strings.xml
index c8d97cc54665d279b71896d927e67cc7611236d5..59daa26bf0eba63b646d0604d13eea89142bb98f 100644
--- a/indra/newview/skins/default/xui/pl/strings.xml
+++ b/indra/newview/skins/default/xui/pl/strings.xml
@@ -783,7 +783,7 @@
 	<string name="xml_file">
 		Plik XML
 	</string>
-	<string name="dot_raw_file">
+	<string name="raw_file">
 		Plik RAW
 	</string>
 	<string name="compressed_image_files">
diff --git a/indra/newview/skins/default/xui/pt/strings.xml b/indra/newview/skins/default/xui/pt/strings.xml
index 8adf7f3a18355d12dbb1036961553e0f4e0c0125..59c6c8f080f918092f6868849413beeac59c48eb 100644
--- a/indra/newview/skins/default/xui/pt/strings.xml
+++ b/indra/newview/skins/default/xui/pt/strings.xml
@@ -786,7 +786,7 @@
 	<string name="xml_file">
 		Arquivo XML
 	</string>
-	<string name="dot_raw_file">
+	<string name="raw_file">
 		Arquivo RAW
 	</string>
 	<string name="compressed_image_files">