diff --git a/indra/llui/llview.cpp b/indra/llui/llview.cpp
index c091686ffb91c1f4174d02b36231d58225e47c0d..bd56da912165cd861819d2f25ae4331b7298a5d0 100644
--- a/indra/llui/llview.cpp
+++ b/indra/llui/llview.cpp
@@ -1319,8 +1319,6 @@ void LLView::drawChildren()
 
 			if (viewp->getVisible() && viewp->getRect().isValid())
 			{
-				// check for bad data
-				llassert_always(viewp->getVisible() == TRUE);
 				// Only draw views that are within the root view
 				localRectToScreen(viewp->getRect(),&screenRect);
 				if ( rootRect.overlaps(screenRect)  && LLUI::sDirtyRect.overlaps(screenRect))
diff --git a/indra/llxuixml/llinitparam.cpp b/indra/llxuixml/llinitparam.cpp
index 2ead5a4a57b074c1d354c28e8d80d9eb9a3852d8..8d6aa405e26bc2966426ce575db014f2a4d44d98 100644
--- a/indra/llxuixml/llinitparam.cpp
+++ b/indra/llxuixml/llinitparam.cpp
@@ -139,7 +139,7 @@ namespace LLInitParam
 
 	bool BaseBlock::validateBlock(bool emit_errors) const
 	{
-		const BlockDescriptor& block_data = getBlockDescriptor();
+		const BlockDescriptor& block_data = mostDerivedBlockDescriptor();
 		for (BlockDescriptor::param_validation_list_t::const_iterator it = block_data.mValidationList.begin(); it != block_data.mValidationList.end(); ++it)
 		{
 			const Param* param = getParamFromHandle(it->first);
@@ -159,7 +159,7 @@ namespace LLInitParam
 	{
 		// named param is one like LLView::Params::follows
 		// unnamed param is like LLView::Params::rect - implicit
-		const BlockDescriptor& block_data = getBlockDescriptor();
+		const BlockDescriptor& block_data = mostDerivedBlockDescriptor();
 
 		for (BlockDescriptor::param_list_t::const_iterator it = block_data.mUnnamedParams.begin(); 
 			it != block_data.mUnnamedParams.end(); 
@@ -230,7 +230,7 @@ namespace LLInitParam
 	{
 		// named param is one like LLView::Params::follows
 		// unnamed param is like LLView::Params::rect - implicit
-		const BlockDescriptor& block_data = getBlockDescriptor();
+		const BlockDescriptor& block_data = mostDerivedBlockDescriptor();
 
 		for (BlockDescriptor::param_list_t::const_iterator it = block_data.mUnnamedParams.begin(); 
 			it != block_data.mUnnamedParams.end(); 
@@ -301,7 +301,7 @@ namespace LLInitParam
 
 	bool BaseBlock::deserializeBlock(Parser& p, Parser::name_stack_range_t name_stack)
 	{
-		BlockDescriptor& block_data = getBlockDescriptor();
+		BlockDescriptor& block_data = mostDerivedBlockDescriptor();
 		bool names_left = name_stack.first != name_stack.second;
 
 		if (names_left)
@@ -386,7 +386,7 @@ namespace LLInitParam
 
 	void BaseBlock::addSynonym(Param& param, const std::string& synonym)
 	{
-		BlockDescriptor& block_data = getBlockDescriptor();
+		BlockDescriptor& block_data = mostDerivedBlockDescriptor();
 		if (block_data.mInitializationState == BlockDescriptor::INITIALIZING)
 		{
 			param_handle_t handle = getHandleFromParam(&param);
@@ -417,8 +417,8 @@ namespace LLInitParam
 	{ 
 		if (user_provided)
 		{
-		mChangeVersion++;
-	}
+			mChangeVersion++;
+		}
 	}
 
 	const std::string& BaseBlock::getParamName(const BlockDescriptor& block_data, const Param* paramp) const
@@ -445,7 +445,7 @@ namespace LLInitParam
 
 	ParamDescriptor* BaseBlock::findParamDescriptor(param_handle_t handle)
 	{
-		BlockDescriptor& descriptor = getBlockDescriptor();
+		BlockDescriptor& descriptor = mostDerivedBlockDescriptor();
 		BlockDescriptor::all_params_list_t::iterator end_it = descriptor.mAllParams.end();
 		for (BlockDescriptor::all_params_list_t::iterator it = descriptor.mAllParams.begin();
 			it != end_it;
@@ -460,7 +460,7 @@ namespace LLInitParam
 	// NOTE: this requires that "other" is of the same derived type as this
 	bool BaseBlock::merge(BlockDescriptor& block_data, const BaseBlock& other, bool overwrite)
 	{
-		bool param_changed = false;
+		bool some_param_changed = false;
 		BlockDescriptor::all_params_list_t::const_iterator end_it = block_data.mAllParams.end();
 		for (BlockDescriptor::all_params_list_t::const_iterator it = block_data.mAllParams.begin();
 			it != end_it;
@@ -471,10 +471,10 @@ namespace LLInitParam
 			if (merge_func)
 			{
 				Param* paramp = getParamFromHandle(it->mParamHandle);
-				param_changed |= merge_func(*paramp, *other_paramp, overwrite);
+				some_param_changed |= merge_func(*paramp, *other_paramp, overwrite);
 			}
 		}
-		return param_changed;
+		return some_param_changed;
 	}
 
 	bool ParamCompare<LLSD, false>::equals(const LLSD &a, const LLSD &b)
diff --git a/indra/llxuixml/llinitparam.h b/indra/llxuixml/llinitparam.h
index c9c1d4af90c6d8af9e1e54cad7b382921b500506..b645c4be7c80636926848906bcec52c9cfa8698c 100644
--- a/indra/llxuixml/llinitparam.h
+++ b/indra/llxuixml/llinitparam.h
@@ -477,10 +477,10 @@ namespace LLInitParam
 
 		bool deserializeBlock(Parser& p, Parser::name_stack_range_t name_stack);
 		bool serializeBlock(Parser& p, Parser::name_stack_t name_stack = Parser::name_stack_t(), const BaseBlock* diff_block = NULL) const;
-		virtual bool inspectBlock(Parser& p, Parser::name_stack_t name_stack = Parser::name_stack_t()) const;
+		bool inspectBlock(Parser& p, Parser::name_stack_t name_stack = Parser::name_stack_t()) const;
 
-		const BlockDescriptor& getBlockDescriptor() const { return *mBlockDescriptor; }
-		BlockDescriptor& getBlockDescriptor() { return *mBlockDescriptor; }
+		const BlockDescriptor& mostDerivedBlockDescriptor() const { return *mBlockDescriptor; }
+		BlockDescriptor& mostDerivedBlockDescriptor() { return *mBlockDescriptor; }
 
 		// take all provided params from other and apply to self
 		bool overwriteFrom(const BaseBlock& other)
@@ -507,7 +507,7 @@ namespace LLInitParam
 
 		BlockDescriptor*		mBlockDescriptor;	// most derived block descriptor
 
-		static BlockDescriptor& blockDescriptor()
+		static BlockDescriptor& selfBlockDescriptor()
 		{
 			static BlockDescriptor sBlockDescriptor;
 			return sBlockDescriptor;
@@ -559,7 +559,7 @@ namespace LLInitParam
 		TypedParam(BlockDescriptor& block_descriptor, const char* name, value_assignment_t value, ParamDescriptor::validation_func_t validate_func, S32 min_count, S32 max_count) 
 		:	Param(block_descriptor.mCurrentBlockPtr)
 		{
-			if (block_descriptor.mInitializationState == BlockDescriptor::INITIALIZING)
+			if (LL_UNLIKELY(block_descriptor.mInitializationState == BlockDescriptor::INITIALIZING))
 			{
 				ParamDescriptor param_descriptor(block_descriptor.mCurrentBlockPtr->getHandleFromParam(this),
 												&mergeWith,
@@ -584,6 +584,7 @@ namespace LLInitParam
 			{
 				if (parser.readValue<T>(typed_param.mData.mValue))
 				{
+					typed_param.mData.clearKey();
 					typed_param.setProvided(true);
 					typed_param.enclosingBlock().setLastChangedParam(param, true);
 					return true;
@@ -690,7 +691,7 @@ namespace LLInitParam
 				&& (overwrite || !dst_typed_param.isProvided()))
 			{
 				dst_typed_param.mData.clearKey();
-				dst_typed_param = src_typed_param;
+				dst_typed_param.set(src_typed_param.get());
 				return true;
 			}
 			return false;
@@ -722,7 +723,7 @@ namespace LLInitParam
 		:	Param(block_descriptor.mCurrentBlockPtr),
 			T(value)
 		{
-			if (block_descriptor.mInitializationState == BlockDescriptor::INITIALIZING)
+			if (LL_UNLIKELY(block_descriptor.mInitializationState == BlockDescriptor::INITIALIZING))
 			{
 				ParamDescriptor param_descriptor(block_descriptor.mCurrentBlockPtr->getHandleFromParam(this),
 												&mergeWith,
@@ -741,6 +742,7 @@ namespace LLInitParam
 			// attempt to parse block...
 			if(typed_param.deserializeBlock(parser, name_stack))
 			{
+				typed_param.mData.clearKey();
 				typed_param.enclosingBlock().setLastChangedParam(param, true);
 				return true;
 			}
@@ -856,21 +858,10 @@ namespace LLInitParam
 		{
 			const self_t& src_typed_param = static_cast<const self_t&>(src);
 			self_t& dst_typed_param = static_cast<self_t&>(dst);
-			if (overwrite)
-			{
-				if (dst_typed_param.T::overwriteFrom(src_typed_param))
-				{
-					dst_typed_param.mData.clearKey();
-					return true;
-				}
-			}
-			else
+			if (dst_typed_param.T::merge(T::selfBlockDescriptor(), src_typed_param, overwrite || !dst_typed_param.isProvided()))
 			{
-				if (dst_typed_param.T::fillFrom(src_typed_param))
-				{			
-					dst_typed_param.mData.clearKey();
-					return true;
-				}
+				dst_typed_param.mData.clearKey();
+				return true;
 			}
 			return false;
 		}
@@ -911,7 +902,7 @@ namespace LLInitParam
 			mValues(value)
 		{
 			mCachedKeys.resize(mValues.size());
-			if (block_descriptor.mInitializationState == BlockDescriptor::INITIALIZING)
+			if (LL_UNLIKELY(block_descriptor.mInitializationState == BlockDescriptor::INITIALIZING))
 			{
 				ParamDescriptor param_descriptor(block_descriptor.mCurrentBlockPtr->getHandleFromParam(this),
 												&mergeWith,
@@ -1060,9 +1051,9 @@ namespace LLInitParam
 			self_t& dst_typed_param = static_cast<self_t&>(dst);
 
 			if (src_typed_param.isProvided()
-				&& (overwrite || !isProvided()))
+				&& (overwrite || !dst_typed_param.isProvided()))
 			{
-				dst_typed_param = src_typed_param;
+				dst_typed_param.set(src_typed_param.get());
 				return true;
 			}
 			return false;
@@ -1094,7 +1085,7 @@ namespace LLInitParam
 			mLastParamGeneration(0)
 		{
 			mCachedKeys.resize(mValues.size());
-			if (block_descriptor.mInitializationState == BlockDescriptor::INITIALIZING)
+			if (LL_UNLIKELY(block_descriptor.mInitializationState == BlockDescriptor::INITIALIZING))
 			{
 				ParamDescriptor param_descriptor(block_descriptor.mCurrentBlockPtr->getHandleFromParam(this),
 												&mergeWith,
@@ -1252,7 +1243,7 @@ namespace LLInitParam
 			if (src_typed_param.isProvided()
 				&& (overwrite || !dst_typed_param.isProvided()))
 			{
-				dst_typed_param = src_typed_param;
+				dst_typed_param.set(src_typed_param.get());
 				return true;
 			}
 			return false;
@@ -1282,13 +1273,24 @@ namespace LLInitParam
 		// take all provided params from other and apply to self
 		bool overwriteFrom(const self_t& other)
 		{
-			mCurChoice = other.mCurChoice;
-			return BaseBlock::merge(blockDescriptor(), other, true);
+			return merge(selfBlockDescriptor(), other, true);
 		}
 
 		// take all provided params that are not already provided, and apply to self
 		bool fillFrom(const self_t& other)
 		{
+			return merge(selfBlockDescriptor(), other, false);
+		}
+
+		// merge with other block
+		bool merge(BlockDescriptor& block_data, const self_t& other, bool overwrite)
+		{
+			// only merge a choice if we are overwriting with other's contents
+			if (overwrite)
+			{
+				mCurChoice = other.mCurChoice;
+				return BaseBlock::merge(selfBlockDescriptor(), other, overwrite);
+			}
 			return false;
 		}
 
@@ -1314,7 +1316,7 @@ namespace LLInitParam
 		Choice()
 		:	mCurChoice(0)
 		{
-			BaseBlock::init(blockDescriptor(), BaseBlock::blockDescriptor(), sizeof(DERIVED_BLOCK));
+			BaseBlock::init(selfBlockDescriptor(), BaseBlock::selfBlockDescriptor(), sizeof(DERIVED_BLOCK));
 		}
 
 		// Alternatives are mutually exclusive wrt other Alternatives in the same block.  
@@ -1331,13 +1333,14 @@ namespace LLInitParam
 			typedef typename super_t::value_assignment_t								value_assignment_t;
 
 			explicit Alternative(const char* name, value_assignment_t val = DefaultInitializer<T>::get())
-			:	super_t(DERIVED_BLOCK::blockDescriptor(), name, val, NULL, 0, 1),
+			:	super_t(DERIVED_BLOCK::selfBlockDescriptor(), name, val, NULL, 0, 1),
 				mOriginalValue(val)
 			{
 				// assign initial choice to first declared option
-				DERIVED_BLOCK* blockp = ((DERIVED_BLOCK*)DERIVED_BLOCK::blockDescriptor().mCurrentBlockPtr);
-				if (DERIVED_BLOCK::blockDescriptor().mInitializationState == BlockDescriptor::INITIALIZING
-					&& blockp->mCurChoice == 0)
+				DERIVED_BLOCK* blockp = ((DERIVED_BLOCK*)DERIVED_BLOCK::selfBlockDescriptor().mCurrentBlockPtr);
+				if (LL_UNLIKELY(
+						DERIVED_BLOCK::selfBlockDescriptor().mInitializationState == BlockDescriptor::INITIALIZING
+							&& blockp->mCurChoice == 0))
 				{
 					blockp->mCurChoice = Param::enclosingBlock().getHandleFromParam(this);
 				}
@@ -1382,7 +1385,7 @@ namespace LLInitParam
 		};
 
 	protected:
-		static BlockDescriptor& blockDescriptor()
+		static BlockDescriptor& selfBlockDescriptor()
 		{
 			static BlockDescriptor sBlockDescriptor;
 			return sBlockDescriptor;
@@ -1410,19 +1413,19 @@ namespace LLInitParam
 		// take all provided params from other and apply to self
 		bool overwriteFrom(const self_t& other)
 		{
-			return BaseBlock::merge(blockDescriptor(), other, true);
+			return BaseBlock::merge(selfBlockDescriptor(), other, true);
 		}
 
 		// take all provided params that are not already provided, and apply to self
 		bool fillFrom(const self_t& other)
 		{
-			return BaseBlock::merge(blockDescriptor(), other, false);
+			return BaseBlock::merge(selfBlockDescriptor(), other, false);
 		}
 	protected:
 		Block()
 		{
 			//#pragma message("Parsing LLInitParam::Block")
-			BaseBlock::init(blockDescriptor(), BASE_BLOCK::blockDescriptor(), sizeof(DERIVED_BLOCK));
+			BaseBlock::init(selfBlockDescriptor(), BASE_BLOCK::selfBlockDescriptor(), sizeof(DERIVED_BLOCK));
 		}
 
 		//
@@ -1436,7 +1439,7 @@ namespace LLInitParam
 			typedef typename super_t::value_assignment_t								value_assignment_t;
 
 			explicit Optional(const char* name = "", value_assignment_t val = DefaultInitializer<T>::get())
-			:	super_t(DERIVED_BLOCK::blockDescriptor(), name, val, NULL, 0, 1)
+			:	super_t(DERIVED_BLOCK::selfBlockDescriptor(), name, val, NULL, 0, 1)
 			{
 				//#pragma message("Parsing LLInitParam::Block::Optional")
 			}
@@ -1465,7 +1468,7 @@ namespace LLInitParam
 
 			// mandatory parameters require a name to be parseable
 			explicit Mandatory(const char* name = "", value_assignment_t val = DefaultInitializer<T>::get())
-			:	super_t(DERIVED_BLOCK::blockDescriptor(), name, val, &validate, 1, 1)
+			:	super_t(DERIVED_BLOCK::selfBlockDescriptor(), name, val, &validate, 1, 1)
 			{}
 
 			Mandatory& operator=(value_assignment_t val)
@@ -1501,7 +1504,7 @@ namespace LLInitParam
 			typedef typename container_t::const_iterator							const_iterator;
 
 			explicit Multiple(const char* name = "", value_assignment_t val = DefaultInitializer<container_t>::get())
-			:	super_t(DERIVED_BLOCK::blockDescriptor(), name, val, &validate, RANGE::minCount(), RANGE::maxCount())
+			:	super_t(DERIVED_BLOCK::selfBlockDescriptor(), name, val, &validate, RANGE::minCount(), RANGE::maxCount())
 			{}
 
 			using super_t::operator();
@@ -1529,10 +1532,10 @@ namespace LLInitParam
 		{
 		public:
 			explicit Deprecated(const char* name)
-			:	Param(DERIVED_BLOCK::blockDescriptor().mCurrentBlockPtr)
+			:	Param(DERIVED_BLOCK::selfBlockDescriptor().mCurrentBlockPtr)
 			{
-				BlockDescriptor& block_descriptor = DERIVED_BLOCK::blockDescriptor();
-				if (block_descriptor.mInitializationState == BlockDescriptor::INITIALIZING)
+				BlockDescriptor& block_descriptor = DERIVED_BLOCK::selfBlockDescriptor();
+				if (LL_UNLIKELY(block_descriptor.mInitializationState == BlockDescriptor::INITIALIZING))
 				{
 					ParamDescriptor param_descriptor(block_descriptor.mCurrentBlockPtr->getHandleFromParam(this),
 													NULL,
@@ -1561,7 +1564,7 @@ namespace LLInitParam
 		typedef Deprecated Ignored;
 
 	protected:
-		static BlockDescriptor& blockDescriptor()
+		static BlockDescriptor& selfBlockDescriptor()
 		{
 			static BlockDescriptor sBlockDescriptor;
 			return sBlockDescriptor;
@@ -1574,6 +1577,13 @@ namespace LLInitParam
 		public Param
 	{
 	public:
+		typedef enum e_value_age
+		{	
+			OLDER_THAN_BLOCK,	// mData.mValue needs to be refreshed from the block parameters
+			NEWER_THAN_BLOCK,	// mData.mValue holds the authoritative value (which has been replicated to the block parameters via setBlockFromValue)
+			SAME_AS_BLOCK		// mData.mValue is derived from the block parameters, which are authoritative
+		} EValueAge;
+
 		typedef BlockValue<T>										self_t;
 		typedef Block<TypedParam<T, TypeValues<T>, false> >			block_t;
 		typedef const T&											value_const_ref_t;
@@ -1582,9 +1592,9 @@ namespace LLInitParam
 
 		BlockValue(BlockDescriptor& block_descriptor, const char* name, value_assignment_t value, ParamDescriptor::validation_func_t validate_func, S32 min_count, S32 max_count)
 		:	Param(block_descriptor.mCurrentBlockPtr),
-			mData(value)
+			mData(value, NEWER_THAN_BLOCK)
 		{
-			if (block_descriptor.mInitializationState == BlockDescriptor::INITIALIZING)
+			if (LL_UNLIKELY(block_descriptor.mInitializationState == BlockDescriptor::INITIALIZING))
 			{
 				ParamDescriptor param_descriptor(block_descriptor.mCurrentBlockPtr->getHandleFromParam(this),
 												&mergeWith,
@@ -1604,7 +1614,7 @@ namespace LLInitParam
 
 		static bool deserializeParam(Param& param, Parser& parser, const Parser::name_stack_range_t& name_stack, S32 generation)
 		{
-			self_t& typed_param = static_cast<self_t&>(param);
+			DERIVED& typed_param = static_cast<DERIVED&>(param);
 			// type to apply parse direct value T
 			if (name_stack.first == name_stack.second)
 			{
@@ -1612,7 +1622,10 @@ namespace LLInitParam
 				{
 					typed_param.enclosingBlock().setLastChangedParam(param, true);
 					typed_param.setProvided(true);
-					typed_param.mData.mLastParamVersion = typed_param.BaseBlock::getLastChangeVersion();
+					typed_param.mData.clearKey();
+					typed_param.mData.mValueAge = NEWER_THAN_BLOCK;
+					typed_param.setBlockFromValue();
+
 					return true;
 				}
 
@@ -1628,7 +1641,9 @@ namespace LLInitParam
 							typed_param.mData.setKey(name);
 							typed_param.enclosingBlock().setLastChangedParam(param, true);
 							typed_param.setProvided(true);
-							typed_param.mData.mLastParamVersion = typed_param.BaseBlock::getLastChangeVersion();
+							typed_param.mData.mValueAge = NEWER_THAN_BLOCK;
+							typed_param.setBlockFromValue();
+
 							return true;
 						}
 					}
@@ -1703,16 +1718,18 @@ namespace LLInitParam
 
 		bool isProvided() const 
 		{
-			// either param value provided directly or block is sufficiently filled in
+			if (!Param::getProvided()) return false;
+
+			// block has an updated parameter
 			// if cached value is stale, regenerate from params
-			if (Param::getProvided() && mData.mLastParamVersion < BaseBlock::getLastChangeVersion())
+			if (mData.mValueAge == OLDER_THAN_BLOCK)
 			{
 				if (block_t::validateBlock(false))
 				{
 					static_cast<const DERIVED*>(this)->setValueFromBlock();
 					// clear stale keyword associated with old value
 					mData.clearKey();
-					mData.mLastParamVersion = BaseBlock::getLastChangeVersion();
+					mData.mValueAge = SAME_AS_BLOCK;
 					return true;
 				}
 				else
@@ -1722,8 +1739,11 @@ namespace LLInitParam
 					return false;  
 				}
 			}
-			// either no data provided, or we have a valid value in hand
-			return Param::getProvided();
+			else
+			{
+				// we have a valid value in hand
+				return true;
+			}
 		}
 
 		void set(value_assignment_t val, bool flag_as_provided = true)
@@ -1731,7 +1751,7 @@ namespace LLInitParam
 			Param::enclosingBlock().setLastChangedParam(*this, flag_as_provided);
 			
 			// set param version number to be up to date, so we ignore block contents
-			mData.mLastParamVersion = BaseBlock::getLastChangeVersion();
+			mData.mValueAge = NEWER_THAN_BLOCK;
 
 			mData.mValue = val;
 			mData.clearKey();
@@ -1756,6 +1776,8 @@ namespace LLInitParam
 			if (user_provided)
 			{
 				setProvided(true);  // some component provided
+				// a parameter changed, so our value is out of date
+				mData.mValueAge = OLDER_THAN_BLOCK;
 			}
 		}
 
@@ -1763,54 +1785,54 @@ namespace LLInitParam
 		value_assignment_t get() const
 		{
 			// if some parameters were provided, issue warnings on invalid blocks
-			if (Param::getProvided() && (mData.mLastParamVersion < BaseBlock::getLastChangeVersion()))
+			if (Param::getProvided() && (mData.mValueAge == OLDER_THAN_BLOCK))
 			{
 				// go ahead and issue warnings at this point if any param is invalid
 				if(block_t::validateBlock(true))
 				{
 					static_cast<const DERIVED*>(this)->setValueFromBlock();
 					mData.clearKey();
-					mData.mLastParamVersion = BaseBlock::getLastChangeVersion();
+					mData.mValueAge = SAME_AS_BLOCK;
 				}
 			}
 
 			return mData.mValue;
 		}
 
-		// mutable to allow lazy updates on get
+
 		struct Data : public key_cache_t
 		{
-			Data(const T& value) 
+			Data(const T& value, EValueAge age) 
 			:	mValue(value),
-				mLastParamVersion(0)
+				mValueAge(age)
 			{}
 
-			T		mValue;
-			S32		mLastParamVersion;
+			T			mValue;
+			EValueAge	mValueAge;
 		};
 
+		// mutable to allow lazy updates on get
 		mutable Data		mData;
 
 	private:
 		static bool mergeWith(Param& dst, const Param& src, bool overwrite)
 		{
-			const self_t& src_typed_param = static_cast<const self_t&>(src);
-			self_t& dst_typed_param = static_cast<self_t&>(dst);
+			const DERIVED& src_typed_param = static_cast<const DERIVED&>(src);
+			DERIVED& dst_typed_param = static_cast<DERIVED&>(dst);
 
 			if (src_typed_param.isProvided()
 				&& (overwrite || !dst_typed_param.isProvided()))
 			{
-				// assign individual parameters
-				dst_typed_param.BaseBlock::merge(block_t::blockDescriptor(), src_typed_param, overwrite);
-
-				// then copy actual value
-				dst_typed_param.mData.mValue = src_typed_param.get();
-				dst_typed_param.mData.clearKey();
-				dst_typed_param.setProvided(true);
-
-				// Propagate value back to block params since the value was updated during this merge.
-				// This will result in mData.mValue and the block params being in sync.
-				static_cast<DERIVED&>(dst_typed_param).setBlockFromValue();
+				if (src_typed_param.mData.mValueAge == NEWER_THAN_BLOCK)
+				{
+					// copy value over
+					dst_typed_param.set(src_typed_param.get());
+				}
+				else
+				{
+					// merge individual parameters into destination
+					dst_typed_param.merge(block_t::selfBlockDescriptor(), src_typed_param, overwrite);
+				}
 				return true;
 			}
 			return false;
diff --git a/indra/media_plugins/webkit/media_plugin_webkit.cpp b/indra/media_plugins/webkit/media_plugin_webkit.cpp
index 47766a24cbd0f97ae071de530309a53bed7561b7..0cd6e48d14a61f24389d639876090fced42d61c7 100644
--- a/indra/media_plugins/webkit/media_plugin_webkit.cpp
+++ b/indra/media_plugins/webkit/media_plugin_webkit.cpp
@@ -297,11 +297,17 @@ class MediaPluginWebKit :
 		// append details to agent string
 		LLQtWebKit::getInstance()->setBrowserAgentId( mUserAgent );
 
+		// TODO: Remove this ifdef when the Linux version of llqtwebkit gets updated with the new WOB constant.
+#if !LL_LINUX
+		// Set up window open behavior
+		LLQtWebKit::getInstance()->setWindowOpenBehavior(mBrowserWindowId, LLQtWebKit::WOB_SIMULATE_BLANK_HREF_CLICK);
+#endif
+		
 #if !LL_QTWEBKIT_USES_PIXMAPS
 		// don't flip bitmap
 		LLQtWebKit::getInstance()->flipWindow( mBrowserWindowId, true );
 #endif // !LL_QTWEBKIT_USES_PIXMAPS
-		
+
 		// set background color
 		// convert background color channels from [0.0, 1.0] to [0, 255];
 		LLQtWebKit::getInstance()->setBackgroundColor( mBrowserWindowId, int(mBackgroundR * 255.0f), int(mBackgroundG * 255.0f), int(mBackgroundB * 255.0f) );
diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt
index df98b420a2684bce243e660481f4f87f085ce968..ddd5d47e7806f859ad899f7dfc1e7351191b0acf 100644
--- a/indra/newview/CMakeLists.txt
+++ b/indra/newview/CMakeLists.txt
@@ -91,6 +91,7 @@ set(viewer_SOURCE_FILES
     llbottomtray.cpp
     llbox.cpp
     llbreadcrumbview.cpp
+    llbuycurrencyhtml.cpp
     llcallbacklist.cpp
     llcallfloater.cpp
     llcallingcard.cpp
@@ -159,6 +160,7 @@ set(viewer_SOURCE_FILES
     llfloaterbuy.cpp
     llfloaterbuycontents.cpp
     llfloaterbuycurrency.cpp
+    llfloaterbuycurrencyhtml.cpp
     llfloaterbuyland.cpp
     llfloatercamera.cpp
     llfloatercolorpicker.cpp
@@ -266,6 +268,7 @@ set(viewer_SOURCE_FILES
     lllandmarkactions.cpp
     lllandmarklist.cpp
     lllistbrowser.cpp
+    lllistcontextmenu.cpp
     lllistview.cpp
     lllocaltextureobject.cpp
     lllocationhistory.cpp
@@ -605,6 +608,7 @@ set(viewer_HEADER_FILES
     llbottomtray.h
     llbox.h
     llbreadcrumbview.h
+    llbuycurrencyhtml.h
     llcallbacklist.h
     llcallfloater.h
     llcallingcard.h
@@ -675,6 +679,7 @@ set(viewer_HEADER_FILES
     llfloaterbuy.h
     llfloaterbuycontents.h
     llfloaterbuycurrency.h
+    llfloaterbuycurrencyhtml.h
     llfloaterbuyland.h
     llfloatercamera.h
     llfloatercolorpicker.h
@@ -782,6 +787,7 @@ set(viewer_HEADER_FILES
     lllandmarklist.h
     lllightconstants.h
     lllistbrowser.h
+    lllistcontextmenu.h
     lllistview.h
     lllocaltextureobject.h
     lllocationhistory.h
diff --git a/indra/newview/app_settings/logcontrol.xml b/indra/newview/app_settings/logcontrol.xml
index d7bb64ce8a7787b39abc4bf24ebfc954571cdfdb..16e39fc1c4851930d6214ee197342eefd7983b95 100644
--- a/indra/newview/app_settings/logcontrol.xml
+++ b/indra/newview/app_settings/logcontrol.xml
@@ -25,6 +25,7 @@
 							<string>AppCache</string>
 							<string>Window</string>
 							<string>RenderInit</string>
+							<string>MediaAuth</string>
 						</array>
 				</map>
 				<map>
diff --git a/indra/newview/app_settings/low_graphics.xml b/indra/newview/app_settings/low_graphics.xml
index 3f67a70d7ac179943d599d234ac87e6ef93fe2f6..d02a13a67131183e48ab8fd9f282bc5340de94d7 100644
--- a/indra/newview/app_settings/low_graphics.xml
+++ b/indra/newview/app_settings/low_graphics.xml
@@ -4,6 +4,8 @@
 	<RenderAvatarCloth value="FALSE"/>
 	<!--Default for now-->
 	<RenderAvatarLODFactor value="0.5"/>
+  <!--Default for now-->
+  <RenderAvatarMaxVisible value="3"/>
 	<!--NO SHADERS-->
 	<RenderAvatarVP value="FALSE"/>
 	<!--Short Range-->
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index 418032c554647b2c4b4ffa3395c555ef959deb02..59b6115fab78c9da9ff4f4ef5735ac2bf0dea3ed 100644
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -5971,7 +5971,7 @@
     <key>Type</key>
     <string>F32</string>
     <key>Value</key>
-    <real>0.2</real>
+    <real>0.125</real>
   </map>
   <key>MediaRollOffMin</key>
   <map>
@@ -5982,7 +5982,7 @@
     <key>Type</key>
     <string>F32</string>
     <key>Value</key>
-    <real>7.0</real>
+    <real>5.0</real>
   </map>
   <key>MediaRollOffMax</key>
   <map>
@@ -6028,6 +6028,17 @@
       <key>Value</key>
       <integer>0</integer>
     </map>
+    <key>QuickBuyCurrency</key>
+    <map>
+      <key>Comment</key>
+      <string>Toggle between HTML based currency purchase floater and legacy XUI version</string>
+      <key>Persist</key>
+      <integer>1</integer>
+      <key>Type</key>
+      <string>Boolean</string>
+      <key>Value</key>
+      <integer>0</integer>
+    </map>
     <key>RegionTextureSize</key>
     <map>
       <key>Comment</key>
@@ -8171,7 +8182,7 @@
       <key>Type</key>
       <string>S32</string>
       <key>Value</key>
-      <integer>0</integer>
+      <integer>1</integer>
     </map>
     <key>ShowObjectRenderingCost</key>                
     <map>
@@ -9042,6 +9053,17 @@
       <key>Value</key>
       <integer>0</integer>
     </map>
+    <key>TextureDiscardLevel</key>
+    <map>
+      <key>Comment</key>
+      <string>Specify texture resolution (0 = highest, 5 = lowest)</string>
+      <key>Persist</key>
+      <integer>1</integer>
+      <key>Type</key>
+      <string>U32</string>
+      <key>Value</key>
+      <integer>0</integer>
+    </map>
     <key>TextureLoadFullRes</key>
     <map>
       <key>Comment</key>
diff --git a/indra/newview/featuretable.txt b/indra/newview/featuretable.txt
index 5f31ccbb198cfc92f17d6a9b0de25ba418fafab1..f1c1a142adbc2c652e3aaf6c145b29169340f10b 100644
--- a/indra/newview/featuretable.txt
+++ b/indra/newview/featuretable.txt
@@ -65,6 +65,7 @@ list Low
 RenderAnisotropic			1	0
 RenderAvatarCloth			1	0
 RenderAvatarLODFactor		1	0.5
+RenderAvatarMaxVisible      1   3
 RenderAvatarVP				1	0
 RenderFarClip				1	64
 RenderFlexTimeFactor		1	0.5
diff --git a/indra/newview/featuretable_linux.txt b/indra/newview/featuretable_linux.txt
index 61a8e51c50e5d04e71e5b6eb6deae5ab3ffc3427..d1d11ee173606b7e1f4ef832b59948b294741021 100644
--- a/indra/newview/featuretable_linux.txt
+++ b/indra/newview/featuretable_linux.txt
@@ -63,6 +63,7 @@ list Low
 RenderAnisotropic			1	0
 RenderAvatarCloth			1	0
 RenderAvatarLODFactor		1	0.5
+RenderAvatarMaxVisible      1   3
 RenderAvatarVP				1	0
 RenderFarClip				1	64
 RenderFlexTimeFactor		1	0.5
diff --git a/indra/newview/featuretable_mac.txt b/indra/newview/featuretable_mac.txt
index 12d47a904c0def93caca1ffb0042fb7b25e63914..efd7ec7a912b193271699415583bee2581113272 100644
--- a/indra/newview/featuretable_mac.txt
+++ b/indra/newview/featuretable_mac.txt
@@ -65,6 +65,7 @@ list Low
 RenderAnisotropic			1	0
 RenderAvatarCloth			1	0
 RenderAvatarLODFactor		1	0.5
+RenderAvatarMaxVisible      1   3
 RenderAvatarVP				1	0
 RenderFarClip				1	64
 RenderFlexTimeFactor		1	0.5
diff --git a/indra/newview/featuretable_solaris.txt b/indra/newview/featuretable_solaris.txt
index f24cbde5e2e5c351536bb418f5ec24ddb94b6dce..6edd2806865b09790bb834dcbfe0d0a0dcc974d4 100644
--- a/indra/newview/featuretable_solaris.txt
+++ b/indra/newview/featuretable_solaris.txt
@@ -117,6 +117,7 @@ UseOcclusion		0	0
 list low
 RenderVBO			1	0
 RenderAniso			1	0
+RenderAvatarMaxVisible      1   3
 RenderLighting		1	0
 
 list medium
diff --git a/indra/newview/gpu_table.txt b/indra/newview/gpu_table.txt
index 3754f30a669cf78c8ae9d3e4db67071a77c5f390..5aad295cb12916d2822382db5aaa4ebe3b14f601 100644
--- a/indra/newview/gpu_table.txt
+++ b/indra/newview/gpu_table.txt
@@ -203,14 +203,14 @@ NVIDIA GeForce 7100				.*NVIDIA.*GeForce 71.*				0		1
 NVIDIA GeForce 7200				.*NVIDIA.*GeForce 72.*				1		1
 NVIDIA GeForce 7300				.*NVIDIA.*GeForce 73.*				1		1
 NVIDIA GeForce 7500				.*NVIDIA.*GeForce 75.*				1		1
-NVIDIA GeForce 7600				.*NVIDIA.*GeForce 76.*				3		1
-NVIDIA GeForce 7800				.*NVIDIA.*GeForce.*78.*				3		1
-NVIDIA GeForce 7900				.*NVIDIA.*GeForce.*79.*				3		1
+NVIDIA GeForce 7600				.*NVIDIA.*GeForce 76.*				1		1
+NVIDIA GeForce 7800				.*NVIDIA.*GeForce.*78.*				1		1
+NVIDIA GeForce 7900				.*NVIDIA.*GeForce.*79.*				1		1
 NVIDIA GeForce 8100				.*NVIDIA.*GeForce 81.*				1		1
 NVIDIA GeForce 8200				.*NVIDIA.*GeForce 82.*				1		1
 NVIDIA GeForce 8300				.*NVIDIA.*GeForce 83.*				1		1
 NVIDIA GeForce 8400				.*NVIDIA.*GeForce 84.*				1		1
-NVIDIA GeForce 8500				.*GeForce 85.*						3		1
+NVIDIA GeForce 8500				.*GeForce 85.*						1		1
 NVIDIA GeForce 8600M			.*NVIDIA.*GeForce.*8600M.*			1		1
 NVIDIA GeForce 8600				.*NVIDIA.*GeForce 86.*				3		1
 NVIDIA GeForce 8700				.*NVIDIA.*GeForce 87.*				3		1
diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp
index f96a59e97a07e4864e2b7d1d4a8ada47c394feab..7d84f8d071b3ab892d1516fc2d1d1214b2780ca4 100644
--- a/indra/newview/llagent.cpp
+++ b/indra/newview/llagent.cpp
@@ -3088,21 +3088,30 @@ void LLAgent::processAgentCachedTextureResponse(LLMessageSystem *mesgsys, void *
 		mesgsys->getUUIDFast(_PREHASH_WearableData, _PREHASH_TextureID, texture_id, texture_block);
 		mesgsys->getU8Fast(_PREHASH_WearableData, _PREHASH_TextureIndex, texture_index, texture_block);
 
-		if ((S32)texture_index < BAKED_NUM_INDICES 
-			&& gAgentQueryManager.mActiveCacheQueries[texture_index] == query_id)
-		{
-			if (texture_id.notNull())
-			{
-				//llinfos << "Received cached texture " << (U32)texture_index << ": " << texture_id << llendl;
-				gAgentAvatarp->setCachedBakedTexture(LLVOAvatarDictionary::bakedToLocalTextureIndex((EBakedTextureIndex)texture_index), texture_id);
-				//gAgentAvatarp->setTETexture( LLVOAvatar::sBakedTextureIndices[texture_index], texture_id );
-				gAgentQueryManager.mActiveCacheQueries[texture_index] = 0;
-				num_results++;
-			}
-			else
+
+		if ((S32)texture_index < TEX_NUM_INDICES )
+		{	
+			const LLVOAvatarDictionary::TextureEntry *texture_entry = LLVOAvatarDictionary::instance().getTexture((ETextureIndex)texture_index);
+			if (texture_entry)
 			{
-				// no cache of this bake. request upload.
-				gAgentAvatarp->requestLayerSetUpload((EBakedTextureIndex)texture_index);
+				EBakedTextureIndex baked_index = texture_entry->mBakedTextureIndex;
+
+				if (gAgentQueryManager.mActiveCacheQueries[baked_index] == query_id)
+				{
+					if (texture_id.notNull())
+					{
+						//llinfos << "Received cached texture " << (U32)texture_index << ": " << texture_id << llendl;
+						gAgentAvatarp->setCachedBakedTexture((ETextureIndex)texture_index, texture_id);
+						//gAgentAvatarp->setTETexture( LLVOAvatar::sBakedTextureIndices[texture_index], texture_id );
+						gAgentQueryManager.mActiveCacheQueries[baked_index] = 0;
+						num_results++;
+					}
+					else
+					{
+						// no cache of this bake. request upload.
+						gAgentAvatarp->requestLayerSetUpload(baked_index);
+					}
+				}
 			}
 		}
 	}
@@ -3526,7 +3535,6 @@ void LLAgent::sendAgentSetAppearance()
 		return;
 	}
 
-
 	llinfos << "TAT: Sent AgentSetAppearance: " << gAgentAvatarp->getBakedStatusForPrintout() << llendl;
 	//dumpAvatarTEs( "sendAgentSetAppearance()" );
 
@@ -3577,32 +3585,15 @@ void LLAgent::sendAgentSetAppearance()
 		llinfos << "TAT: Sending cached texture data" << llendl;
 		for (U8 baked_index = 0; baked_index < BAKED_NUM_INDICES; baked_index++)
 		{
-			const LLVOAvatarDictionary::BakedEntry *baked_dict = LLVOAvatarDictionary::getInstance()->getBakedTexture((EBakedTextureIndex)baked_index);
-			LLUUID hash;
-			for (U8 i=0; i < baked_dict->mWearables.size(); i++)
-			{
-				// LLWearableType::EType wearable_type = gBakedWearableMap[baked_index][wearable_num];
-				const LLWearableType::EType wearable_type = baked_dict->mWearables[i];
-                                for (U8 wearable_index =0; wearable_index < gAgentWearables.getWearableCount(wearable_type); ++wearable_index)
-                                {
-                                       const LLWearable* wearable = gAgentWearables.getWearable(wearable_type,wearable_index);
-                                       if (wearable)
-                                       {
-                                               // MULTI-WEARABLE: make order-dependent (use MD5 hash)
-						hash ^= wearable->getAssetID();
-                                       }
-                                }
-			}
+			LLUUID hash = gAgentWearables.computeBakedTextureHash((EBakedTextureIndex) baked_index);
+
 			if (hash.notNull())
 			{
-				hash ^= baked_dict->mWearablesHashID;
+				ETextureIndex texture_index = LLVOAvatarDictionary::bakedToLocalTextureIndex((EBakedTextureIndex) baked_index);
+				msg->nextBlockFast(_PREHASH_WearableData);
+				msg->addUUIDFast(_PREHASH_CacheID, hash);
+				msg->addU8Fast(_PREHASH_TextureIndex, (U8)texture_index);
 			}
-
-			const ETextureIndex texture_index = LLVOAvatarDictionary::bakedToLocalTextureIndex((EBakedTextureIndex)baked_index);
-
-			msg->nextBlockFast(_PREHASH_WearableData);
-			msg->addUUIDFast(_PREHASH_CacheID, hash);
-			msg->addU8Fast(_PREHASH_TextureIndex, (U8)texture_index);
 		}
 		msg->nextBlockFast(_PREHASH_ObjectData);
 		gAgentAvatarp->sendAppearanceMessage( gMessageSystem );
diff --git a/indra/newview/llagentwearables.cpp b/indra/newview/llagentwearables.cpp
index 545c5b845bab1549245c4d1fa4542f04c00f9a20..68c4fa1ea0d619817fa327bf98c2728637eecae7 100644
--- a/indra/newview/llagentwearables.cpp
+++ b/indra/newview/llagentwearables.cpp
@@ -49,6 +49,7 @@
 #include "llmd5.h"
 #include "llnotificationsutil.h"
 #include "llpaneloutfitsinventory.h"
+#include "llsidepanelappearance.h"
 #include "llsidetray.h"
 #include "lltexlayer.h"
 #include "llviewerregion.h"
@@ -539,9 +540,15 @@ void LLAgentWearables::setWearableName(const LLUUID& item_id, const std::string&
 BOOL LLAgentWearables::isWearableModifiable(LLWearableType::EType type, U32 index) const
 {
 	LLUUID item_id = getWearableItemID(type, index);
-	if (!item_id.isNull())
+	return item_id.notNull() ? isWearableModifiable(item_id) : FALSE;
+}
+
+BOOL LLAgentWearables::isWearableModifiable(const LLUUID& item_id) const
+{
+	const LLUUID& linked_id = gInventory.getLinkedItemID(item_id);
+	if (linked_id.notNull())
 	{
-		LLInventoryItem* item = gInventory.getItem(item_id);
+		LLInventoryItem* item = gInventory.getItem(linked_id);
 		if (item && item->getPermissions().allowModifyBy(gAgent.getID(),
 														 gAgent.getGroupID()))
 		{
@@ -595,12 +602,13 @@ LLInventoryItem* LLAgentWearables::getWearableInventoryItem(LLWearableType::ETyp
 
 const LLWearable* LLAgentWearables::getWearableFromItemID(const LLUUID& item_id) const
 {
+	const LLUUID& base_item_id = gInventory.getLinkedItemID(item_id);
 	for (S32 i=0; i < LLWearableType::WT_COUNT; i++)
 	{
 		for (U32 j=0; j < getWearableCount((LLWearableType::EType)i); j++)
 		{
 			const LLWearable * curr_wearable = getWearable((LLWearableType::EType)i, j);
-			if (curr_wearable && (curr_wearable->getItemID() == item_id))
+			if (curr_wearable && (curr_wearable->getItemID() == base_item_id))
 			{
 				return curr_wearable;
 			}
@@ -812,6 +820,16 @@ LLWearable* LLAgentWearables::getTopWearable(const LLWearableType::EType type)
 	return getWearable(type, count-1);
 }
 
+LLWearable* LLAgentWearables::getBottomWearable(const LLWearableType::EType type)
+{
+	if (getWearableCount(type) == 0)
+	{
+		return NULL;
+	}
+
+	return getWearable(type, 0);
+}
+
 U32 LLAgentWearables::getWearableCount(const LLWearableType::EType type) const
 {
 	wearableentry_map_t::const_iterator wearable_iter = mWearableDatas.find(type);
@@ -860,12 +878,7 @@ const LLUUID LLAgentWearables::getWearableAssetID(LLWearableType::EType type, U3
 
 BOOL LLAgentWearables::isWearingItem(const LLUUID& item_id) const
 {
-	const LLUUID& base_item_id = gInventory.getLinkedItemID(item_id);
-	if (getWearableFromItemID(base_item_id) != NULL) 
-	{
-		return TRUE;
-	}
-	return FALSE;
+	return getWearableFromItemID(item_id) != NULL;
 }
 
 // MULTI-WEARABLE: DEPRECATED (see backwards compatibility)
@@ -1565,37 +1578,18 @@ void LLAgentWearables::queryWearableCache()
 	S32 num_queries = 0;
 	for (U8 baked_index = 0; baked_index < BAKED_NUM_INDICES; baked_index++)
 	{
-		const LLVOAvatarDictionary::BakedEntry *baked_dict = LLVOAvatarDictionary::getInstance()->getBakedTexture((EBakedTextureIndex)baked_index);
-		LLMD5 hash;
-		bool hash_computed = false;
-		for (U8 i=0; i < baked_dict->mWearables.size(); i++)
-		{
-			const LLWearableType::EType baked_type = baked_dict->mWearables[i];
-			const U32 num_wearables = getWearableCount(baked_type);
-			for (U32 index = 0; index < num_wearables; ++index)
-			{
-				const LLWearable* wearable = getWearable(baked_type,index);
-				if (wearable)
-				{
-					LLUUID asset_id = wearable->getAssetID();
-					hash.update((const unsigned char*)asset_id.mData, UUID_BYTES);
-					hash_computed = true;
-				}
-			}
-		}
-		hash.finalize();
-		if (hash_computed)
+		LLUUID hash_id = computeBakedTextureHash((EBakedTextureIndex) baked_index);
+		if (hash_id.notNull())
 		{
-			LLUUID hash_id;
-			hash.raw_digest(hash_id.mData);
-			hash_id ^= baked_dict->mWearablesHashID;
 			num_queries++;
 			// *NOTE: make sure at least one request gets packed
 
+			ETextureIndex te_index = LLVOAvatarDictionary::bakedToLocalTextureIndex((EBakedTextureIndex)baked_index);
+
 			//llinfos << "Requesting texture for hash " << hash << " in baked texture slot " << baked_index << llendl;
 			gMessageSystem->nextBlockFast(_PREHASH_WearableData);
 			gMessageSystem->addUUIDFast(_PREHASH_ID, hash_id);
-			gMessageSystem->addU8Fast(_PREHASH_TextureIndex, (U8)baked_index);
+			gMessageSystem->addU8Fast(_PREHASH_TextureIndex, (U8)te_index);
 		}
 
 		gAgentQueryManager.mActiveCacheQueries[baked_index] = gAgentQueryManager.mWearablesCacheQueryID;
@@ -1607,6 +1601,39 @@ void LLAgentWearables::queryWearableCache()
 	gAgentQueryManager.mWearablesCacheQueryID++;
 }
 
+LLUUID LLAgentWearables::computeBakedTextureHash(LLVOAvatarDefines::EBakedTextureIndex index)
+{
+	LLUUID hash_id;
+	bool hash_computed = false;
+	LLMD5 hash;
+
+	const LLVOAvatarDictionary::BakedEntry *baked_dict = LLVOAvatarDictionary::getInstance()->getBakedTexture(index);
+
+	for (U8 i=0; i < baked_dict->mWearables.size(); i++)
+	{
+		const LLWearableType::EType baked_type = baked_dict->mWearables[i];
+		const U32 num_wearables = getWearableCount(baked_type);
+		for (U32 index = 0; index < num_wearables; ++index)
+		{
+			const LLWearable* wearable = getWearable(baked_type,index);
+			if (wearable)
+			{
+				LLUUID asset_id = wearable->getAssetID();
+				hash.update((const unsigned char*)asset_id.mData, UUID_BYTES);
+				hash_computed = true;
+			}
+		}
+	}
+	if (hash_computed)
+	{
+		hash.update((const unsigned char*)baked_dict->mWearablesHashID.mData, UUID_BYTES);
+		hash.finalize();
+		hash.raw_digest(hash_id.mData);
+	}
+
+	return hash_id;
+}
+
 // User has picked "remove from avatar" from a menu.
 // static
 void LLAgentWearables::userRemoveWearable(const LLWearableType::EType &type, const U32 &index)
@@ -1848,6 +1875,20 @@ void LLAgentWearables::checkWearablesLoaded() const
 #endif
 }
 
+// Returns false if the given wearable is already topmost/bottommost
+// (depending on closer_to_body parameter).
+bool LLAgentWearables::canMoveWearable(const LLUUID& item_id, bool closer_to_body)
+{
+	const LLWearable* wearable = getWearableFromItemID(item_id);
+	if (!wearable) return false;
+
+	LLWearableType::EType wtype = wearable->getType();
+	const LLWearable* marginal_wearable = closer_to_body ? getBottomWearable(wtype) : getTopWearable(wtype);
+	if (!marginal_wearable) return false;
+
+	return wearable != marginal_wearable;
+}
+
 BOOL LLAgentWearables::areWearablesLoaded() const
 {
 	checkWearablesLoaded();
@@ -1918,6 +1959,23 @@ bool LLAgentWearables::moveWearable(const LLViewerInventoryItem* item, bool clos
 	return false;
 }
 
+// static
+void LLAgentWearables::editWearable(const LLUUID& item_id)
+{
+	LLViewerInventoryItem* item;
+	LLWearable* wearable;
+
+	if ((item = gInventory.getLinkedItem(item_id)) &&
+		(wearable = gAgentWearables.getWearableFromAssetID(item->getAssetUUID())) &&
+		gAgentWearables.isWearableModifiable(item->getUUID()) &&
+		item->isFinished())
+	{
+		LLPanel* panel = LLSideTray::getInstance()->showPanel("panel_outfit_edit", LLSD());
+		// copied from LLPanelOutfitEdit::onEditWearableClicked()
+		LLSidepanelAppearance::editWearable(wearable, panel->getParent());
+	}
+}
+
 void LLAgentWearables::updateServer()
 {
 	sendAgentWearablesUpdate();
diff --git a/indra/newview/llagentwearables.h b/indra/newview/llagentwearables.h
index 27453b5b2516379807803f03e2c11a26a0c212f0..1f19d1045b25a1f9392e2bc3512089d8c028cfe6 100644
--- a/indra/newview/llagentwearables.h
+++ b/indra/newview/llagentwearables.h
@@ -71,17 +71,18 @@ class LLAgentWearables
 public:
 	BOOL			isWearingItem(const LLUUID& item_id) const;
 	BOOL			isWearableModifiable(LLWearableType::EType type, U32 index /*= 0*/) const;
+	BOOL			isWearableModifiable(const LLUUID& item_id) const;
+
 	BOOL			isWearableCopyable(LLWearableType::EType type, U32 index /*= 0*/) const;
 	BOOL			areWearablesLoaded() const;
 	void			updateWearablesLoaded();
 	void			checkWearablesLoaded() const;
+	bool			canMoveWearable(const LLUUID& item_id, bool closer_to_body);
 	
 	// Note: False for shape, skin, eyes, and hair, unless you have MORE than 1.
 	bool			canWearableBeRemoved(const LLWearable* wearable) const;
 
 	void			animateAllWearableParams(F32 delta, BOOL upload_bake);
-	
-	bool			moveWearable(const LLViewerInventoryItem* item, bool closer_to_body);
 
 	//--------------------------------------------------------------------
 	// Accessors
@@ -96,6 +97,7 @@ class LLAgentWearables
 	LLWearable*			getWearable(const LLWearableType::EType type, U32 index /*= 0*/); 
 	const LLWearable* 	getWearable(const LLWearableType::EType type, U32 index /*= 0*/) const;
 	LLWearable*		getTopWearable(const LLWearableType::EType type);
+	LLWearable*		getBottomWearable(const LLWearableType::EType type);
 	U32				getWearableCount(const LLWearableType::EType type) const;
 	U32				getWearableCount(const U32 tex_index) const;
 
@@ -133,6 +135,14 @@ class LLAgentWearables
 	void			recoverMissingWearable(const LLWearableType::EType type, U32 index /*= 0*/);
 	void			recoverMissingWearableDone();
 
+	//--------------------------------------------------------------------
+	// Editing/moving wearables
+	//--------------------------------------------------------------------
+
+public:
+	static void		editWearable(const LLUUID& item_id);
+	bool			moveWearable(const LLViewerInventoryItem* item, bool closer_to_body);
+
 	//--------------------------------------------------------------------
 	// Removing wearables
 	//--------------------------------------------------------------------
@@ -150,6 +160,8 @@ class LLAgentWearables
 public:
 	// Processes the initial wearables update message (if necessary, since the outfit folder makes it redundant)
 	static void		processAgentInitialWearablesUpdate(LLMessageSystem* mesgsys, void** user_data);
+	LLUUID			computeBakedTextureHash(LLVOAvatarDefines::EBakedTextureIndex index);
+
 protected:
 	void			sendAgentWearablesUpdate();
 	void			sendAgentWearablesRequest();
diff --git a/indra/newview/llappearancemgr.cpp b/indra/newview/llappearancemgr.cpp
index 7d39ba30f0a7f77e3701e48ad88714a47fd1ba36..e017fffa54209ee7363c49ef3cd2dcd83d09d877 100644
--- a/indra/newview/llappearancemgr.cpp
+++ b/indra/newview/llappearancemgr.cpp
@@ -152,27 +152,6 @@ class LLUpdateDirtyState: public LLInventoryCallback
 };
 
 
-//Inventory collect functor collecting wearables of a specific wearable type
-class LLFindClothesOfType : public LLInventoryCollectFunctor
-{
-public:
-	LLFindClothesOfType(LLWearableType::EType type) : mWearableType(type) {}
-	virtual ~LLFindClothesOfType() {}
-	virtual bool operator()(LLInventoryCategory* cat, LLInventoryItem* item)
-	{
-		if (!item) return false;
-		if (item->getType() != LLAssetType::AT_CLOTHING) return false;
-		
-		LLViewerInventoryItem *vitem = dynamic_cast<LLViewerInventoryItem*>(item);
-		if (!vitem || vitem->getWearableType() != mWearableType) return false;
-
-		return true;
-	}
-
-	const LLWearableType::EType mWearableType;
-};
-
-
 LLUpdateAppearanceOnDestroy::LLUpdateAppearanceOnDestroy():
 	mFireCount(0)
 {
@@ -190,7 +169,9 @@ LLUpdateAppearanceOnDestroy::~LLUpdateAppearanceOnDestroy()
 
 void LLUpdateAppearanceOnDestroy::fire(const LLUUID& inv_item)
 {
-	llinfos << "callback fired" << llendl;
+	LLViewerInventoryItem* item = (LLViewerInventoryItem*)gInventory.getItem(inv_item);
+	const std::string item_name = item ? item->getName() : "ITEM NOT FOUND";
+	llinfos << "callback fired [ name:" << item_name << " UUID:" << inv_item << " count:" << mFireCount << " ] " << llendl;
 	mFireCount++;
 }
 
@@ -524,7 +505,7 @@ bool LLWearableHoldingPattern::pollMissingWearables()
 
 	if (done)
 	{
-		gAgentAvatarp->wearablesLoaded();
+		gAgentAvatarp->debugWearablesLoaded();
 		clearCOFLinksForMissingWearables();
 		onAllComplete();
 	}
@@ -669,7 +650,7 @@ const LLUUID LLAppearanceMgr::getBaseOutfitUUID()
 	return outfit_cat->getUUID();
 }
 
-bool LLAppearanceMgr::wearItemOnAvatar(const LLUUID& item_id_to_wear, bool do_update)
+bool LLAppearanceMgr::wearItemOnAvatar(const LLUUID& item_id_to_wear, bool do_update, bool replace)
 {
 	if (item_id_to_wear.isNull()) return false;
 
@@ -690,6 +671,14 @@ bool LLAppearanceMgr::wearItemOnAvatar(const LLUUID& item_id_to_wear, bool do_up
 			LLNotificationsUtil::add("CanNotChangeAppearanceUntilLoaded");
 			return false;
 		}
+
+		// Remove the existing wearables of the same type.
+		// Remove existing body parts anyway because we must not be able to wear e.g. two skins.
+		if (replace || item_to_wear->getType() == LLAssetType::AT_BODYPART)
+		{
+			removeCOFLinksOfType(item_to_wear->getWearableType(), false);
+		}
+
 		addCOFItemLink(item_to_wear, do_update);
 		break;
 	case LLAssetType::AT_OBJECT:
@@ -709,6 +698,35 @@ void LLAppearanceMgr::changeOutfit(bool proceed, const LLUUID& category, bool ap
 	LLAppearanceMgr::instance().updateCOF(category,append);
 }
 
+void LLAppearanceMgr::replaceCurrentOutfit(const LLUUID& new_outfit)
+{
+	LLViewerInventoryCategory* cat = gInventory.getCategory(new_outfit);
+	wearInventoryCategory(cat, false, false);
+}
+
+void LLAppearanceMgr::addCategoryToCurrentOutfit(const LLUUID& cat_id)
+{
+	LLViewerInventoryCategory* cat = gInventory.getCategory(cat_id);
+	wearInventoryCategory(cat, false, true);
+}
+
+void LLAppearanceMgr::takeOffOutfit(const LLUUID& cat_id)
+{
+	LLInventoryModel::cat_array_t cats;
+	LLInventoryModel::item_array_t items;
+	LLFindWearables collector;
+
+	gInventory.collectDescendentsIf(cat_id, cats, items, FALSE, collector);
+
+	LLInventoryModel::item_array_t::const_iterator it = items.begin();
+	const LLInventoryModel::item_array_t::const_iterator it_end = items.end();
+	for( ; it_end != it; ++it)
+	{
+		LLViewerInventoryItem* item = *it;
+		removeItemFromAvatar(item->getUUID());
+	}
+}
+
 // Create a copy of src_id + contents as a subfolder of dst_id.
 void LLAppearanceMgr::shallowCopyCategory(const LLUUID& src_id, const LLUUID& dst_id,
 											  LLPointer<LLInventoryCallback> cb)
@@ -890,7 +908,7 @@ void LLAppearanceMgr::filterWearableItems(
 }
 
 // Create links to all listed items.
-void LLAppearanceMgr::linkAll(const LLUUID& category,
+void LLAppearanceMgr::linkAll(const LLUUID& cat_uuid,
 								  LLInventoryModel::item_array_t& items,
 								  LLPointer<LLInventoryCallback> cb)
 {
@@ -899,11 +917,16 @@ void LLAppearanceMgr::linkAll(const LLUUID& category,
 		const LLInventoryItem* item = items.get(i).get();
 		link_inventory_item(gAgent.getID(),
 							item->getLinkedUUID(),
-							category,
+							cat_uuid,
 							item->getName(),
 							item->LLInventoryItem::getDescription(),
 							LLAssetType::AT_LINK,
 							cb);
+
+		const LLViewerInventoryCategory *cat = gInventory.getCategory(cat_uuid);
+		const std::string cat_name = cat ? cat->getName() : "CAT NOT FOUND";
+
+		llinfos << "Linking Item [ name:" << item->getName() << " UUID:" << item->getUUID() << " ] to Category [ name:" << cat_name << " UUID:" << cat_uuid << " ] " << llendl; // Seraph remove for 2.1
 	}
 }
 
@@ -972,9 +995,13 @@ void LLAppearanceMgr::updateCOF(const LLUUID& category, bool append)
 	llinfos << "creating LLUpdateAppearanceOnDestroy" << llendl;
 	LLPointer<LLInventoryCallback> link_waiter = new LLUpdateAppearanceOnDestroy;
 
+	llinfos << "Linking body items" << llendl; // Seraph remove for 2.1
 	linkAll(cof, body_items, link_waiter);
+	llinfos << "Linking wear items" << llendl; // Seraph remove for 2.1
 	linkAll(cof, wear_items, link_waiter);
+	llinfos << "Linking obj items" << llendl; // Seraph remove for 2.1
 	linkAll(cof, obj_items, link_waiter);
+	llinfos << "Linking gesture items" << llendl; // Seraph remove for 2.1
 	linkAll(cof, gest_items, link_waiter);
 
 	// Add link to outfit if category is an outfit. 
@@ -1030,8 +1057,7 @@ void LLAppearanceMgr::updateAgentWearables(LLWearableHoldingPattern* holder, boo
 			LLWearable* wearable = data.mWearable;
 			if( wearable && ((S32)wearable->getType() == i) )
 			{
-				LLViewerInventoryItem* item;
-				item = (LLViewerInventoryItem*)gInventory.getItem(data.mItemID);
+				LLViewerInventoryItem* item = (LLViewerInventoryItem*)gInventory.getItem(data.mItemID);
 				if( item && (item->getAssetUUID() == wearable->getAssetID()) )
 				{
 					items.put(item);
@@ -1483,9 +1509,9 @@ void LLAppearanceMgr::addCOFItemLink(const LLInventoryItem *item, bool do_update
 		// Are these links to different items of the same body part
 		// type? If so, new item will replace old.
 		// TODO: MULTI-WEARABLE: check for wearable limit for clothing types
-		else if (is_body_part)
+		else if (is_body_part && (vitem->isWearableType()) && (vitem->getWearableType() == wearable_type))
 		{
-			if (inv_item->getIsLinkType())
+			if (inv_item->getIsLinkType()  && (vitem->getWearableType() == wearable_type))
 			{
 				gInventory.purgeObject(inv_item->getUUID());
 			}
@@ -1553,6 +1579,29 @@ void LLAppearanceMgr::removeCOFItemLinks(const LLUUID& item_id, bool do_update)
 	}
 }
 
+void LLAppearanceMgr::removeCOFLinksOfType(LLWearableType::EType type, bool do_update)
+{
+	LLFindWearablesOfType filter_wearables_of_type(type);
+	LLInventoryModel::cat_array_t cats;
+	LLInventoryModel::item_array_t items;
+	LLInventoryModel::item_array_t::const_iterator it;
+
+	gInventory.collectDescendentsIf(getCOF(), cats, items, true, filter_wearables_of_type);
+	for (it = items.begin(); it != items.end(); ++it)
+	{
+		const LLViewerInventoryItem* item = *it;
+		if (item->getIsLinkType()) // we must operate on links only
+		{
+			gInventory.purgeObject(item->getUUID());
+		}
+	}
+
+	if (do_update)
+	{
+		updateAppearanceFromCOF();
+	}
+}
+
 bool sort_by_linked_uuid(const LLViewerInventoryItem* item1, const LLViewerInventoryItem* item2)
 {
 	if (!item1 || !item2)
@@ -1657,7 +1706,7 @@ void LLAppearanceMgr::autopopulateOutfits()
 // Handler for anything that's deferred until avatar de-clouds.
 void LLAppearanceMgr::onFirstFullyVisible()
 {
-	gAgentAvatarp->avatarVisible();
+	gAgentAvatarp->debugAvatarVisible();
 	autopopulateOutfits();
 }
 
@@ -1883,7 +1932,6 @@ void LLAppearanceMgr::removeItemFromAvatar(const LLUUID& id_to_remove)
 	}
 }
 
-
 bool LLAppearanceMgr::moveWearable(LLViewerInventoryItem* item, bool closer_to_body)
 {
 	if (!item || !item->isWearableType()) return false;
@@ -1892,11 +1940,11 @@ bool LLAppearanceMgr::moveWearable(LLViewerInventoryItem* item, bool closer_to_b
 
 	LLInventoryModel::cat_array_t cats;
 	LLInventoryModel::item_array_t items;
-	LLFindClothesOfType filter_wearables_of_type(item->getWearableType());
+	LLFindWearablesOfType filter_wearables_of_type(item->getWearableType());
 	gInventory.collectDescendentsIf(getCOF(), cats, items, true, filter_wearables_of_type);
 	if (items.empty()) return false;
 
-	//*TODO all items are not guarantied to have valid descriptions (check?)
+	// We assume that the items have valid descriptions.
 	std::sort(items.begin(), items.end(), WearablesOrderComparator(item->getWearableType()));
 
 	if (closer_to_body && items.front() == item) return false;
diff --git a/indra/newview/llappearancemgr.h b/indra/newview/llappearancemgr.h
index 516dada39da484c95787d501ec7818c9e868b383..96541beb7d84672a81488972af2b3fe2abd11d83 100644
--- a/indra/newview/llappearancemgr.h
+++ b/indra/newview/llappearancemgr.h
@@ -58,6 +58,9 @@ class LLAppearanceMgr: public LLSingleton<LLAppearanceMgr>
 	void wearCategoryFinal(LLUUID& cat_id, bool copy_items, bool append);
 	void wearOutfitByName(const std::string& name);
 	void changeOutfit(bool proceed, const LLUUID& category, bool append);
+	void replaceCurrentOutfit(const LLUUID& new_outfit);
+	void takeOffOutfit(const LLUUID& cat_id);
+	void addCategoryToCurrentOutfit(const LLUUID& cat_id);
 
 	// Copy all items and the src category itself.
 	void shallowCopyCategory(const LLUUID& src_id, const LLUUID& dst_id,
@@ -81,7 +84,7 @@ class LLAppearanceMgr: public LLSingleton<LLAppearanceMgr>
 	const LLUUID getBaseOutfitUUID();
 
 	// Wear/attach an item (from a user's inventory) on the agent
-	bool wearItemOnAvatar(const LLUUID& item_to_wear, bool do_update = true);
+	bool wearItemOnAvatar(const LLUUID& item_to_wear, bool do_update = true, bool replace = false);
 
 	// Update the displayed outfit name in UI.
 	void updatePanelOutfitName(const std::string& name);
@@ -111,6 +114,7 @@ class LLAppearanceMgr: public LLSingleton<LLAppearanceMgr>
 
 	// Remove COF entries
 	void removeCOFItemLinks(const LLUUID& item_id, bool do_update = true);
+	void removeCOFLinksOfType(LLWearableType::EType type, bool do_update = true);
 
 	// Add COF link to ensemble folder.
 	void addEnsembleLink(LLInventoryCategory* item, bool do_update = true);
diff --git a/indra/newview/llassetuploadresponders.cpp b/indra/newview/llassetuploadresponders.cpp
index 2f90d652e4938956c2c54e63497d6e9411b77fa9..27dcb9f1c7f9bb32a113b65d3d28f5c145679a4e 100644
--- a/indra/newview/llassetuploadresponders.cpp
+++ b/indra/newview/llassetuploadresponders.cpp
@@ -37,7 +37,7 @@
 // viewer includes
 #include "llagent.h"
 #include "llcompilequeue.h"
-#include "llfloaterbuycurrency.h"
+#include "llbuycurrencyhtml.h"
 #include "llfilepicker.h"
 #include "llinventorydefines.h"
 #include "llinventoryobserver.h"
@@ -186,7 +186,7 @@ void LLAssetUploadResponder::uploadFailure(const LLSD& content)
 		S32 price = LLGlobalEconomy::Singleton::getInstance()->getPriceUpload();
 		LLStringUtil::format_map_t args;
 		args["AMOUNT"] = llformat("%d", price);
-		LLFloaterBuyCurrency::buyCurrency(LLTrans::getString("uploading_costs", args), price);
+		LLBuyCurrencyHTML::openCurrencyFloater( LLTrans::getString("uploading_costs", args), price );
 	}
 	else
 	{
diff --git a/indra/newview/llavatarlist.cpp b/indra/newview/llavatarlist.cpp
index 24290ac089a85a8a460ea312bb7f6ccd0860bd5f..3275d784a301e8ed963672f2dcc06fb7ccaefee6 100644
--- a/indra/newview/llavatarlist.cpp
+++ b/indra/newview/llavatarlist.cpp
@@ -46,6 +46,7 @@
 #include "llavatariconctrl.h"
 #include "llcallingcard.h" // for LLAvatarTracker
 #include "llcachename.h"
+#include "lllistcontextmenu.h"
 #include "llrecentpeople.h"
 #include "lluuid.h"
 #include "llvoiceclient.h"
diff --git a/indra/newview/llavatarlist.h b/indra/newview/llavatarlist.h
index a9320055ca350f382e28b62527b1c88eea58b0d1..fffc6e6e73d2d5b1ac140571a0427efec947384c 100644
--- a/indra/newview/llavatarlist.h
+++ b/indra/newview/llavatarlist.h
@@ -38,6 +38,7 @@
 #include "llavatarlistitem.h"
 
 class LLTimer;
+class LLListContextMenu;
 
 /**
  * Generic list of avatars.
@@ -77,7 +78,7 @@ class LLAvatarList : public LLFlatListViewEx
 	uuid_vec_t& getIDs() 							{ return mIDs; }
 	bool contains(const LLUUID& id);
 
-	void setContextMenu(LLAvatarListItem::ContextMenu* menu) { mContextMenu = menu; }
+	void setContextMenu(LLListContextMenu* menu) { mContextMenu = menu; }
 	void setSessionID(const LLUUID& session_id) { mSessionID = session_id; }
 	const LLUUID& getSessionID() { return mSessionID; }
 
@@ -127,7 +128,7 @@ class LLAvatarList : public LLFlatListViewEx
 	uuid_vec_t				mIDs;
 	LLUUID					mSessionID;
 
-	LLAvatarListItem::ContextMenu* mContextMenu;
+	LLListContextMenu*	mContextMenu;
 
 	commit_signal_t mRefreshCompleteSignal;
 	mouse_signal_t mItemDoubleClickSignal;
diff --git a/indra/newview/llavatarlistitem.cpp b/indra/newview/llavatarlistitem.cpp
index 5a8ad73c8324039b47e805177ab43a6154aed456..c74075d67f2c9268f36f2ca72a92f275e2a36769 100644
--- a/indra/newview/llavatarlistitem.cpp
+++ b/indra/newview/llavatarlistitem.cpp
@@ -1,6 +1,6 @@
 /** 
  * @file llavatarlistitem.cpp
- * @avatar list item source file
+ * @brief avatar list item source file
  *
  * $LicenseInfo:firstyear=2009&license=viewergpl$
  * 
diff --git a/indra/newview/llavatarlistitem.h b/indra/newview/llavatarlistitem.h
index c6fac7a9f1cc749f0595c78aeaafce38f48a9335..ba9c3574d5924113aeebe18fb29236c895c2412b 100644
--- a/indra/newview/llavatarlistitem.h
+++ b/indra/newview/llavatarlistitem.h
@@ -1,6 +1,6 @@
 /** 
  * @file llavatarlistitem.h
- * @avatar list item header file
+ * @brief avatar list item header file
  *
  * $LicenseInfo:firstyear=2009&license=viewergpl$
  * 
@@ -67,13 +67,6 @@ class LLAvatarListItem : public LLPanel, public LLFriendObserver
 		IS_OFFLINE,
 	} EItemState;
 
-	class ContextMenu
-	{
-	public:
-		virtual void show(LLView* spawning_view, const uuid_vec_t& selected_uuids, S32 x, S32 y) = 0;
-		virtual void hide() = 0;
-	};
-
 	/**
 	 * Creates an instance of LLAvatarListItem.
 	 *
diff --git a/indra/newview/llbottomtray.cpp b/indra/newview/llbottomtray.cpp
index caf43f5ddc5202c833ee51752954275a12bfdbc5..ae974604683f095440054d75ae1f48139f77ae1b 100644
--- a/indra/newview/llbottomtray.cpp
+++ b/indra/newview/llbottomtray.cpp
@@ -156,10 +156,6 @@ LLBottomTray::LLBottomTray(const LLSD&)
 ,	mMovementButton(NULL)
 ,	mResizeState(RS_NORESIZE)
 ,	mBottomTrayContextMenu(NULL)
-,	mMovementPanel(NULL)
-,	mCamPanel(NULL)
-,	mSnapshotPanel(NULL)
-,	mGesturePanel(NULL)
 ,	mCamButton(NULL)
 ,	mBottomTrayLite(NULL)
 ,	mIsInLiteMode(false)
@@ -421,22 +417,12 @@ void LLBottomTray::updateContextMenu(S32 x, S32 y, MASK mask)
 
 	bool in_edit_box = edit_box->pointInView(local_x, local_y);
 
-	LLMenuItemGL* menu_item;
-	menu_item = mBottomTrayContextMenu->findChild<LLMenuItemGL>("NearbyChatBar_Cut");
-	if(menu_item)
-		menu_item->setVisible(in_edit_box);
-	menu_item = mBottomTrayContextMenu->findChild<LLMenuItemGL>("NearbyChatBar_Copy");
-	if(menu_item)
-		menu_item->setVisible(in_edit_box);
-	menu_item = mBottomTrayContextMenu->findChild<LLMenuItemGL>("NearbyChatBar_Paste");
-	if(menu_item)
-		menu_item->setVisible(in_edit_box);
-	menu_item = mBottomTrayContextMenu->findChild<LLMenuItemGL>("NearbyChatBar_Delete");
-	if(menu_item)
-		menu_item->setVisible(in_edit_box);
-	menu_item = mBottomTrayContextMenu->findChild<LLMenuItemGL>("NearbyChatBar_Select_All");
-	if(menu_item)
-		menu_item->setVisible(in_edit_box);
+	mBottomTrayContextMenu->setItemVisible("Separator", in_edit_box);
+	mBottomTrayContextMenu->setItemVisible("NearbyChatBar_Cut", in_edit_box);
+	mBottomTrayContextMenu->setItemVisible("NearbyChatBar_Copy", in_edit_box);
+	mBottomTrayContextMenu->setItemVisible("NearbyChatBar_Paste", in_edit_box);
+	mBottomTrayContextMenu->setItemVisible("NearbyChatBar_Delete", in_edit_box);
+	mBottomTrayContextMenu->setItemVisible("NearbyChatBar_Select_All", in_edit_box);
 }
 
 void LLBottomTray::showGestureButton(BOOL visible)
@@ -483,12 +469,8 @@ BOOL LLBottomTray::postBuild()
 
 	mNearbyChatBar = getChild<LLNearbyChatBar>("chat_bar");
 	mToolbarStack = getChild<LLLayoutStack>("toolbar_stack");
-	mMovementPanel = getChild<LLPanel>("movement_panel");
-	mMovementButton = mMovementPanel->getChild<LLButton>("movement_btn");
-	mGesturePanel = getChild<LLPanel>("gesture_panel");
-	mCamPanel = getChild<LLPanel>("cam_panel");
-	mCamButton = mCamPanel->getChild<LLButton>("camera_btn");
-	mSnapshotPanel = getChild<LLPanel>("snapshot_panel");
+	mMovementButton = getChild<LLButton>("movement_btn");
+	mCamButton = getChild<LLButton>("camera_btn");
 	setRightMouseDownCallback(boost::bind(&LLBottomTray::showBottomTrayContextMenu,this, _2, _3,_4));
 
 	mSpeakPanel = getChild<LLPanel>("speak_panel");
@@ -1177,12 +1159,11 @@ bool LLBottomTray::canButtonBeShown(EResizeState processed_object_type) const
 
 void LLBottomTray::initResizeStateContainers()
 {
-	// *TODO: get rid of mGesturePanel, mMovementPanel, mCamPanel, mSnapshotPanel instance members
 	// init map with objects should be processed for each type
-	mStateProcessedObjectMap.insert(std::make_pair(RS_BUTTON_GESTURES, mGesturePanel));
-	mStateProcessedObjectMap.insert(std::make_pair(RS_BUTTON_MOVEMENT, mMovementPanel));
-	mStateProcessedObjectMap.insert(std::make_pair(RS_BUTTON_CAMERA, mCamPanel));
-	mStateProcessedObjectMap.insert(std::make_pair(RS_BUTTON_SNAPSHOT, mSnapshotPanel));
+	mStateProcessedObjectMap.insert(std::make_pair(RS_BUTTON_GESTURES, getChild<LLPanel>("gesture_panel")));
+	mStateProcessedObjectMap.insert(std::make_pair(RS_BUTTON_MOVEMENT, getChild<LLPanel>("movement_panel")));
+	mStateProcessedObjectMap.insert(std::make_pair(RS_BUTTON_CAMERA, getChild<LLPanel>("cam_panel")));
+	mStateProcessedObjectMap.insert(std::make_pair(RS_BUTTON_SNAPSHOT, getChild<LLPanel>("snapshot_panel")));
 	mStateProcessedObjectMap.insert(std::make_pair(RS_BUTTON_SIDEBAR, getChild<LLPanel>("sidebar_btn_panel")));
 	mStateProcessedObjectMap.insert(std::make_pair(RS_BUTTON_BUILD, getChild<LLPanel>("build_btn_panel")));
 	mStateProcessedObjectMap.insert(std::make_pair(RS_BUTTON_SEARCH, getChild<LLPanel>("search_btn_panel")));
diff --git a/indra/newview/llbottomtray.h b/indra/newview/llbottomtray.h
index 889dc42097c379f3f94ab75ed43c550d1a50511b..c0887df39a115801c23c4632fb5814ddfe80d0a8 100644
--- a/indra/newview/llbottomtray.h
+++ b/indra/newview/llbottomtray.h
@@ -385,10 +385,6 @@ class LLBottomTray
 	LLNearbyChatBar*	mNearbyChatBar;
 	LLLayoutStack*		mToolbarStack;
 	LLMenuGL*			mBottomTrayContextMenu;
-	LLPanel*			mMovementPanel;
-	LLPanel*			mCamPanel;
-	LLPanel*			mSnapshotPanel;
-	LLPanel*			mGesturePanel;
 	LLButton*			mCamButton;
 	LLButton*			mMovementButton;
 	LLBottomTrayLite*   mBottomTrayLite;
diff --git a/indra/newview/llbuycurrencyhtml.cpp b/indra/newview/llbuycurrencyhtml.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..163829a1ea0b9bdcf81a096710308899fd9c6829
--- /dev/null
+++ b/indra/newview/llbuycurrencyhtml.cpp
@@ -0,0 +1,165 @@
+/** 
+ * @file llbuycurrencyhtml.cpp
+ * @brief Manages Buy Currency HTML floater
+ *
+ * $LicenseInfo:firstyear=2010&license=viewergpl$
+ * 
+ * Copyright (c) 2006-2010, Linden Research, Inc.
+ * 
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
+ * 
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
+ * 
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
+ * 
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
+ * $/LicenseInfo$
+ */
+
+#include "llviewerprecompiledheaders.h"
+
+#include "llfloaterbuycurrency.h"
+#include "llbuycurrencyhtml.h"
+#include "llfloaterbuycurrencyhtml.h"
+
+#include "llfloaterreg.h"
+#include "llcommandhandler.h"
+#include "llviewercontrol.h"
+
+// support for secondlife:///app/buycurrencyhtml/{ACTION}/{NEXT_ACTION}/{RETURN_CODE} SLapps
+class LLBuyCurrencyHTMLHandler : 
+	public LLCommandHandler
+{
+public:
+	// requests will be throttled from a non-trusted browser
+	LLBuyCurrencyHTMLHandler() : LLCommandHandler( "buycurrencyhtml", UNTRUSTED_ALLOW ) {}
+
+	bool handle(const LLSD& params, const LLSD& query_map, LLMediaCtrl* web)
+	{
+		std::string action( "" );
+		if ( params.size() >= 1 )
+		{
+			 action = params[ 0 ].asString();
+		};
+
+		std::string next_action( "" );
+		if ( params.size() >= 2 )
+		{
+			next_action = params[ 1 ].asString();
+		};
+
+		int result_code = 0;
+		if ( params.size() >= 3 )
+		{
+			result_code = params[ 2 ].asInteger();
+		};
+
+		// open the legacy XUI based currency floater
+		if ( "open_legacy" == next_action )
+		{
+			LLFloaterBuyCurrency::buyCurrency();
+		};
+
+		// ask the Buy Currency floater to close
+		// note: this is the last thing we can do so make
+		// sure any other actions are processed before this.
+		if ( "close" == action )
+		{
+			LLBuyCurrencyHTML::closeDialog();
+		};
+
+		return true;
+	};
+};
+LLBuyCurrencyHTMLHandler gBuyCurrencyHTMLHandler;
+
+////////////////////////////////////////////////////////////////////////////////
+// static
+// Opens the legacy XUI based floater or new HTML based one based on 
+// the QuickBuyCurrency value in settings.xml - this overload is for
+// the case where the amount is not requested.
+void LLBuyCurrencyHTML::openCurrencyFloater()
+{
+	if ( gSavedSettings.getBOOL( "QuickBuyCurrency" ) )
+	{
+		// HTML version
+		LLBuyCurrencyHTML::showDialog( false, "", 0 );
+	}
+	else
+	{
+		// legacy version
+		LLFloaterBuyCurrency::buyCurrency();
+	};
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// static
+// Opens the legacy XUI based floater or new HTML based one based on 
+// the QuickBuyCurrency value in settings.xml - this overload is for
+// the case where the amount and a string to display are requested.
+void LLBuyCurrencyHTML::openCurrencyFloater( const std::string& message, S32 sum )
+{
+	if ( gSavedSettings.getBOOL( "QuickBuyCurrency" ) )
+	{
+		// HTML version
+		LLBuyCurrencyHTML::showDialog( true, message, sum );
+	}
+	else
+	{
+		// legacy version
+		LLFloaterBuyCurrency::buyCurrency( message, sum );
+	};
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// static
+void LLBuyCurrencyHTML::showDialog( bool specific_sum_requested, const std::string& message, S32 sum )
+{
+	LLFloaterBuyCurrencyHTML* buy_currency_floater = dynamic_cast< LLFloaterBuyCurrencyHTML* >( LLFloaterReg::getInstance( "buy_currency_html" ) );
+	if ( buy_currency_floater )
+	{
+		// pass on flag indicating if we want to buy specific amount and if so, how much
+		buy_currency_floater->setParams( specific_sum_requested, message, sum );
+
+		// force navigate to new URL
+		buy_currency_floater->navigateToFinalURL();
+
+		// make it visible and raise to front
+		BOOL visible = TRUE;
+		buy_currency_floater->setVisible( visible );
+		BOOL take_focus = TRUE;
+		buy_currency_floater->setFrontmost( take_focus );
+
+		// spec calls for floater to be centered on client window
+		buy_currency_floater->center();
+	}
+	else
+	{
+		llwarns << "Buy Currency (HTML) Floater not found" << llendl;
+	};
+}
+
+////////////////////////////////////////////////////////////////////////////////
+//
+void LLBuyCurrencyHTML::closeDialog()
+{
+	LLFloaterBuyCurrencyHTML* buy_currency_floater = dynamic_cast< LLFloaterBuyCurrencyHTML* >(LLFloaterReg::getInstance( "buy_currency_html" ) );
+	if ( buy_currency_floater )
+	{
+		buy_currency_floater->closeFloater();
+	};
+}
diff --git a/indra/newview/llbuycurrencyhtml.h b/indra/newview/llbuycurrencyhtml.h
new file mode 100644
index 0000000000000000000000000000000000000000..3435bb0451294f92ffc9ed36fcab623de0a37ac6
--- /dev/null
+++ b/indra/newview/llbuycurrencyhtml.h
@@ -0,0 +1,57 @@
+/** 
+ * @file llbuycurrencyhtml.h
+ * @brief Manages Buy Currency HTML floater
+ *
+ * $LicenseInfo:firstyear=2010&license=viewergpl$
+ * 
+ * Copyright (c) 2006-2010, Linden Research, Inc.
+ * 
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
+ * 
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
+ * 
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
+ * 
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
+ * $/LicenseInfo$
+ */
+
+#ifndef LL_LLBUYCURRENCYHTML_H
+#define LL_LLBUYCURRENCYHTML_H
+
+#include "llsingleton.h"
+
+class LLFloaterBuyCurrencyHTML;
+
+class LLBuyCurrencyHTML
+{
+	public:
+		// choke point for opening a legacy or new currency floater - this overload is when the L$ sum is not required
+		static void openCurrencyFloater();
+
+		// choke point for opening a legacy or new currency floater - this overload is when the L$ sum is required
+		static void openCurrencyFloater( const std::string& message, S32 sum );
+
+		// show and give focus to actual currency floater - this is used for both cases
+		// where the sum is required and where it is not
+		static void showDialog( bool specific_sum_requested, const std::string& message, S32 sum );
+
+		// close (and destroy) the currency floater
+		static void closeDialog();
+};
+
+#endif  // LL_LLBUYCURRENCYHTML_H
diff --git a/indra/newview/llcofwearables.cpp b/indra/newview/llcofwearables.cpp
index 7c4ceb34583884e483b413c7a683e10dff2259e1..dfc203111ab7ea5a982bc9651ab6ec33ee50dd48 100644
--- a/indra/newview/llcofwearables.cpp
+++ b/indra/newview/llcofwearables.cpp
@@ -35,9 +35,13 @@
 #include "llcofwearables.h"
 
 #include "llagentdata.h"
+#include "llagentwearables.h"
 #include "llappearancemgr.h"
 #include "llinventory.h"
 #include "llinventoryfunctions.h"
+#include "lllistcontextmenu.h"
+#include "llmenugl.h"
+#include "llviewermenu.h"
 #include "llwearableitemslist.h"
 
 static LLRegisterPanelClassWrapper<LLCOFAccordionListAdaptor> t_cof_accodion_list_adaptor("accordion_list_adaptor");
@@ -49,14 +53,130 @@ const LLSD REARRANGE = LLSD().with("rearrange", LLSD());
 static const LLWearableItemNameComparator WEARABLE_NAME_COMPARATOR;
 
 
+//////////////////////////////////////////////////////////////////////////
+
+class CofAttachmentContextMenu : public LLListContextMenu
+{
+protected:
+
+	/*virtual*/ LLContextMenu* createMenu()
+	{
+		LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar;
+
+		functor_t take_off = boost::bind(&LLAppearanceMgr::removeItemFromAvatar, LLAppearanceMgr::getInstance(), _1);
+		registrar.add("Attachment.Detach", boost::bind(handleMultiple, take_off, mUUIDs));
+
+		return createFromFile("menu_cof_attachment.xml");
+	}
+};
+
+//////////////////////////////////////////////////////////////////////////
+
+class CofClothingContextMenu : public LLListContextMenu
+{
+protected:
+
+	/*virtual*/ LLContextMenu* createMenu()
+	{
+		LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar;
+		LLUICtrl::EnableCallbackRegistry::ScopedRegistrar enable_registrar;
+		LLUUID selected_id = mUUIDs.back();
+		functor_t take_off = boost::bind(&LLAppearanceMgr::removeItemFromAvatar, LLAppearanceMgr::getInstance(), _1);
+
+		registrar.add("Clothing.TakeOff", boost::bind(handleMultiple, take_off, mUUIDs));
+		registrar.add("Clothing.MoveUp", boost::bind(moveWearable, selected_id, false));
+		registrar.add("Clothing.MoveDown", boost::bind(moveWearable, selected_id, true));
+		registrar.add("Clothing.Edit", boost::bind(LLAgentWearables::editWearable, selected_id));
+
+		enable_registrar.add("Clothing.OnEnable", boost::bind(&CofClothingContextMenu::onEnable, this, _2));
+
+		return createFromFile("menu_cof_clothing.xml");
+	}
+
+	bool onEnable(const LLSD& data)
+	{
+		std::string param = data.asString();
+		LLUUID selected_id = mUUIDs.back();
+
+		if ("move_up" == param)
+		{
+			return gAgentWearables.canMoveWearable(selected_id, false);
+		}
+		else if ("move_down" == param)
+		{
+			return gAgentWearables.canMoveWearable(selected_id, true);
+		}
+		else if ("edit" == param)
+		{
+			return gAgentWearables.isWearableModifiable(selected_id);
+		}
+		return true;
+	}
+
+	// We don't use LLAppearanceMgr::moveWearable() directly because
+	// the item may be invalidated between setting the callback and calling it.
+	static bool moveWearable(const LLUUID& item_id, bool closer_to_body)
+	{
+		LLViewerInventoryItem* item = gInventory.getItem(item_id);
+		return LLAppearanceMgr::instance().moveWearable(item, closer_to_body);
+	}
+
+};
+
+//////////////////////////////////////////////////////////////////////////
+
+class CofBodyPartContextMenu : public LLListContextMenu
+{
+protected:
+
+	/*virtual*/ LLContextMenu* createMenu()
+	{
+		LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar;
+		LLUICtrl::EnableCallbackRegistry::ScopedRegistrar enable_registrar;
+		LLUUID selected_id = mUUIDs.back();
+
+		registrar.add("BodyPart.Replace", boost::bind(&LLAppearanceMgr::wearItemOnAvatar,
+			LLAppearanceMgr::getInstance(), selected_id, true, true));
+		registrar.add("BodyPart.Edit", boost::bind(LLAgentWearables::editWearable, selected_id));
+
+		enable_registrar.add("BodyPart.OnEnable", boost::bind(&CofBodyPartContextMenu::onEnable, this, _2));
+
+		return createFromFile("menu_cof_body_part.xml");
+	}
+
+	bool onEnable(const LLSD& data)
+	{
+		std::string param = data.asString();
+		LLUUID selected_id = mUUIDs.back();
+
+		if ("edit" == param)
+		{
+			return gAgentWearables.isWearableModifiable(selected_id);
+		}
+
+		return true;
+	}
+};
+
+//////////////////////////////////////////////////////////////////////////
+
 LLCOFWearables::LLCOFWearables() : LLPanel(),
 	mAttachments(NULL),
 	mClothing(NULL),
 	mBodyParts(NULL),
 	mLastSelectedList(NULL)
 {
+	mClothingMenu = new CofClothingContextMenu();
+	mAttachmentMenu = new CofAttachmentContextMenu();
+	mBodyPartMenu = new CofBodyPartContextMenu();
 };
 
+LLCOFWearables::~LLCOFWearables()
+{
+	delete mClothingMenu;
+	delete mAttachmentMenu;
+	delete mBodyPartMenu;
+}
 
 // virtual
 BOOL LLCOFWearables::postBuild()
@@ -65,6 +185,9 @@ BOOL LLCOFWearables::postBuild()
 	mClothing = getChild<LLFlatListView>("list_clothing");
 	mBodyParts = getChild<LLFlatListView>("list_body_parts");
 
+	mClothing->setRightMouseDownCallback(boost::bind(&LLCOFWearables::onListRightClick, this, _1, _2, _3, mClothingMenu));
+	mAttachments->setRightMouseDownCallback(boost::bind(&LLCOFWearables::onListRightClick, this, _1, _2, _3, mAttachmentMenu));
+	mBodyParts->setRightMouseDownCallback(boost::bind(&LLCOFWearables::onListRightClick, this, _1, _2, _3, mBodyPartMenu));
 
 	//selection across different list/tabs is not supported
 	mAttachments->setCommitCallback(boost::bind(&LLCOFWearables::onSelectionChange, this, mAttachments));
@@ -304,6 +427,14 @@ LLUUID LLCOFWearables::getSelectedUUID()
 	return mLastSelectedList->getSelectedUUID();
 }
 
+bool LLCOFWearables::getSelectedUUIDs(uuid_vec_t& selected_ids)
+{
+	if (!mLastSelectedList) return false;
+
+	mLastSelectedList->getSelectedUUIDs(selected_ids);
+	return selected_ids.size() != 0;
+}
+
 void LLCOFWearables::clear()
 {
 	mAttachments->clear();
@@ -311,4 +442,16 @@ void LLCOFWearables::clear()
 	mBodyParts->clear();
 }
 
+void LLCOFWearables::onListRightClick(LLUICtrl* ctrl, S32 x, S32 y, LLListContextMenu* menu)
+{
+	if(menu)
+	{
+		uuid_vec_t selected_uuids;
+		if(getSelectedUUIDs(selected_uuids))
+		{
+			menu->show(ctrl, selected_uuids, x, y);
+		}
+	}
+}
+
 //EOF
diff --git a/indra/newview/llcofwearables.h b/indra/newview/llcofwearables.h
index 583ee962477896cae41cfac37219deb8e340ff4f..590aa709ddd3833002c28ddbba6ddfb0d88e9498 100644
--- a/indra/newview/llcofwearables.h
+++ b/indra/newview/llcofwearables.h
@@ -40,6 +40,7 @@
 #include "llappearancemgr.h"
 #include "llinventorymodel.h"
 
+class LLListContextMenu;
 class LLPanelClothingListItem;
 class LLPanelBodyPartsListItem;
 class LLPanelDeletableWearableListItem;
@@ -115,11 +116,12 @@ class LLCOFWearables : public LLPanel
 
 
 	LLCOFWearables();
-	virtual ~LLCOFWearables() {};
+	virtual ~LLCOFWearables();
 
 	/*virtual*/ BOOL postBuild();
 	
 	LLUUID getSelectedUUID();
+	bool getSelectedUUIDs(uuid_vec_t& selected_ids);
 
 	void refresh();
 	void clear();
@@ -138,6 +140,8 @@ class LLCOFWearables : public LLPanel
 	LLPanelBodyPartsListItem* buildBodypartListItem(LLViewerInventoryItem* item);
 	LLPanelDeletableWearableListItem* buildAttachemntListItem(LLViewerInventoryItem* item);
 
+	void onListRightClick(LLUICtrl* ctrl, S32 x, S32 y, LLListContextMenu* menu);
+
 	LLFlatListView* mAttachments;
 	LLFlatListView* mClothing;
 	LLFlatListView* mBodyParts;
@@ -146,6 +150,9 @@ class LLCOFWearables : public LLPanel
 
 	LLCOFCallbacks mCOFCallbacks;
 
+	LLListContextMenu* mClothingMenu;
+	LLListContextMenu* mAttachmentMenu;
+	LLListContextMenu* mBodyPartMenu;
 };
 
 
diff --git a/indra/newview/lldrawpooltree.cpp b/indra/newview/lldrawpooltree.cpp
index 1a5d55d793b1f7011e140e903dc04bd484443bd3..1571415e63473cdadc3841a5bb76c3c7e849731e 100644
--- a/indra/newview/lldrawpooltree.cpp
+++ b/indra/newview/lldrawpooltree.cpp
@@ -113,9 +113,12 @@ void LLDrawPoolTree::render(S32 pass)
 			 iter != mDrawFace.end(); iter++)
 		{
 			LLFace *face = *iter;
-			face->mVertexBuffer->setBuffer(LLDrawPoolTree::VERTEX_DATA_MASK);
-			face->mVertexBuffer->drawRange(LLRender::TRIANGLES, 0, face->mVertexBuffer->getRequestedVerts()-1, face->mVertexBuffer->getRequestedIndices(), 0); 
-			gPipeline.addTrianglesDrawn(face->mVertexBuffer->getRequestedIndices());
+			if(face->mVertexBuffer.notNull())
+			{
+				face->mVertexBuffer->setBuffer(LLDrawPoolTree::VERTEX_DATA_MASK);
+				face->mVertexBuffer->drawRange(LLRender::TRIANGLES, 0, face->mVertexBuffer->getRequestedVerts()-1, face->mVertexBuffer->getRequestedIndices(), 0); 
+				gPipeline.addTrianglesDrawn(face->mVertexBuffer->getRequestedIndices());
+			}
 		}
 	}
 }
@@ -333,7 +336,7 @@ void LLDrawPoolTree::renderTree(BOOL selecting)
 			S32 stop_depth = 0;
 			F32 app_angle = treep->getAppAngle()*LLVOTree::sTreeFactor;
 			F32 alpha = 1.0;
-			S32 trunk_LOD = 0;
+			S32 trunk_LOD = LLVOTree::sMAX_NUM_TREE_LOD_LEVELS;
 
 			for (S32 j = 0; j < 4; j++)
 			{
@@ -344,6 +347,10 @@ void LLDrawPoolTree::renderTree(BOOL selecting)
 					break;
 				}
 			} 
+			if(trunk_LOD >= LLVOTree::sMAX_NUM_TREE_LOD_LEVELS)
+			{
+				continue ; //do not render.
+			}
 
 			if (app_angle < (THRESH_ANGLE_FOR_BILLBOARD - BLEND_RANGE_FOR_BILLBOARD))
 			{
diff --git a/indra/newview/llfloaterbuycurrencyhtml.cpp b/indra/newview/llfloaterbuycurrencyhtml.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..5815df36d136bac203eb52fffe862bb37dce07a3
--- /dev/null
+++ b/indra/newview/llfloaterbuycurrencyhtml.cpp
@@ -0,0 +1,119 @@
+/** 
+ * @file llfloaterbuycurrencyhtml.cpp
+ * @brief buy currency implemented in HTML floater - uses embedded media browser control
+ *
+ * $LicenseInfo:firstyear=2010&license=viewergpl$
+ * 
+ * Copyright (c) 2006-2010, Linden Research, Inc.
+ * 
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
+ * 
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
+ * 
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
+ * 
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
+ * $/LicenseInfo$
+ */
+
+#include "llviewerprecompiledheaders.h"
+
+#include "llfloaterbuycurrencyhtml.h"
+#include "llstatusbar.h"
+
+////////////////////////////////////////////////////////////////////////////////
+//
+LLFloaterBuyCurrencyHTML::LLFloaterBuyCurrencyHTML( const LLSD& key ):
+	LLFloater( key ),
+	mSpecificSumRequested( false ),
+	mMessage( "" ),
+	mSum( 0 )
+{
+}
+
+////////////////////////////////////////////////////////////////////////////////
+//
+BOOL LLFloaterBuyCurrencyHTML::postBuild()
+{
+	// observer media events
+	mBrowser = getChild<LLMediaCtrl>( "browser" );
+	mBrowser->addObserver( this );
+
+	return TRUE;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+//
+void LLFloaterBuyCurrencyHTML::navigateToFinalURL()
+{
+	// URL for actual currency buy contents is in XUI file
+	std::string buy_currency_url = getString( "buy_currency_url" );
+
+	// replace [LANGUAGE] meta-tag with view language
+	LLStringUtil::format_map_t replace;
+
+	// viewer language
+	replace[ "[LANGUAGE]" ] = LLUI::getLanguage();
+
+	// flag that specific amount requested 
+	replace[ "[SPECIFIC_AMOUNT]" ] = ( mSpecificSumRequested ? "y":"n" );
+
+	// amount requested
+	std::ostringstream codec( "" );
+	codec << mSum;
+	replace[ "[SUM]" ] = codec.str();
+
+	// users' current balance
+	codec.clear();
+	codec.str( "" );
+	codec << gStatusBar->getBalance();
+	replace[ "[BAL]" ] = codec.str();
+
+	// message - "This cost L$x,xxx for example
+	replace[ "[MSG]" ] = LLURI::escape( mMessage );
+	LLStringUtil::format( buy_currency_url, replace );
+
+	// kick off the navigation
+	mBrowser->navigateTo( buy_currency_url );
+}
+
+////////////////////////////////////////////////////////////////////////////////
+//
+void LLFloaterBuyCurrencyHTML::handleMediaEvent( LLPluginClassMedia* self, EMediaEvent event )
+{
+	// placeholder for now - just in case we want to catch media events
+	if ( LLPluginClassMediaOwner::MEDIA_EVENT_NAVIGATE_COMPLETE == event )
+	{
+	};
+}
+
+////////////////////////////////////////////////////////////////////////////////
+//
+void LLFloaterBuyCurrencyHTML::onClose( bool app_quitting )
+{
+	destroy();
+}
+
+////////////////////////////////////////////////////////////////////////////////
+//
+void LLFloaterBuyCurrencyHTML::setParams( bool specific_sum_requested, const std::string& message, S32 sum )
+{
+	// save these away - used to construct URL later
+	mSpecificSumRequested = specific_sum_requested;
+	mMessage = message;
+	mSum = sum;
+}
diff --git a/indra/newview/llfloaterbuycurrencyhtml.h b/indra/newview/llfloaterbuycurrencyhtml.h
new file mode 100644
index 0000000000000000000000000000000000000000..be7a4d3dd6bed54c49aa4554b053ae195416f9d8
--- /dev/null
+++ b/indra/newview/llfloaterbuycurrencyhtml.h
@@ -0,0 +1,65 @@
+/** 
+ * @file llfloaterbuycurrencyhtml.h
+ * @brief buy currency implemented in HTML floater - uses embedded media browser control
+ *
+ * $LicenseInfo:firstyear=2010&license=viewergpl$
+ * 
+ * Copyright (c) 2006-2010, Linden Research, Inc.
+ * 
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
+ * 
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
+ * 
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
+ * 
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
+ * $/LicenseInfo$
+ */
+
+#ifndef LL_LLFLOATERBUYCURRENCYHTML_H
+#define LL_LLFLOATERBUYCURRENCYHTML_H
+
+#include "llfloater.h"
+#include "llmediactrl.h"
+
+class LLFloaterBuyCurrencyHTML : 
+	public LLFloater, 
+	public LLViewerMediaObserver
+{
+	public:
+		LLFloaterBuyCurrencyHTML( const LLSD& key );
+
+		/*virtual*/ BOOL postBuild();
+		/*virtual*/ void onClose( bool app_quitting );
+
+		// inherited from LLViewerMediaObserver
+		/*virtual*/ void handleMediaEvent( LLPluginClassMedia* self, EMediaEvent event );
+
+		// allow our controlling parent to tell us paramters
+		void setParams( bool specific_sum_requested, const std::string& message, S32 sum );
+
+		// parse and construct URL and set browser to navigate there.
+		void navigateToFinalURL();
+
+	private:
+		LLMediaCtrl* mBrowser;
+		bool mSpecificSumRequested;
+		std::string mMessage;
+		S32 mSum;
+};
+
+#endif  // LL_LLFLOATERBUYCURRENCYHTML_H
diff --git a/indra/newview/llfloaterhud.cpp b/indra/newview/llfloaterhud.cpp
index d2ee3e44c534a57c8a275e03a1712448e11b1519..930bbe9e6bb98a6341c385766c42ece2d5c43f4c 100644
--- a/indra/newview/llfloaterhud.cpp
+++ b/indra/newview/llfloaterhud.cpp
@@ -79,9 +79,6 @@ BOOL LLFloaterHUD::postBuild()
 	mWebBrowser = getChild<LLMediaCtrl>("floater_hud_browser" );
 	if (mWebBrowser)
 	{
-		// Open links in internal browser
-		mWebBrowser->setOpenInExternalBrowser(false);
-		
 		// This is a "chrome" floater, so we don't want anything to
 		// take focus (as the user needs to be able to walk with 
 		// arrow keys during tutorial).
diff --git a/indra/newview/llfloaternotificationsconsole.cpp b/indra/newview/llfloaternotificationsconsole.cpp
index b744bff084012e3d3ab0420010b201b0ca591135..105d7f92015abd2a18c53f02c08df1468e1e8ecc 100644
--- a/indra/newview/llfloaternotificationsconsole.cpp
+++ b/indra/newview/llfloaternotificationsconsole.cpp
@@ -184,7 +184,7 @@ BOOL LLFloaterNotificationConsole::postBuild()
 	addChannel("Ignore");
 	addChannel("Visible", true);
 	// all the ones below attach to the Visible channel
-	addChannel("History");
+	addChannel("Persistent");
 	addChannel("Alerts");
 	addChannel("AlertModal");
 	addChannel("Group Notifications");
diff --git a/indra/newview/llfloateruipreview.cpp b/indra/newview/llfloateruipreview.cpp
index f61c86db1406743f537eaca02ce9a0f15425617f..1b6ef0e97a18e0365cf313392012bcc5635da037 100644
--- a/indra/newview/llfloateruipreview.cpp
+++ b/indra/newview/llfloateruipreview.cpp
@@ -266,11 +266,12 @@ class LLFadeEventTimer : public LLEventTimer
 class LLPreviewedFloater : public LLFloater
 {
 public:
-	LLPreviewedFloater(LLFloaterUIPreview* floater)
-		: LLFloater(LLSD()),
+	LLPreviewedFloater(LLFloaterUIPreview* floater, const Params& params)
+		: LLFloater(LLSD(), params),
 		  mFloaterUIPreview(floater)
 	{
 	}
+
 	virtual void draw();
 	BOOL handleRightMouseDown(S32 x, S32 y, MASK mask);
 	BOOL handleToolTip(S32 x, S32 y, MASK mask);
@@ -428,6 +429,7 @@ BOOL LLFloaterUIPreview::postBuild()
 	// Double-click opens the floater, for convenience
 	mFileList->setDoubleClickCallback(boost::bind(&LLFloaterUIPreview::onClickDisplayFloater, this, PRIMARY_FLOATER));
 
+	setDefaultBtn("display_floater");
 	// get pointers to buttons and link to callbacks
 	mLanguageSelection = main_panel_tmp->getChild<LLComboBox>("language_select_combo");
 	mLanguageSelection->setCommitCallback(boost::bind(&LLFloaterUIPreview::onLanguageComboSelect, this, mLanguageSelection));
@@ -824,7 +826,11 @@ void LLFloaterUIPreview::displayFloater(BOOL click, S32 ID, bool save)
 		return;															// ignore click (this can only happen with empty list; otherwise an item is always selected)
 	}
 
-	*floaterp = new LLPreviewedFloater(this);
+	LLFloater::Params p(LLFloater::getDefaultParams());
+	p.min_height=p.header_height;
+	p.min_width=10;
+
+	*floaterp = new LLPreviewedFloater(this, p);
 
 	if(!strncmp(path.c_str(),"floater_",8)
 		|| !strncmp(path.c_str(), "inspect_", 8))		// if it's a floater
@@ -874,6 +880,8 @@ void LLFloaterUIPreview::displayFloater(BOOL click, S32 ID, bool save)
 	}
 	else																// if it is a panel...
 	{
+		(*floaterp)->setCanResize(true);
+
 		const LLFloater::Params& floater_params = LLFloater::getDefaultParams();
 		S32 floater_header_size = floater_params.header_height;
 
diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp
index 2d27c890740ad0dd2c3dfc0498fa56a90e60526c..29865e420a23750baf61955ee75bba4fea7389e2 100644
--- a/indra/newview/llinventorybridge.cpp
+++ b/indra/newview/llinventorybridge.cpp
@@ -222,9 +222,7 @@ void LLInvFVBridge::cutToClipboard()
 // *TODO: make sure this does the right thing
 void LLInvFVBridge::showProperties()
 {
-	LLSD key;
-	key["id"] = mUUID;
-	LLSideTray::getInstance()->showPanel("sidepanel_inventory", key);
+	show_item_profile(mUUID);
 
 	// Disable old properties floater; this is replaced by the sidepanel.
 	/*
@@ -4143,21 +4141,9 @@ void LLObjectBridge::performAction(LLInventoryModel* model, std::string action)
 
 void LLObjectBridge::openItem()
 {
-	LLViewerInventoryItem* item = getItem();
-
-	if (item)
-	{
-		LLInvFVBridgeAction::doAction(item->getType(),mUUID,getInventoryModel());
-	}
-
-	LLSD key;
-	key["id"] = mUUID;
-	LLSideTray::getInstance()->showPanel("sidepanel_inventory", key);
-
-	// Disable old properties floater; this is replaced by the sidepanel.
-	/*
-	  LLFloaterReg::showInstance("properties", mUUID);
-	*/
+	// object double-click action is to wear/unwear object
+	performAction(getInventoryModel(),
+		      get_is_item_worn(mUUID) ? "detach" : "attach");
 }
 
 LLFontGL::StyleFlags LLObjectBridge::getLabelStyle() const
@@ -4434,7 +4420,7 @@ void wear_inventory_item_on_avatar( LLInventoryItem* item )
 		lldebugs << "wear_inventory_item_on_avatar( " << item->getName()
 				 << " )" << llendl;
 
-		LLAppearanceMgr::instance().addCOFItemLink(item);
+		LLAppearanceMgr::getInstance()->wearItemOnAvatar(item->getUUID(), true, false);
 	}
 }
 
@@ -4892,8 +4878,7 @@ void LLWearableBridge::onEditOnAvatar(void* user_data)
 
 void LLWearableBridge::editOnAvatar()
 {
-	LLUUID linked_id = gInventory.getLinkedItemID(mUUID);
-	const LLWearable* wearable = gAgentWearables.getWearableFromItemID(linked_id);
+	const LLWearable* wearable = gAgentWearables.getWearableFromItemID(mUUID);
 	if( wearable )
 	{
 		// Set the tab to the right wearable.
@@ -4983,7 +4968,7 @@ void LLWearableBridge::removeAllClothesFromAvatar()
 				gAgentWearables.getWearableInventoryItem((LLWearableType::EType)itype, index));
 			if (!item)
 				continue;
-			const LLUUID &item_id = gInventory.getLinkedItemID(item->getUUID());
+			const LLUUID &item_id = item->getUUID();
 			const LLWearable *wearable = gAgentWearables.getWearableFromItemID(item_id);
 			if (!wearable)
 				continue;
diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp
index 2b4d9fb25ca1eba3c430a1a2f1b722cfce224f29..c38d45f0f5fae660e6719f22d0bb0f1d5c8262de 100644
--- a/indra/newview/llinventoryfunctions.cpp
+++ b/indra/newview/llinventoryfunctions.cpp
@@ -74,6 +74,7 @@
 #include "llscrollbar.h"
 #include "llscrollcontainer.h"
 #include "llselectmgr.h"
+#include "llsidetray.h"
 #include "lltabcontainer.h"
 #include "lltooldraganddrop.h"
 #include "lluictrlfactory.h"
@@ -160,6 +161,19 @@ BOOL get_is_item_worn(const LLUUID& id)
 	return FALSE;
 }
 
+void show_item_profile(const LLUUID& item_uuid)
+{
+	LLUUID linked_uuid = gInventory.getLinkedItemID(item_uuid);
+	LLSideTray::getInstance()->showPanel("sidepanel_inventory", LLSD().with("id", linked_uuid));
+}
+
+void show_item_original(const LLUUID& item_uuid)
+{
+	LLInventoryPanel* active_panel = LLInventoryPanel::getActiveInventoryPanel();
+	if (!active_panel) return;
+	active_panel->setSelection(gInventory.getLinkedItemID(item_uuid), TAKE_FOCUS_NO);
+}
+
 ///----------------------------------------------------------------------------
 /// LLInventoryCollectFunctor implementations
 ///----------------------------------------------------------------------------
@@ -343,6 +357,21 @@ bool LLFindWearables::operator()(LLInventoryCategory* cat,
 	return FALSE;
 }
 
+bool LLFindWearablesOfType::operator()(LLInventoryCategory* cat, LLInventoryItem* item)
+{
+	if (!item) return false;
+	if (item->getType() != LLAssetType::AT_CLOTHING &&
+		item->getType() != LLAssetType::AT_BODYPART)
+	{
+		return false;
+	}
+
+	LLViewerInventoryItem *vitem = dynamic_cast<LLViewerInventoryItem*>(item);
+	if (!vitem || vitem->getWearableType() != mWearableType) return false;
+
+	return true;
+}
+
 ///----------------------------------------------------------------------------
 /// LLAssetIDMatches 
 ///----------------------------------------------------------------------------
diff --git a/indra/newview/llinventoryfunctions.h b/indra/newview/llinventoryfunctions.h
index 79b9b4a9ccf322c860abe0e45ed337f70bf0b095..8b96ba29d943bd74712464f2b3a987fafb7fa98b 100644
--- a/indra/newview/llinventoryfunctions.h
+++ b/indra/newview/llinventoryfunctions.h
@@ -46,6 +46,9 @@
 // Is this item or its baseitem is worn, attached, etc...
 BOOL get_is_item_worn(const LLUUID& id);
 
+void show_item_profile(const LLUUID& item_uuid);
+
+void show_item_original(const LLUUID& item_uuid);
 
 void change_item_parent(LLInventoryModel* model,
 									 LLViewerInventoryItem* item,
@@ -262,6 +265,17 @@ class LLFindWearables : public LLInventoryCollectFunctor
 							LLInventoryItem* item);
 };
 
+//Inventory collect functor collecting wearables of a specific wearable type
+class LLFindWearablesOfType : public LLInventoryCollectFunctor
+{
+public:
+	LLFindWearablesOfType(LLWearableType::EType type) : mWearableType(type) {}
+	virtual ~LLFindWearablesOfType() {}
+	virtual bool operator()(LLInventoryCategory* cat, LLInventoryItem* item);
+
+	const LLWearableType::EType mWearableType;
+};
+
 /**                    Inventory Collector Functions
  **                                                                            **
  *******************************************************************************/
diff --git a/indra/newview/llinventorymodel.cpp b/indra/newview/llinventorymodel.cpp
index a527694d259eb9bca18ac9aa282344bd11ec69cd..2e1c5238d3645de5c922f1516f832c4f7413d481 100644
--- a/indra/newview/llinventorymodel.cpp
+++ b/indra/newview/llinventorymodel.cpp
@@ -566,6 +566,11 @@ const LLUUID& LLInventoryModel::getLinkedItemID(const LLUUID& object_id) const
 	return item->getLinkedUUID();
 }
 
+LLViewerInventoryItem* LLInventoryModel::getLinkedItem(const LLUUID& object_id) const
+{
+	return object_id.notNull() ? getItem(getLinkedItemID(object_id)) : NULL;
+}
+
 LLInventoryModel::item_array_t LLInventoryModel::collectLinkedItems(const LLUUID& id,
 																	const LLUUID& start_folder_id)
 {
@@ -1244,7 +1249,11 @@ void LLInventoryModel::addCategory(LLViewerInventoryCategory* category)
 
 void LLInventoryModel::addItem(LLViewerInventoryItem* item)
 {
-	//llinfos << "LLInventoryModel::addItem()" << llendl;
+	/*
+	const LLViewerInventoryCategory* cat = gInventory.getCategory(item->getParentUUID()); // Seraph remove for 2.1
+	const std::string cat_name = cat ? cat->getName() : "CAT NOT FOUND"; // Seraph remove for 2.1
+	llinfos << "Added item [ name:" << item->getName() << " UUID:" << item->getUUID() << " type:" << item->getActualType() << " ] to folder [ name:" << cat_name << " uuid:" << item->getParentUUID() << " ]" << llendl; // Seraph remove for 2.1
+	*/
 
 	llassert(item);
 	if(item)
diff --git a/indra/newview/llinventorymodel.h b/indra/newview/llinventorymodel.h
index 1f7bd50328acf080c67cd6108e85c33ffc7e4a5c..7b56d0bdd11bee5a5d68214336049ec4f6fad98c 100644
--- a/indra/newview/llinventorymodel.h
+++ b/indra/newview/llinventorymodel.h
@@ -258,6 +258,7 @@ class LLInventoryModel
 
 	// Get the inventoryID or item that this item points to, else just return object_id
 	const LLUUID& getLinkedItemID(const LLUUID& object_id) const;
+	LLViewerInventoryItem* getLinkedItem(const LLUUID& object_id) const;
 private:
 	mutable LLPointer<LLViewerInventoryItem> mLastItem; // cache recent lookups	
 
diff --git a/indra/newview/lllistcontextmenu.cpp b/indra/newview/lllistcontextmenu.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..50e969f6bc61408fdab34113ef7e224a23f47ddd
--- /dev/null
+++ b/indra/newview/lllistcontextmenu.cpp
@@ -0,0 +1,125 @@
+/** 
+ * @file lllistcontextmenu.cpp
+ * @brief Base class of misc lists' context menus
+ *
+ * $LicenseInfo:firstyear=2010&license=viewergpl$
+ * 
+ * Copyright (c) 2010, Linden Research, Inc.
+ * 
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
+ * 
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
+ * 
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
+ * 
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
+ * $/LicenseInfo$
+ */
+
+
+#include "llviewerprecompiledheaders.h"
+
+#include "lllistcontextmenu.h"
+
+// libs
+#include "llmenugl.h" // for LLContextMenu
+
+// newview
+#include "llviewermenu.h" // for LLViewerMenuHolderGL
+
+LLListContextMenu::LLListContextMenu()
+:	mMenu(NULL)
+{
+}
+
+LLListContextMenu::~LLListContextMenu()
+{
+	// do not forget delete LLContextMenu* mMenu.
+	// It can have registered Enable callbacks which are called from the LLMenuHolderGL::draw()
+	// via selected item (menu_item_call) by calling LLMenuItemCallGL::buildDrawLabel.
+	// we can have a crash via using callbacks of deleted instance of ContextMenu. EXT-4725
+
+	// menu holder deletes its menus on viewer exit, so we have no way to determine if instance
+	// of mMenu has already been deleted except of using LLHandle. EXT-4762.
+	if (!mMenuHandle.isDead())
+	{
+		mMenu->die();
+		mMenu = NULL;
+	}
+}
+
+void LLListContextMenu::show(LLView* spawning_view, const uuid_vec_t& uuids, S32 x, S32 y)
+{
+	if (mMenu)
+	{
+		//preventing parent (menu holder) from deleting already "dead" context menus on exit
+		LLView* parent = mMenu->getParent();
+		if (parent)
+		{
+			parent->removeChild(mMenu);
+		}
+		delete mMenu;
+		mMenu = NULL;
+		mUUIDs.clear();
+	}
+
+	if ( uuids.empty() )
+	{
+		return;
+	}
+
+	mUUIDs.resize(uuids.size());
+	std::copy(uuids.begin(), uuids.end(), mUUIDs.begin());
+
+	mMenu = createMenu();
+	if (!mMenu)
+	{
+		llwarns << "Context menu creation failed" << llendl;
+		return;
+	}
+
+	mMenuHandle = mMenu->getHandle();
+	mMenu->show(x, y);
+	LLMenuGL::showPopup(spawning_view, mMenu, x, y);
+}
+
+void LLListContextMenu::hide()
+{
+	if(mMenu)
+	{
+		mMenu->hide();
+	}
+}
+
+// static
+void LLListContextMenu::handleMultiple(functor_t functor, const uuid_vec_t& ids)
+{
+	uuid_vec_t::const_iterator it;
+	for (it = ids.begin(); it != ids.end(); ++it)
+	{
+		functor(*it);
+	}
+}
+
+// static
+LLContextMenu* LLListContextMenu::createFromFile(const std::string& filename)
+{
+	return LLUICtrlFactory::getInstance()->createFromFile<LLContextMenu>(
+		filename, LLContextMenu::sMenuContainer, LLViewerMenuHolderGL::child_registry_t::instance());
+}
+
+// EOF
diff --git a/indra/newview/lllistcontextmenu.h b/indra/newview/lllistcontextmenu.h
new file mode 100644
index 0000000000000000000000000000000000000000..09540a833fd79c7e41c06a525b32d978004adba0
--- /dev/null
+++ b/indra/newview/lllistcontextmenu.h
@@ -0,0 +1,84 @@
+/** 
+ * @file lllistcontextmenu.h
+ * @brief Base class of misc lists' context menus
+ *
+ * $LicenseInfo:firstyear=2010&license=viewergpl$
+ * 
+ * Copyright (c) 2010, Linden Research, Inc.
+ * 
+ * Second Life Viewer Source Code
+ * The source code in this file ("Source Code") is provided by Linden Lab
+ * to you under the terms of the GNU General Public License, version 2.0
+ * ("GPL"), unless you have obtained a separate licensing agreement
+ * ("Other License"), formally executed by you and Linden Lab.  Terms of
+ * the GPL can be found in doc/GPL-license.txt in this distribution, or
+ * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
+ * 
+ * There are special exceptions to the terms and conditions of the GPL as
+ * it is applied to this Source Code. View the full text of the exception
+ * in the file doc/FLOSS-exception.txt in this software distribution, or
+ * online at
+ * http://secondlifegrid.net/programs/open_source/licensing/flossexception
+ * 
+ * By copying, modifying or distributing this software, you acknowledge
+ * that you have read and understood your obligations described above,
+ * and agree to abide by those obligations.
+ * 
+ * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+ * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+ * COMPLETENESS OR PERFORMANCE.
+ * $/LicenseInfo$
+ */
+
+#ifndef LL_LLLISTCONTEXTMENU_H
+#define LL_LLLISTCONTEXTMENU_H
+
+#include "llhandle.h"
+#include "lluuid.h"
+#include "llview.h"
+
+class LLView;
+class LLContextMenu;
+
+/**
+ * Context menu for single or multiple list items.
+ * 
+ * Derived classes must implement contextMenu().
+ * 
+ * Typical usage:
+ * <code>
+ * my_context_menu->show(parent_view, selected_list_items_ids, x, y);
+ * </code>
+ */
+class LLListContextMenu
+{
+public:
+	LLListContextMenu();
+	virtual ~LLListContextMenu();
+
+	/**
+	 * Show the menu at specified coordinates.
+	 *
+	 * @param spawning_view View to spawn at.
+	 * @param uuids An array of list items ids.
+	 * @param x Horizontal coordinate in the spawn_view's coordinate frame.
+	 * @param y Vertical coordinate in the spawn_view's coordinate frame.
+	 */
+	virtual void show(LLView* spawning_view, const uuid_vec_t& uuids, S32 x, S32 y);
+
+	virtual void hide();
+
+protected:
+	typedef boost::function<void (const LLUUID& id)> functor_t;
+
+	virtual LLContextMenu* createMenu() = 0;
+
+	static LLContextMenu* createFromFile(const std::string& filename);
+	static void handleMultiple(functor_t functor, const uuid_vec_t& ids);
+
+	uuid_vec_t			mUUIDs;
+	LLContextMenu*		mMenu;
+	LLHandle<LLView>	mMenuHandle;
+};
+
+#endif // LL_LLLISTCONTEXTMENU_H
diff --git a/indra/newview/llmediactrl.cpp b/indra/newview/llmediactrl.cpp
index 05cb6ddc4a5f70dcbcae8bfd4cfa9db44f7570ad..7a4ed74c4c7f007dac0c76cb89e7d9776f36b9bf 100644
--- a/indra/newview/llmediactrl.cpp
+++ b/indra/newview/llmediactrl.cpp
@@ -78,8 +78,6 @@ LLMediaCtrl::LLMediaCtrl( const Params& p) :
 	mBorder(NULL),
 	mFrequentUpdates( true ),
 	mForceUpdate( false ),
-	mOpenLinksInExternalBrowser( false ),
-	mOpenLinksInInternalBrowser( false ),
 	mHomePageUrl( "" ),
 	mTrusted(false),
 	mIgnoreUIScale( true ),
@@ -166,20 +164,6 @@ void LLMediaCtrl::setTakeFocusOnClick( bool take_focus )
 	mTakeFocusOnClick = take_focus;
 }
 
-////////////////////////////////////////////////////////////////////////////////
-// set flag that forces the embedded browser to open links in the external system browser
-void LLMediaCtrl::setOpenInExternalBrowser( bool valIn )
-{
-	mOpenLinksInExternalBrowser = valIn;
-};
-
-////////////////////////////////////////////////////////////////////////////////
-// set flag that forces the embedded browser to open links in the internal browser floater
-void LLMediaCtrl::setOpenInInternalBrowser( bool valIn )
-{
-	mOpenLinksInInternalBrowser = valIn;
-};
-
 ////////////////////////////////////////////////////////////////////////////////
 void LLMediaCtrl::setTrusted( bool valIn )
 {
@@ -944,7 +928,6 @@ void LLMediaCtrl::handleMediaEvent(LLPluginClassMedia* self, EMediaEvent event)
 		case MEDIA_EVENT_CLICK_LINK_HREF:
 		{
 			LL_DEBUGS("Media") <<  "Media event:  MEDIA_EVENT_CLICK_LINK_HREF, target is \"" << self->getClickTarget() << "\", uri is " << self->getClickURL() << LL_ENDL;
-			onClickLinkHref(self);
 		};
 		break;
 		
@@ -977,95 +960,6 @@ void LLMediaCtrl::handleMediaEvent(LLPluginClassMedia* self, EMediaEvent event)
 	emitEvent(self, event);
 }
 
-////////////////////////////////////////////////////////////////////////////////
-// 
-void LLMediaCtrl::onClickLinkHref( LLPluginClassMedia* self )
-{
-	// retrieve the event parameters
-	std::string url = self->getClickURL();
-	U32 target_type = self->getClickTargetType();
-	
-	// is there is a target specified for the link?
-	if (target_type == LLPluginClassMedia::TARGET_EXTERNAL ||
-		target_type == LLPluginClassMedia::TARGET_BLANK )
-	{
-		if (gSavedSettings.getBOOL("UseExternalBrowser"))
-		{
-			LLSD payload;
-			payload["url"] = url;
-			payload["target_type"] = LLSD::Integer(target_type);
-			LLNotificationsUtil::add( "WebLaunchExternalTarget", LLSD(), payload, onClickLinkExternalTarget);
-		}
-		else
-		{
-			clickLinkWithTarget(url, target_type);
-		}
-	}
-	else {
-		const std::string protocol1( "http://" );
-		const std::string protocol2( "https://" );
-		if( mOpenLinksInExternalBrowser )
-		{
-			if ( !url.empty() )
-			{
-				if ( LLStringUtil::compareInsensitive( url.substr( 0, protocol1.length() ), protocol1 ) == 0 ||
-					LLStringUtil::compareInsensitive( url.substr( 0, protocol2.length() ), protocol2 ) == 0 )
-				{
-					LLWeb::loadURLExternal( url );
-				}
-			}
-		}
-		else
-		if( mOpenLinksInInternalBrowser )
-		{
-			if ( !url.empty() )
-			{
-				if ( LLStringUtil::compareInsensitive( url.substr( 0, protocol1.length() ), protocol1 ) == 0 ||
-					LLStringUtil::compareInsensitive( url.substr( 0, protocol2.length() ), protocol2 ) == 0 )
-				{
-					llwarns << "Dead, unimplemented path that we used to send to the built-in browser long ago." << llendl;
-				}
-			}
-		}
-	}
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// static 
-bool LLMediaCtrl::onClickLinkExternalTarget(const LLSD& notification, const LLSD& response )
-{
-	S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
-	if ( 0 == option )
-	{
-		LLSD payload = notification["payload"];
-		std::string url = payload["url"].asString();
-		S32 target_type = payload["target_type"].asInteger();
-		clickLinkWithTarget(url, target_type);
-	}
-	return false;
-}
-
-
-////////////////////////////////////////////////////////////////////////////////
-// static 
-void LLMediaCtrl::clickLinkWithTarget(const std::string& url, const S32& target_type )
-{
-	if (target_type == LLPluginClassMedia::TARGET_EXTERNAL)
-	{
-		// load target in an external browser
-		LLWeb::loadURLExternal(url);
-	}
-	else if (target_type == LLPluginClassMedia::TARGET_BLANK)
-	{
-		// load target in the user's preferred browser
-		LLWeb::loadURL(url);
-	}
-	else {
-		// unsupported link target - shouldn't happen
-		LL_WARNS("LinkTarget") << "Unsupported link target type" << LL_ENDL;
-	}
-}
-
 ////////////////////////////////////////////////////////////////////////////////
 // 
 std::string LLMediaCtrl::getCurrentNavUrl()
diff --git a/indra/newview/llmediactrl.h b/indra/newview/llmediactrl.h
index e55d2f7cd0a4080c088ed4ca0fafa05c546333ec..310492fe02520a24ddc0d505034ce1ddb1978033 100644
--- a/indra/newview/llmediactrl.h
+++ b/indra/newview/llmediactrl.h
@@ -99,8 +99,6 @@ class LLMediaCtrl :
 		void navigateToLocalPage( const std::string& subdir, const std::string& filename_in );
 		bool canNavigateBack();
 		bool canNavigateForward();
-		void setOpenInExternalBrowser( bool valIn );
-		void setOpenInInternalBrowser( bool valIn );
 		std::string getCurrentNavUrl();
 
 		// By default, we do not handle "secondlife:///app/" SLURLs, because
@@ -162,24 +160,17 @@ class LLMediaCtrl :
 		// Incoming media event dispatcher
 		virtual void handleMediaEvent(LLPluginClassMedia* self, EMediaEvent event);
 
-		// handlers for individual events (could be done inside the switch in handleMediaEvent, they're just individual functions for clarity)
-		void onClickLinkHref( LLPluginClassMedia* self );
-		
 	protected:
 		void convertInputCoords(S32& x, S32& y);
 
 	private:
 		void onVisibilityChange ( const LLSD& new_visibility );
-		static bool onClickLinkExternalTarget( const LLSD&, const LLSD& );
-		static void clickLinkWithTarget(const std::string& url, const S32& target_type );
 
 		const S32 mTextureDepthBytes;
 		LLUUID mMediaTextureID;
 		LLViewBorder* mBorder;
 		bool mFrequentUpdates;
 		bool mForceUpdate;
-		bool mOpenLinksInExternalBrowser;
-		bool mOpenLinksInInternalBrowser;
 		bool mTrusted;
 		std::string mHomePageUrl;
 		std::string mCurrentNavUrl;
diff --git a/indra/newview/llmorphview.cpp b/indra/newview/llmorphview.cpp
index d670eb6ffd61b6bba2111e7dac74381453caecfe..27a27fb65a192cb4b4a883d55f79f2c0f6e4eb0e 100644
--- a/indra/newview/llmorphview.cpp
+++ b/indra/newview/llmorphview.cpp
@@ -131,14 +131,7 @@ void LLMorphView::setVisible(BOOL visible)
 
 		if (visible)
 		{
-			llassert( !gFloaterCustomize );
-			gFloaterCustomize = new LLFloaterCustomize();
-			gFloaterCustomize->fetchInventory();
-			gFloaterCustomize->openFloater();
-
-			// Must do this _after_ gFloaterView is initialized.
-			gFloaterCustomize->switchToDefaultSubpart();
-
+			// TODO: verify some user action has already opened outfit editor? - Nyx
 			initialize();
 
 			// First run dialog
@@ -146,13 +139,7 @@ void LLMorphView::setVisible(BOOL visible)
 		}
 		else
 		{
-			if( gFloaterCustomize )
-			{
-				gFloaterView->removeChild( gFloaterCustomize );
-				delete gFloaterCustomize;
-				gFloaterCustomize = NULL;
-			}
-
+			// TODO: verify some user action has already closed outfit editor ? - Nyx
 			shutdown();
 		}
 	}
diff --git a/indra/newview/lloutfitslist.cpp b/indra/newview/lloutfitslist.cpp
index 7ebbddca25b99255a8b2fc2f09ca6992e63df280..17a2db7a43353db1f1a81d99fc8b6eb45adc19cf 100644
--- a/indra/newview/lloutfitslist.cpp
+++ b/indra/newview/lloutfitslist.cpp
@@ -38,11 +38,44 @@
 
 #include "llaccordionctrl.h"
 #include "llaccordionctrltab.h"
+#include "llagentwearables.h"
 #include "llappearancemgr.h"
 #include "llinventoryfunctions.h"
 #include "llinventorymodel.h"
+#include "lllistcontextmenu.h"
+#include "lltransutil.h"
+#include "llviewermenu.h"
+#include "llvoavatar.h"
+#include "llvoavatarself.h"
 #include "llwearableitemslist.h"
 
+//////////////////////////////////////////////////////////////////////////
+
+class OutfitContextMenu : public LLListContextMenu
+{
+protected:
+	/* virtual */ LLContextMenu* createMenu()
+	{
+		LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar;
+		LLUICtrl::EnableCallbackRegistry::ScopedRegistrar enable_registrar;
+		LLUUID selected_id = mUUIDs.front();
+
+		registrar.add("Outfit.WearReplace",
+			boost::bind(&LLAppearanceMgr::replaceCurrentOutfit, &LLAppearanceMgr::instance(), selected_id));
+		registrar.add("Outfit.WearAdd",
+			boost::bind(&LLAppearanceMgr::addCategoryToCurrentOutfit, &LLAppearanceMgr::instance(), selected_id));
+		registrar.add("Outfit.TakeOff",
+				boost::bind(&LLAppearanceMgr::takeOffOutfit, &LLAppearanceMgr::instance(), selected_id));
+		// *TODO: implement this
+		// registrar.add("Outfit.Rename", boost::bind());
+		// registrar.add("Outfit.Delete", boost::bind());
+
+		return createFromFile("menu_outfit_tab.xml");
+	}
+};
+
+//////////////////////////////////////////////////////////////////////////
+
 static LLRegisterPanelClassWrapper<LLOutfitsList> t_outfits_list("outfits_list");
 
 LLOutfitsList::LLOutfitsList()
@@ -55,10 +88,14 @@ LLOutfitsList::LLOutfitsList()
 	gInventory.addObserver(mCategoriesObserver);
 
 	gInventory.addObserver(this);
+
+	mOutfitMenu = new OutfitContextMenu();
 }
 
 LLOutfitsList::~LLOutfitsList()
 {
+	delete mOutfitMenu;
+
 	if (gInventory.containsObserver(mCategoriesObserver))
 	{
 		gInventory.removeObserver(mCategoriesObserver);
@@ -140,6 +177,8 @@ void LLOutfitsList::refreshList(const LLUUID& category_id)
 
 		static LLXMLNodePtr accordionXmlNode = getAccordionTabXMLNode();
 		LLAccordionCtrlTab* tab = LLUICtrlFactory::defaultBuilder<LLAccordionCtrlTab>(accordionXmlNode, NULL, NULL);
+		tab->setRightMouseDownCallback(boost::bind(&LLOutfitsList::onAccordionTabRightClick, this,
+			_1, _2, _3, cat_id));
 
 		tab->setName(name);
 		tab->setTitle(name);
@@ -447,4 +486,19 @@ void LLOutfitsList::applyFilter(const std::string& new_filter_substring)
 	}
 }
 
+void LLOutfitsList::onAccordionTabRightClick(LLUICtrl* ctrl, S32 x, S32 y, const LLUUID& cat_id)
+{
+	LLAccordionCtrlTab* tab = dynamic_cast<LLAccordionCtrlTab*>(ctrl);
+	if(mOutfitMenu && tab && tab->getHeaderVisible() && cat_id.notNull())
+	{
+		S32 header_bottom = tab->getLocalRect().getHeight() - tab->getHeaderHeight();
+		if(y >= header_bottom)
+		{
+			uuid_vec_t selected_uuids;
+			selected_uuids.push_back(cat_id);
+			mOutfitMenu->show(ctrl, selected_uuids, x, y);
+		}
+	}
+}
+
 // EOF
diff --git a/indra/newview/lloutfitslist.h b/indra/newview/lloutfitslist.h
index 8eaa39e6f1f96693f567b996517099b45198fd1c..b6b3d6ae468dc93402d4b36c743d693fe65a85df 100644
--- a/indra/newview/lloutfitslist.h
+++ b/indra/newview/lloutfitslist.h
@@ -41,6 +41,7 @@
 class LLAccordionCtrl;
 class LLAccordionCtrlTab;
 class LLWearableItemsList;
+class LLListContextMenu;
 
 /**
  * @class LLOutfitsList
@@ -105,6 +106,8 @@ class LLOutfitsList : public LLPanel, public LLInventoryObserver
 	 */
 	void applyFilter(const std::string& new_filter_substring);
 
+	void onAccordionTabRightClick(LLUICtrl* ctrl, S32 x, S32 y, const LLUUID& cat_id);
+
 	LLInventoryCategoriesObserver* 	mCategoriesObserver;
 
 	LLAccordionCtrl*				mAccordion;
@@ -118,6 +121,8 @@ class LLOutfitsList : public LLPanel, public LLInventoryObserver
 	typedef	std::map<LLUUID, LLAccordionCtrlTab*>		outfits_map_t;
 	typedef outfits_map_t::value_type					outfits_map_value_t;
 	outfits_map_t					mOutfitsMap;
+
+	LLListContextMenu*			mOutfitMenu;
 };
 
 #endif //LL_LLOUTFITSLIST_H
diff --git a/indra/newview/llpaneleditwearable.cpp b/indra/newview/llpaneleditwearable.cpp
index f8dbc91036141b49200b0b3ddf7c0a177c1aba52..8e9b164c09e36a0faca70b17cbfb6a50767af9f0 100644
--- a/indra/newview/llpaneleditwearable.cpp
+++ b/indra/newview/llpaneleditwearable.cpp
@@ -57,6 +57,8 @@
 #include "lltextureentry.h"
 #include "llviewercontrol.h"	// gSavedSettings
 #include "llviewertexturelist.h"
+#include "llagentcamera.h"
+#include "llmorphview.h"
 
 // register panel with appropriate XML
 static LLRegisterPanelClassWrapper<LLPanelEditWearable> t_edit_wearable("panel_edit_wearable");
@@ -951,6 +953,9 @@ void LLPanelEditWearable::initializePanel()
 		// what edit group do we want to extract params for?
 		const std::string edit_group = subpart_entry->mEditGroup;
 
+		// initialize callback to ensure camera view changes appropriately.
+		tab->setDropDownStateChangedCallback(boost::bind(&LLPanelEditWearable::onTabExpandedCollapsed,this,_2,index));
+
 		// storage for ordered list of visual params
 		value_map_t sorted_params;
 		getSortedParams(sorted_params, edit_group);
@@ -989,6 +994,52 @@ void LLPanelEditWearable::updateTypeSpecificControls(LLWearableType::EType type)
 	}
 }
 
+void LLPanelEditWearable::onTabExpandedCollapsed(const LLSD& param, U8 index)
+{
+	bool expanded = param.asBoolean();
+
+	if (!mWearablePtr || !gAgentCamera.cameraCustomizeAvatar())
+	{
+		// we don't have a valid wearable we're editing, or we've left the wearable editor
+		return;
+	}
+
+	if (expanded)
+	{
+		const LLEditWearableDictionary::WearableEntry *wearable_entry = LLEditWearableDictionary::getInstance()->getWearable(mWearablePtr->getType());
+		if (!wearable_entry)
+		{
+			llinfos << "could not get wearable dictionary entry for wearable type: " << mWearablePtr->getType() << llendl;
+			return;
+		}
+
+		if (index >= wearable_entry->mSubparts.size())
+		{
+			llinfos << "accordion tab expanded for invalid subpart. Wearable type: " << mWearablePtr->getType() << " subpart num: " << index << llendl;
+			return;
+		}
+
+		ESubpart subpart_e = wearable_entry->mSubparts[index];
+		const LLEditWearableDictionary::SubpartEntry *subpart_entry = LLEditWearableDictionary::getInstance()->getSubpart(subpart_e);
+
+		if (!subpart_entry)
+		{
+			llwarns << "could not get wearable subpart dictionary entry for subpart: " << subpart_e << llendl;
+			return;
+		}
+
+		// Update the camera
+		gMorphView->setCameraTargetJoint( gAgentAvatarp->getJoint( subpart_entry->mTargetJoint ) );
+		gMorphView->setCameraTargetOffset( subpart_entry->mTargetOffset );
+		gMorphView->setCameraOffset( subpart_entry->mCameraOffset );
+		gMorphView->setCameraDistToDefault();
+		if (gSavedSettings.getBOOL("AppearanceCameraMovement"))
+		{
+			gMorphView->updateCamera();
+		}
+	}
+}
+
 void LLPanelEditWearable::updateScrollingPanelUI()
 {
 	// do nothing if we don't have a valid wearable we're editing
diff --git a/indra/newview/llpaneleditwearable.h b/indra/newview/llpaneleditwearable.h
index 04839ca4514c618785045bc7fc210557e9423c31..6f9ac82407b95f79ef98e4d9b1c5d9a7b1eb27a8 100644
--- a/indra/newview/llpaneleditwearable.h
+++ b/indra/newview/llpaneleditwearable.h
@@ -66,6 +66,8 @@ class LLPanelEditWearable : public LLPanel
 	static void			onRevertButtonClicked(void* userdata);
 	void				onCommitSexChange();
 
+	void				onTabExpandedCollapsed(const LLSD& param, U8 index);
+
 private:
 	typedef std::map<F32, LLViewerVisualParam*> value_map_t;
 
diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp
index 508a58e74f9acfb2a24df39c1f74e132754e7e02..0009f7203aa08b7d7fdff411bda05e5a76e02634 100644
--- a/indra/newview/llpanellogin.cpp
+++ b/indra/newview/llpanellogin.cpp
@@ -270,20 +270,7 @@ LLPanelLogin::LLPanelLogin(const LLRect &rect,
 	web_browser->setTabStop(FALSE);
 	// web_browser->navigateToLocalPage( "loading", "loading.html" );
 
-	if (gSavedSettings.getBOOL("RegInClient"))
-	{
-		// need to follow links in the internal browser
-		web_browser->setOpenInExternalBrowser( false );
-
-		getChild<LLView>("login_widgets")->setVisible(false);
-	}
-	else
-	{
-		// make links open in external browser
-		web_browser->setOpenInExternalBrowser( true );
-
-		reshapeBrowser();
-	}
+	reshapeBrowser();
 
 	// kick off a request to grab the url manually
 	gResponsePtr = LLIamHereLogin::build( this );
@@ -487,7 +474,6 @@ void LLPanelLogin::showLoginWidgets()
 {
 	sInstance->childSetVisible("login_widgets", true);
 	LLMediaCtrl* web_browser = sInstance->getChild<LLMediaCtrl>("login_html");
-	web_browser->setOpenInExternalBrowser( true );
 	sInstance->reshapeBrowser();
 	// *TODO: Append all the usual login parameters, like first_login=Y etc.
 	std::string splash_screen_url = sInstance->getString("real_url");
diff --git a/indra/newview/llpanelmaininventory.cpp b/indra/newview/llpanelmaininventory.cpp
index 5ff51b81657720f293b16baf4fa0b3b24be852de..54d1b46016397b3a06fba87e41501a94419b1a7c 100644
--- a/indra/newview/llpanelmaininventory.cpp
+++ b/indra/newview/llpanelmaininventory.cpp
@@ -1187,7 +1187,7 @@ void LLPanelMainInventory::setUploadCostIfNeeded()
 		LLMenuItemBranchGL* upload_menu = mMenuAdd->findChild<LLMenuItemBranchGL>("upload");
 		if(upload_menu)
 		{
-			S32 upload_cost = -1;//LLGlobalEconomy::Singleton::getInstance()->getPriceUpload();
+			S32 upload_cost = LLGlobalEconomy::Singleton::getInstance()->getPriceUpload();
 			std::string cost_str;
 
 			// getPriceUpload() returns -1 if no data available yet.
diff --git a/indra/newview/llpanelobjectinventory.cpp b/indra/newview/llpanelobjectinventory.cpp
index de16f9d343d063abbd5d8c685e46f1f7203bf289..0d3beaa9a5808fab325913437f20400468ff93a0 100644
--- a/indra/newview/llpanelobjectinventory.cpp
+++ b/indra/newview/llpanelobjectinventory.cpp
@@ -48,7 +48,7 @@
 #include "llagent.h"
 #include "llavataractions.h"
 #include "llcallbacklist.h"
-#include "llfloaterbuycurrency.h"
+#include "llbuycurrencyhtml.h"
 #include "llfloaterreg.h"
 #include "llinventorybridge.h"
 #include "llinventorydefines.h"
@@ -174,11 +174,7 @@ LLInventoryItem* LLTaskInvFVBridge::findItem() const
 
 void LLTaskInvFVBridge::showProperties()
 {
-	LLSD key;
-	key["object"] = mPanel->getTaskUUID();
-	key["id"] = mUUID;
-	LLSideTray::getInstance()->showPanel("sidepanel_inventory", key);
-
+	show_item_profile(mUUID);
 
 	// Disable old properties floater; this is replaced by the sidepanel.
 	/*
@@ -616,7 +612,7 @@ void LLTaskInvFVBridge::performAction(LLInventoryModel* model, std::string actio
 			{
 				LLStringUtil::format_map_t args;
 				args["AMOUNT"] = llformat("%d", price);
-				LLFloaterBuyCurrency::buyCurrency(LLTrans::getString("this_costs", args), price);
+				LLBuyCurrencyHTML::openCurrencyFloater( LLTrans::getString("this_costs", args), price );
 			}
 			else
 			{
diff --git a/indra/newview/llpaneloutfitedit.cpp b/indra/newview/llpaneloutfitedit.cpp
index ceb720908a4abbf5ccaab88533ee1ed67b096849..ae4b288588e297d135f9f6849b8e350b1d411366 100644
--- a/indra/newview/llpaneloutfitedit.cpp
+++ b/indra/newview/llpaneloutfitedit.cpp
@@ -212,6 +212,7 @@ LLPanelOutfitEdit::LLPanelOutfitEdit()
 	mCOFWearables(NULL),
 	mInventoryItemsPanel(NULL),
 	mCOFObserver(NULL),
+	mGearMenu(NULL),
 	mCOFDragAndDropObserver(NULL),
 	mInitialized(false)
 {
@@ -254,6 +255,8 @@ BOOL LLPanelOutfitEdit::postBuild()
 	childSetCommitCallback("filter_button", boost::bind(&LLPanelOutfitEdit::showWearablesFilter, this), NULL);
 	childSetCommitCallback("folder_view_btn", boost::bind(&LLPanelOutfitEdit::showFilteredFolderWearablesPanel, this), NULL);
 	childSetCommitCallback("list_view_btn", boost::bind(&LLPanelOutfitEdit::showFilteredWearablesPanel, this), NULL);
+	childSetCommitCallback("gear_menu_btn", boost::bind(&LLPanelOutfitEdit::onGearButtonClick, this, _1), NULL);
+	childSetCommitCallback("wearables_gear_menu_btn", boost::bind(&LLPanelOutfitEdit::onGearButtonClick, this, _1), NULL);
 
 	mCOFWearables = getChild<LLCOFWearables>("cof_wearables_list");
 	mCOFWearables->setCommitCallback(boost::bind(&LLPanelOutfitEdit::onOutfitItemSelectionChange, this));
@@ -692,4 +695,31 @@ bool LLPanelOutfitEdit::switchPanels(LLPanel* switch_from_panel, LLPanel* switch
 	return false;
 }
 
+void LLPanelOutfitEdit::onGearButtonClick(LLUICtrl* clicked_button)
+{
+	if(!mGearMenu)
+	{
+		LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar;
+
+		registrar.add("Gear.OnClick", boost::bind(&LLPanelOutfitEdit::onGearMenuItemClick, this, _2));
+
+		mGearMenu = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>(
+			"menu_cof_gear.xml", LLMenuGL::sMenuContainer, LLViewerMenuHolderGL::child_registry_t::instance());
+		mGearMenu->buildDrawLabels();
+		mGearMenu->updateParent(LLMenuGL::sMenuContainer);
+	}
+
+	S32 menu_y = mGearMenu->getRect().getHeight() + clicked_button->getRect().getHeight();
+	LLMenuGL::showPopup(clicked_button, mGearMenu, 0, menu_y);
+}
+
+void LLPanelOutfitEdit::onGearMenuItemClick(const LLSD& data)
+{
+	std::string param = data.asString();
+	if("add" == param)
+	{
+		// TODO
+	}
+}
+
 // EOF
diff --git a/indra/newview/llpaneloutfitedit.h b/indra/newview/llpaneloutfitedit.h
index 5ebe1e0406e6f11fe9f5c18ea1db5044cf4694ac..1bf69c5606467886d36491eab5390baebe8771cf 100644
--- a/indra/newview/llpaneloutfitedit.h
+++ b/indra/newview/llpaneloutfitedit.h
@@ -58,6 +58,7 @@ class LLScrollListCtrl;
 class LLToggleableMenu;
 class LLFilterEditor;
 class LLFilteredWearableListManager;
+class LLMenuGL;
 
 class LLPanelOutfitEdit : public LLPanel
 {
@@ -126,6 +127,8 @@ class LLPanelOutfitEdit : public LLPanel
 
 private:
 
+	void onGearButtonClick(LLUICtrl* clicked_button);
+	void onGearMenuItemClick(const LLSD& data);
 
 
 	LLTextBox*			mCurrentOutfitName;
@@ -149,6 +152,7 @@ class LLPanelOutfitEdit : public LLPanel
 	std::vector<LLLookItemType> mLookItemTypes;
 
 	LLCOFWearables*		mCOFWearables;
+	LLMenuGL*			mGearMenu;
 	bool				mInitialized;
 };
 
diff --git a/indra/newview/llpaneloutfitsinventory.cpp b/indra/newview/llpaneloutfitsinventory.cpp
index 0760c57f8eecee98b8a58e7af53e8fb4099af895..a7e8f497d90bf49dbb35562e18638347aebfdde6 100644
--- a/indra/newview/llpaneloutfitsinventory.cpp
+++ b/indra/newview/llpaneloutfitsinventory.cpp
@@ -383,11 +383,8 @@ void LLPanelOutfitsInventory::initListCommandsHandlers()
 				   ,       _7 // EAcceptance* accept
 				   ));
 
-	mCommitCallbackRegistrar.add("panel_outfits_inventory_gear_default.Custom.Action",
-								 boost::bind(&LLPanelOutfitsInventory::onCustomAction, this, _2));
-	mEnableCallbackRegistrar.add("panel_outfits_inventory_gear_default.Enable",
-								 boost::bind(&LLPanelOutfitsInventory::isActionEnabled, this, _2));
-	mMenuGearDefault = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>("panel_outfits_inventory_gear_default.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
+	mMenuGearDefault = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>("menu_outfit_gear.xml",
+		gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
 }
 
 void LLPanelOutfitsInventory::updateListCommands()
diff --git a/indra/newview/llpanelpeoplemenus.cpp b/indra/newview/llpanelpeoplemenus.cpp
index 862e32cca86b1c6f210e19ccb98ba5d690f786c9..dc1c422ff08be7056506c646cb3ff1830061ae8d 100644
--- a/indra/newview/llpanelpeoplemenus.cpp
+++ b/indra/newview/llpanelpeoplemenus.cpp
@@ -42,6 +42,7 @@
 #include "llagent.h"
 #include "llagentdata.h"			// for gAgentID
 #include "llavataractions.h"
+#include "llcallingcard.h"			// for LLAvatarTracker
 #include "llviewermenu.h"			// for gMenuHolder
 
 namespace LLPanelPeopleMenus
@@ -49,64 +50,6 @@ namespace LLPanelPeopleMenus
 
 NearbyMenu gNearbyMenu;
 
-//== ContextMenu ==============================================================
-
-ContextMenu::ContextMenu()
-:	mMenu(NULL)
-{
-}
-
-ContextMenu::~ContextMenu()
-{
-	// do not forget delete LLContextMenu* mMenu.
-	// It can have registered Enable callbacks which are called from the LLMenuHolderGL::draw()
-	// via selected item (menu_item_call) by calling LLMenuItemCallGL::buildDrawLabel.
-	// we can have a crash via using callbacks of deleted instance of ContextMenu. EXT-4725
-
-	// menu holder deletes its menus on viewer exit, so we have no way to determine if instance 
-	// of mMenu has already been deleted except of using LLHandle. EXT-4762.
-	if (!mMenuHandle.isDead())
-	{
-		mMenu->die();
-		mMenu = NULL;
-	}
-}
-
-void ContextMenu::show(LLView* spawning_view, const uuid_vec_t& uuids, S32 x, S32 y)
-{
-	if (mMenu)
-	{
-		//preventing parent (menu holder) from deleting already "dead" context menus on exit
-		LLView* parent = mMenu->getParent();
-		if (parent)
-		{
-			parent->removeChild(mMenu);
-		}
-		delete mMenu;
-		mMenu = NULL;
-		mUUIDs.clear();
-	}
-
-	if ( uuids.empty() )
-		return;
-
-	mUUIDs.resize(uuids.size());
-	std::copy(uuids.begin(), uuids.end(), mUUIDs.begin());
-
-	mMenu = createMenu();
-	mMenuHandle = mMenu->getHandle();
-	mMenu->show(x, y);
-	LLMenuGL::showPopup(spawning_view, mMenu, x, y);
-}
-
-void ContextMenu::hide()
-{
-	if(mMenu)
-	{
-		mMenu->hide();
-	}
-}
-
 //== NearbyMenu ===============================================================
 
 LLContextMenu* NearbyMenu::createMenu()
@@ -135,8 +78,7 @@ LLContextMenu* NearbyMenu::createMenu()
 		enable_registrar.add("Avatar.CheckItem",  boost::bind(&NearbyMenu::checkContextMenuItem,	this, _2));
 
 		// create the context menu from the XUI
-		return LLUICtrlFactory::getInstance()->createFromFile<LLContextMenu>(
-			"menu_people_nearby.xml", LLMenuGL::sMenuContainer, LLViewerMenuHolderGL::child_registry_t::instance());
+		return createFromFile("menu_people_nearby.xml");
 	}
 	else
 	{
@@ -151,9 +93,7 @@ LLContextMenu* NearbyMenu::createMenu()
 		enable_registrar.add("Avatar.EnableItem",	boost::bind(&NearbyMenu::enableContextMenuItem,	this, _2));
 
 		// create the context menu from the XUI
-		return LLUICtrlFactory::getInstance()->createFromFile<LLContextMenu>
-			("menu_people_nearby_multiselect.xml", LLMenuGL::sMenuContainer, LLViewerMenuHolderGL::child_registry_t::instance());
-
+		return createFromFile("menu_people_nearby_multiselect.xml");
 	}
 }
 
diff --git a/indra/newview/llpanelpeoplemenus.h b/indra/newview/llpanelpeoplemenus.h
index 8e12710afc47efb98db7576c7a4413c1d4a3ebe7..e1f8790135a745074d7cb810f54e953569d32376 100644
--- a/indra/newview/llpanelpeoplemenus.h
+++ b/indra/newview/llpanelpeoplemenus.h
@@ -33,42 +33,15 @@
 #ifndef LL_LLPANELPEOPLEMENUS_H
 #define LL_LLPANELPEOPLEMENUS_H
 
-#include "llavatarlistitem.h"
+#include "lllistcontextmenu.h"
 
 namespace LLPanelPeopleMenus
 {
 
-/**
- * Base context menu.
- */
-class ContextMenu : public LLAvatarListItem::ContextMenu
-{
-public:
-	ContextMenu();
-	virtual ~ContextMenu();
-
-	/**
-	 * Show the menu at specified coordinates.
-	 *
-	 * @param  uuids - an array of avatar or group ids
-	 */
-	/*virtual*/ void show(LLView* spawning_view, const uuid_vec_t& uuids, S32 x, S32 y);
-
-	virtual void hide();
-
-protected:
-
-	virtual LLContextMenu* createMenu() = 0;
-
-	uuid_vec_t	mUUIDs;
-	LLContextMenu*		mMenu;
-	LLHandle<LLView>	mMenuHandle;
-};
-
 /**
  * Menu used in the nearby people list.
  */
-class NearbyMenu : public ContextMenu
+class NearbyMenu : public LLListContextMenu
 {
 public:
 	/*virtual*/ LLContextMenu* createMenu();
diff --git a/indra/newview/llpanelplaceprofile.cpp b/indra/newview/llpanelplaceprofile.cpp
index 1a1650c38b283dcdc62ee77eb891095f29ec5c99..c8abcc83c4fd4ad4ded58c381d5ff4c014f96be1 100644
--- a/indra/newview/llpanelplaceprofile.cpp
+++ b/indra/newview/llpanelplaceprofile.cpp
@@ -50,7 +50,7 @@
 #include "llagentui.h"
 #include "llappviewer.h"
 #include "llcallbacklist.h"
-#include "llfloaterbuycurrency.h"
+#include "llbuycurrencyhtml.h"
 #include "llstatusbar.h"
 #include "llviewercontrol.h"
 #include "llviewerparcelmgr.h"
@@ -573,7 +573,7 @@ void LLPanelPlaceProfile::onForSaleBannerClick()
 			{
 				LLStringUtil::format_map_t args;
 				args["AMOUNT"] = llformat("%d", price);
-				LLFloaterBuyCurrency::buyCurrency(LLTrans::getString("buying_selected_land", args), price);
+				LLBuyCurrencyHTML::openCurrencyFloater( LLTrans::getString("buying_selected_land", args), price );
 			}
 			else
 			{
diff --git a/indra/newview/llpanelteleporthistory.h b/indra/newview/llpanelteleporthistory.h
index 1f2be63dc26b0ab0ee3dc9ccab56e0286d659537..87e704422263154e5242d4c5a98bb6a1dee83e41 100644
--- a/indra/newview/llpanelteleporthistory.h
+++ b/indra/newview/llpanelteleporthistory.h
@@ -47,6 +47,7 @@ class LLFlatListView;
 class LLTeleportHistoryPanel : public LLPanelPlacesTab
 {
 public:
+	// *TODO: derive from LLListContextMenu?
 	class ContextMenu
 	{
 	public:
diff --git a/indra/newview/llparticipantlist.cpp b/indra/newview/llparticipantlist.cpp
index 1117ae05d72dd4a2165d78b16650173b3538b3dc..b975536f8bcbcc8c9fd2afba0cbd19eef68a2006 100644
--- a/indra/newview/llparticipantlist.cpp
+++ b/indra/newview/llparticipantlist.cpp
@@ -648,8 +648,7 @@ LLContextMenu* LLParticipantList::LLParticipantListMenu::createMenu()
 	enable_registrar.add("ParticipantList.CheckItem",  boost::bind(&LLParticipantList::LLParticipantListMenu::checkContextMenuItem,	this, _2));
 
 	// create the context menu from the XUI
-	LLContextMenu* main_menu = LLUICtrlFactory::getInstance()->createFromFile<LLContextMenu>(
-		"menu_participant_list.xml", LLMenuGL::sMenuContainer, LLViewerMenuHolderGL::child_registry_t::instance());
+	LLContextMenu* main_menu = createFromFile("menu_participant_list.xml");
 
 	// Don't show sort options for P2P chat
 	bool is_sort_visible = (mParent.mAvatarList && mParent.mAvatarList->size() > 1);
@@ -666,10 +665,10 @@ LLContextMenu* LLParticipantList::LLParticipantListMenu::createMenu()
 
 void LLParticipantList::LLParticipantListMenu::show(LLView* spawning_view, const uuid_vec_t& uuids, S32 x, S32 y)
 {
-	LLPanelPeopleMenus::ContextMenu::show(spawning_view, uuids, x, y);
-
 	if (uuids.size() == 0) return;
 
+	LLListContextMenu::show(spawning_view, uuids, x, y);
+
 	const LLUUID& speaker_id = mUUIDs.front();
 	BOOL is_muted = isMuted(speaker_id);
 
diff --git a/indra/newview/llparticipantlist.h b/indra/newview/llparticipantlist.h
index abaf50386831eb7ffd4104fac27be50edad28af5..967c8b78cf5d45fe58585bc7f87f912c444428b0 100644
--- a/indra/newview/llparticipantlist.h
+++ b/indra/newview/llparticipantlist.h
@@ -32,8 +32,8 @@
 
 #include "llviewerprecompiledheaders.h"
 #include "llevent.h"
-#include "llpanelpeoplemenus.h"
 #include "llavatarlist.h" // for LLAvatarItemRecentSpeakerComparator
+#include "lllistcontextmenu.h"
 
 class LLSpeakerMgr;
 class LLAvatarList;
@@ -148,7 +148,7 @@ class LLParticipantList
 		/**
 		 * Menu used in the participant list.
 		 */
-		class LLParticipantListMenu : public LLPanelPeopleMenus::ContextMenu
+		class LLParticipantListMenu : public LLListContextMenu
 		{
 		public:
 			LLParticipantListMenu(LLParticipantList& parent):mParent(parent){};
diff --git a/indra/newview/llscrollingpanelparam.cpp b/indra/newview/llscrollingpanelparam.cpp
index a5518d87d446d9f9ef0c3ad6f44f19eea4a75099..242af6981c5f898099af325ec6c634b570aa26ef 100644
--- a/indra/newview/llscrollingpanelparam.cpp
+++ b/indra/newview/llscrollingpanelparam.cpp
@@ -73,9 +73,9 @@ LLScrollingPanelParam::LLScrollingPanelParam( const LLPanel::Params& panel_param
 	F32 min_weight = param->getMinWeight();
 	F32 max_weight = param->getMaxWeight();
 
-	mHintMin = new LLVisualParamHint( pos_x, pos_y, PARAM_HINT_WIDTH, PARAM_HINT_HEIGHT, mesh, (LLViewerVisualParam*) wearable->getVisualParam(param->getID()),  min_weight);
+	mHintMin = new LLVisualParamHint( pos_x, pos_y, PARAM_HINT_WIDTH, PARAM_HINT_HEIGHT, mesh, (LLViewerVisualParam*) wearable->getVisualParam(param->getID()), wearable,  min_weight);
 	pos_x = getChild<LLViewBorder>("right_border")->getRect().mLeft + left_border->getBorderWidth();
-	mHintMax = new LLVisualParamHint( pos_x, pos_y, PARAM_HINT_WIDTH, PARAM_HINT_HEIGHT, mesh, (LLViewerVisualParam*) wearable->getVisualParam(param->getID()), max_weight );
+	mHintMax = new LLVisualParamHint( pos_x, pos_y, PARAM_HINT_WIDTH, PARAM_HINT_HEIGHT, mesh, (LLViewerVisualParam*) wearable->getVisualParam(param->getID()), wearable, max_weight );
 	
 	mHintMin->setAllowsUpdates( FALSE );
 	mHintMax->setAllowsUpdates( FALSE );
diff --git a/indra/newview/llsidepanelappearance.cpp b/indra/newview/llsidepanelappearance.cpp
index 3f05e05fd4aa3583e91c1a9c9732c09ff8fbc39b..010d593b2798bba77ab23ab98c0b73505d9da9ff 100644
--- a/indra/newview/llsidepanelappearance.cpp
+++ b/indra/newview/llsidepanelappearance.cpp
@@ -47,6 +47,7 @@
 #include "llsidetray.h"
 #include "lltextbox.h"
 #include "lluictrlfactory.h"
+#include "llviewercontrol.h"
 #include "llviewerregion.h"
 #include "llvoavatarself.h"
 #include "llwearable.h"
@@ -267,14 +268,14 @@ void LLSidepanelAppearance::showOutfitsInventoryPanel()
 void LLSidepanelAppearance::showOutfitEditPanel()
 {
 	togglMyOutfitsPanel(FALSE);
-	toggleWearableEditPanel(FALSE);
+	toggleWearableEditPanel(FALSE, NULL, TRUE); // don't switch out of edit appearance mode
 	toggleOutfitEditPanel(TRUE);
 }
 
 void LLSidepanelAppearance::showWearableEditPanel(LLWearable *wearable /* = NULL*/)
 {
 	togglMyOutfitsPanel(FALSE);
-	toggleOutfitEditPanel(FALSE);
+	toggleOutfitEditPanel(FALSE, TRUE); // don't switch out of edit appearance mode
 	toggleWearableEditPanel(TRUE, wearable);
 }
 
@@ -300,7 +301,7 @@ void LLSidepanelAppearance::togglMyOutfitsPanel(BOOL visible)
 	}
 }
 
-void LLSidepanelAppearance::toggleOutfitEditPanel(BOOL visible)
+void LLSidepanelAppearance::toggleOutfitEditPanel(BOOL visible, BOOL disable_camera_switch)
 {
 	if (!mOutfitEdit || mOutfitEdit->getVisible() == visible)
 	{
@@ -313,10 +314,18 @@ void LLSidepanelAppearance::toggleOutfitEditPanel(BOOL visible)
 	if (visible)
 	{
 		mOutfitEdit->onOpen(LLSD());
+		if (!disable_camera_switch && gSavedSettings.getBOOL("AppearanceCameraMovement") )
+		{
+			gAgentCamera.changeCameraToCustomizeAvatar();
+		}
+	}
+	else if (!disable_camera_switch && gSavedSettings.getBOOL("AppearanceCameraMovement") )
+	{
+		gAgentCamera.changeCameraToDefault();
 	}
 }
 
-void LLSidepanelAppearance::toggleWearableEditPanel(BOOL visible, LLWearable *wearable)
+void LLSidepanelAppearance::toggleWearableEditPanel(BOOL visible, LLWearable *wearable, BOOL disable_camera_switch)
 {
 	if (!mEditWearable || mEditWearable->getVisible() == visible)
 	{
@@ -340,11 +349,19 @@ void LLSidepanelAppearance::toggleWearableEditPanel(BOOL visible, LLWearable *we
 	if (visible)
 	{
 		mEditWearable->onOpen(LLSD()); // currently no-op, just for consistency
+		if (!disable_camera_switch && gSavedSettings.getBOOL("AppearanceCameraMovement") )
+		{
+			gAgentCamera.changeCameraToCustomizeAvatar();
+		}
 	}
 	else
 	{
 		// Save changes if closing.
 		mEditWearable->saveChanges();
+		if (!disable_camera_switch && gSavedSettings.getBOOL("AppearanceCameraMovement") )
+		{
+			gAgentCamera.changeCameraToDefault();
+		}
 	}
 }
 
diff --git a/indra/newview/llsidepanelappearance.h b/indra/newview/llsidepanelappearance.h
index f243bbd471ebd8a7f7da1b379688d6e5b6ea7434..12303b6e96c625a9a8063fd0e6f4ca83de91e81b 100644
--- a/indra/newview/llsidepanelappearance.h
+++ b/indra/newview/llsidepanelappearance.h
@@ -75,8 +75,8 @@ class LLSidepanelAppearance : public LLPanel
 	void onEditAppearanceButtonClicked();
 
 	void togglMyOutfitsPanel(BOOL visible);
-	void toggleOutfitEditPanel(BOOL visible);
-	void toggleWearableEditPanel(BOOL visible, LLWearable* wearable = NULL);
+	void toggleOutfitEditPanel(BOOL visible, BOOL disable_camera_switch = FALSE);
+	void toggleWearableEditPanel(BOOL visible, LLWearable* wearable = NULL, BOOL disable_camera_switch = FALSE);
 
 	LLFilterEditor*			mFilterEditor;
 	LLPanelOutfitsInventory* mPanelOutfitsInventory;
diff --git a/indra/newview/llspeakers.cpp b/indra/newview/llspeakers.cpp
index c8bb4aa983dea38cd2835c350bad3c5702718424..9da3db303286ca955249ca9c5c14727a01b51ad8 100644
--- a/indra/newview/llspeakers.cpp
+++ b/indra/newview/llspeakers.cpp
@@ -529,6 +529,7 @@ BOOL LLSpeakerMgr::isVoiceActive()
 // LLIMSpeakerMgr
 //
 LLIMSpeakerMgr::LLIMSpeakerMgr(LLVoiceChannel* channel) : LLSpeakerMgr(channel)
+, mVoiceModerated(false)
 {
 }
 
@@ -783,21 +784,33 @@ void LLIMSpeakerMgr::moderateVoiceOtherParticipants(const LLUUID& excluded_avata
 	*/
 
 	mReverseVoiceModeratedAvatarID = excluded_avatar_id;
-	moderateVoiceSession(getSessionID(), !unmute_everyone_else);
+
+
+	if (mVoiceModerated == !unmute_everyone_else)
+	{
+		// session already in requested state. Just force participants which do not match it.
+		forceVoiceModeratedMode(mVoiceModerated);
+	}
+	else
+	{
+		// otherwise set moderated mode for a whole session.
+		moderateVoiceSession(getSessionID(), !unmute_everyone_else);
+	}
 }
 
 void LLIMSpeakerMgr::processSessionUpdate(const LLSD& session_update)
 {
-	if (mReverseVoiceModeratedAvatarID.isNull()) return;
-
 	if (session_update.has("moderated_mode") &&
 		session_update["moderated_mode"].has("voice"))
 	{
-		BOOL voice_moderated = session_update["moderated_mode"]["voice"];
+		mVoiceModerated = session_update["moderated_mode"]["voice"];
 
-		moderateVoiceParticipant(mReverseVoiceModeratedAvatarID, voice_moderated);
+		if (mReverseVoiceModeratedAvatarID.notNull())
+		{
+			moderateVoiceParticipant(mReverseVoiceModeratedAvatarID, mVoiceModerated);
 
-		mReverseVoiceModeratedAvatarID = LLUUID::null;
+			mReverseVoiceModeratedAvatarID = LLUUID::null;
+		}
 	}
 }
 
@@ -817,6 +830,20 @@ void LLIMSpeakerMgr::moderateVoiceSession(const LLUUID& session_id, bool disallo
 	LLHTTPClient::post(url, data, new ModerationResponder(session_id));
 }
 
+void LLIMSpeakerMgr::forceVoiceModeratedMode(bool should_be_muted)
+{
+	for (speaker_map_t::iterator speaker_it = mSpeakers.begin(); speaker_it != mSpeakers.end(); ++speaker_it)
+	{
+		LLUUID speaker_id = speaker_it->first;
+		LLSpeaker* speakerp = speaker_it->second;
+
+		// participant does not match requested state
+		if (should_be_muted != (bool)speakerp->mModeratorMutedVoice)
+		{
+			moderateVoiceParticipant(speaker_id, !should_be_muted);
+		}
+	}
+}
 
 //
 // LLActiveSpeakerMgr
diff --git a/indra/newview/llspeakers.h b/indra/newview/llspeakers.h
index 2bb160b7ce9d4b6264ece7cb3ec506dcf8b68a7b..b38acb7bc4d04ae2614f5f49e9f01fd512f99805 100644
--- a/indra/newview/llspeakers.h
+++ b/indra/newview/llspeakers.h
@@ -303,7 +303,15 @@ class LLIMSpeakerMgr : public LLSpeakerMgr
 
 	void moderateVoiceSession(const LLUUID& session_id, bool disallow_voice);
 
+	/**
+	 * Process all participants to mute/unmute them according to passed voice session state.
+	 */
+	void forceVoiceModeratedMode(bool should_be_muted);
+
+private:
 	LLUUID mReverseVoiceModeratedAvatarID;
+	bool mVoiceModerated;
+
 };
 
 class LLActiveSpeakerMgr : public LLSpeakerMgr, public LLSingleton<LLActiveSpeakerMgr>
diff --git a/indra/newview/llstatusbar.cpp b/indra/newview/llstatusbar.cpp
index b660a2b8eaaac611d77e6d86d4233a006f735378..5628205dd4e0661e19eb5d1672d3b1a3efe893cd 100644
--- a/indra/newview/llstatusbar.cpp
+++ b/indra/newview/llstatusbar.cpp
@@ -41,6 +41,7 @@
 #include "llcommandhandler.h"
 #include "llviewercontrol.h"
 #include "llfloaterbuycurrency.h"
+#include "llbuycurrencyhtml.h"
 #include "llfloaterlagmeter.h"
 #include "llpanelnearbymedia.h"
 #include "llpanelvolumepulldown.h"
@@ -509,7 +510,9 @@ S32 LLStatusBar::getSquareMetersLeft() const
 
 void LLStatusBar::onClickBuyCurrency()
 {
-	LLFloaterBuyCurrency::buyCurrency();
+	// open a currency floater - actual one open depends on 
+	// value specified in settings.xml
+	LLBuyCurrencyHTML::openCurrencyFloater();
 }
 
 static void onClickHealth(void* )
diff --git a/indra/newview/lltexlayer.cpp b/indra/newview/lltexlayer.cpp
index 337627cc79523ad92622db2656d1898b2930cb34..4be03596f84f07d3be2217390f4e194b13ceaaa8 100644
--- a/indra/newview/lltexlayer.cpp
+++ b/indra/newview/lltexlayer.cpp
@@ -237,7 +237,7 @@ BOOL LLTexLayerSetBuffer::render()
 		{
 			if (mTexLayerSet->isVisible())
 			{
-				mTexLayerSet->getAvatar()->bakedTextureUpload(mTexLayerSet->getBakedTexIndex(), FALSE); // FALSE for start of upload, TRUE for finish.
+				mTexLayerSet->getAvatar()->debugBakedTextureUpload(mTexLayerSet->getBakedTexIndex(), FALSE); // FALSE for start of upload, TRUE for finish.
 				readBackAndUpload();
 			}
 			else
diff --git a/indra/newview/lltexturectrl.cpp b/indra/newview/lltexturectrl.cpp
index 9aebc264a28c9757146a69e39f49ca8eb1896960..efdddd947b1cc7a889a1ab534180db9f9ac421c9 100644
--- a/indra/newview/lltexturectrl.cpp
+++ b/indra/newview/lltexturectrl.cpp
@@ -1304,7 +1304,7 @@ void LLTextureCtrl::draw()
 							 LLColor4::white, LLFontGL::LEFT, LLFontGL::BASELINE, LLFontGL::DROP_SHADOW);
 
 			v_offset += 12;
-			tdesc = llformat("  ID  : %s...", (mImageAssetID.asString().substr(0,10)).c_str());
+			tdesc = llformat("  ID  : %s...", (mImageAssetID.asString().substr(0,7)).c_str());
 			font->renderUTF8(tdesc, 0, llfloor(interior.mLeft+3), llfloor(interior.mTop-v_offset),
 							 LLColor4::white, LLFontGL::LEFT, LLFontGL::BASELINE, LLFontGL::DROP_SHADOW);
 		}
diff --git a/indra/newview/lltoolmorph.cpp b/indra/newview/lltoolmorph.cpp
index 22176c037f4c709b8094ef274dcca02928c6a25d..22e15dcff25762e379759b4ecd5d88b4a4340bee 100644
--- a/indra/newview/lltoolmorph.cpp
+++ b/indra/newview/lltoolmorph.cpp
@@ -79,6 +79,7 @@ LLVisualParamHint::LLVisualParamHint(
 	S32 width, S32 height, 
 	LLViewerJointMesh *mesh, 
 	LLViewerVisualParam *param,
+	LLWearable *wearable,
 	F32 param_weight)
 	:
 	LLViewerDynamicTexture(width, height, 3, LLViewerDynamicTexture::ORDER_MIDDLE, TRUE ),
@@ -86,6 +87,7 @@ LLVisualParamHint::LLVisualParamHint(
 	mIsVisible( FALSE ),
 	mJointMesh( mesh ),
 	mVisualParam( param ),
+	mWearablePtr( wearable ),
 	mVisualParamWeight( param_weight ),
 	mAllowsUpdates( TRUE ),
 	mDelayFrames( 0 ),
@@ -151,7 +153,7 @@ BOOL LLVisualParamHint::needsRender()
 void LLVisualParamHint::preRender(BOOL clear_depth)
 {
 	mLastParamWeight = mVisualParam->getWeight();
-	mVisualParam->setWeight(mVisualParamWeight, FALSE);
+	mWearablePtr->setVisualParamWeight(mVisualParam->getID(), mVisualParamWeight, FALSE);
 	gAgentAvatarp->setVisualParamWeight(mVisualParam->getID(), mVisualParamWeight, FALSE);
 	gAgentAvatarp->setVisualParamWeight("Blink_Left", 0.f);
 	gAgentAvatarp->setVisualParamWeight("Blink_Right", 0.f);
@@ -250,10 +252,12 @@ BOOL LLVisualParamHint::render()
 		gGL.setAlphaRejectSettings(LLRender::CF_DEFAULT);
 	}
 	gAgentAvatarp->setVisualParamWeight(mVisualParam->getID(), mLastParamWeight);
-	mVisualParam->setWeight(mLastParamWeight, FALSE);
+	mWearablePtr->setVisualParamWeight(mVisualParam->getID(), mLastParamWeight, FALSE);
+	gAgentAvatarp->updateVisualParams();
 	gGL.color4f(1,1,1,1);
 	mGLTexturep->setGLTextureCreated(true);
 	gGL.popUIMatrix();
+
 	return TRUE;
 }
 
diff --git a/indra/newview/lltoolmorph.h b/indra/newview/lltoolmorph.h
index c332c296bd487f9b398c2ba208beda16265fd7e0..3bffefaa55a8034f9b88deeb6ace4ac978cb782f 100644
--- a/indra/newview/lltoolmorph.h
+++ b/indra/newview/lltoolmorph.h
@@ -62,6 +62,7 @@ class LLVisualParamHint : public LLViewerDynamicTexture
 		S32 width, S32 height, 
 		LLViewerJointMesh *mesh, 
 		LLViewerVisualParam *param,
+		LLWearable *wearable,
 		F32 param_weight);	
 
 	/*virtual*/ S8 getType() const ;
@@ -89,6 +90,7 @@ class LLVisualParamHint : public LLViewerDynamicTexture
 	BOOL					mIsVisible;			// is this distortion hint visible?
 	LLViewerJointMesh*		mJointMesh;			// mesh that this distortion applies to
 	LLViewerVisualParam*	mVisualParam;		// visual param applied by this hint
+	LLWearable*				mWearablePtr;		// wearable we're editing
 	F32						mVisualParamWeight;		// weight for this visual parameter
 	BOOL					mAllowsUpdates;		// updates are blocked unless this is true
 	S32						mDelayFrames;		// updates are blocked for this many frames
diff --git a/indra/newview/llviewerfloaterreg.cpp b/indra/newview/llviewerfloaterreg.cpp
index 506cebfe73287aeddea95f6eaf2ab1124db734af..49ea0348f9e951b485babb1d9adc9dcb0a574c51 100644
--- a/indra/newview/llviewerfloaterreg.cpp
+++ b/indra/newview/llviewerfloaterreg.cpp
@@ -49,6 +49,7 @@
 #include "llfloaterbuy.h"
 #include "llfloaterbuycontents.h"
 #include "llfloaterbuycurrency.h"
+#include "llfloaterbuycurrencyhtml.h"
 #include "llfloaterbuyland.h"
 #include "llfloaterbulkpermission.h"
 #include "llfloaterbump.h"
@@ -141,6 +142,7 @@ void LLViewerFloaterReg::registerFloaters()
 	LLFloaterReg::add("beacons", "floater_beacons.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterBeacons>);
 	LLFloaterReg::add("bulk_perms", "floater_bulk_perms.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterBulkPermission>);
 	LLFloaterReg::add("buy_currency", "floater_buy_currency.xml", &LLFloaterBuyCurrency::buildFloater);
+	LLFloaterReg::add("buy_currency_html", "floater_buy_currency_html.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterBuyCurrencyHTML>);	
 	LLFloaterReg::add("buy_land", "floater_buy_land.xml", &LLFloaterBuyLand::buildFloater);
 	LLFloaterReg::add("buy_object", "floater_buy_object.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterBuy>);
 	LLFloaterReg::add("buy_object_contents", "floater_buy_contents.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterBuyContents>);
diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp
index 4db05e8a98aa9510416243217cd172b9a93d1e76..e5c5a607dd8902098e95c07bf687bd65b39daf1a 100644
--- a/indra/newview/llviewermedia.cpp
+++ b/indra/newview/llviewermedia.cpp
@@ -1937,7 +1937,7 @@ void LLViewerMediaImpl::updateVolume()
 				// attenuated_volume = 1 / (roll_off_rate * (d - min))^2
 				// the +1 is there so that for distance 0 the volume stays the same
 				F64 adjusted_distance = mProximityCamera - gSavedSettings.getF32("MediaRollOffMin");
-				F64 attenuation = gSavedSettings.getF32("MediaRollOffRate") * adjusted_distance;
+				F64 attenuation = 1.0 + (gSavedSettings.getF32("MediaRollOffRate") * adjusted_distance);
 				attenuation = 1.0 / (attenuation * attenuation);
 				// the attenuation multiplier should never be more than one since that would increase volume
 				volume = volume * llmin(1.0, attenuation);
@@ -2795,6 +2795,42 @@ bool LLViewerMediaImpl::isPlayable() const
 	return false;
 }
 
+////////////////////////////////////////////////////////////////////////////////
+// static 
+bool LLViewerMediaImpl::onClickLinkExternalTarget(const LLSD& notification, const LLSD& response )
+{
+	S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
+	if ( 0 == option )
+	{
+		LLSD payload = notification["payload"];
+		std::string url = payload["url"].asString();
+		S32 target_type = payload["target_type"].asInteger();
+		clickLinkWithTarget(url, target_type);
+	}
+	return false;
+}
+
+
+////////////////////////////////////////////////////////////////////////////////
+// static 
+void LLViewerMediaImpl::clickLinkWithTarget(const std::string& url, const S32& target_type )
+{
+	if (target_type == LLPluginClassMedia::TARGET_EXTERNAL)
+	{
+		// load target in an external browser
+		LLWeb::loadURLExternal(url);
+	}
+	else if (target_type == LLPluginClassMedia::TARGET_BLANK)
+	{
+		// load target in the user's preferred browser
+		LLWeb::loadURL(url);
+	}
+	else {
+		// unsupported link target - shouldn't happen
+		LL_WARNS("LinkTarget") << "Unsupported link target type" << LL_ENDL;
+	}
+}
+
 //////////////////////////////////////////////////////////////////////////////////////////
 void LLViewerMediaImpl::handleMediaEvent(LLPluginClassMedia* plugin, LLPluginClassMediaOwner::EMediaEvent event)
 {
@@ -2808,6 +2844,31 @@ void LLViewerMediaImpl::handleMediaEvent(LLPluginClassMedia* plugin, LLPluginCla
 
 		}
 		break;
+		case MEDIA_EVENT_CLICK_LINK_HREF:
+		{
+			LL_DEBUGS("Media") <<  "Media event:  MEDIA_EVENT_CLICK_LINK_HREF, target is \"" << plugin->getClickTarget() << "\", uri is " << plugin->getClickURL() << LL_ENDL;
+			// retrieve the event parameters
+			std::string url = plugin->getClickURL();
+			U32 target_type = plugin->getClickTargetType();
+			
+			// is there is a target specified for the link?
+			if (target_type == LLPluginClassMedia::TARGET_EXTERNAL ||
+				target_type == LLPluginClassMedia::TARGET_BLANK )
+			{
+				if (gSavedSettings.getBOOL("UseExternalBrowser"))
+				{
+					LLSD payload;
+					payload["url"] = url;
+					payload["target_type"] = LLSD::Integer(target_type);
+					LLNotificationsUtil::add( "WebLaunchExternalTarget", LLSD(), payload, onClickLinkExternalTarget);
+				}
+				else
+				{
+					clickLinkWithTarget(url, target_type);
+				}
+			}
+		};
+		break;
 		case MEDIA_EVENT_PLUGIN_FAILED_LAUNCH:
 		{
 			// The plugin failed to load properly.  Make sure the timer doesn't retry.
diff --git a/indra/newview/llviewermedia.h b/indra/newview/llviewermedia.h
index 8626f4469e332fcda197cc801bf55db2d68960f0..754d0851c361692dbd3a35aa6d0695aa02d0e3ba 100644
--- a/indra/newview/llviewermedia.h
+++ b/indra/newview/llviewermedia.h
@@ -391,6 +391,8 @@ class LLViewerMediaImpl
 	bool shouldShowBasedOnClass() const;
 	static bool isObjectAttachedToAnotherAvatar(LLVOVolume *obj);
 	static bool isObjectInAgentParcel(LLVOVolume *obj);
+	static bool onClickLinkExternalTarget( const LLSD&, const LLSD& );
+	static void clickLinkWithTarget(const std::string& url, const S32& target_type );
 	
 private:
 	// a single media url with some data and an impl.
diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp
index f90589298263cde02385900809d8595df517ed82..d0ac103f5654e103c8dd221f50779a0557e2a379 100644
--- a/indra/newview/llviewermenu.cpp
+++ b/indra/newview/llviewermenu.cpp
@@ -53,7 +53,7 @@
 //#include "llfirstuse.h"
 #include "llfloaterbuy.h"
 #include "llfloaterbuycontents.h"
-#include "llfloaterbuycurrency.h"
+#include "llbuycurrencyhtml.h"
 #include "llfloatercustomize.h"
 #include "llfloatergodtools.h"
 #include "llfloaterinventory.h"
@@ -108,6 +108,7 @@
 #include "lluilistener.h"
 #include "llappearancemgr.h"
 #include "lltrans.h"
+#include "lleconomy.h"
 
 using namespace LLVOAvatarDefines;
 
@@ -3288,7 +3289,7 @@ void handle_buy_object(LLSaleInfo sale_info)
 	{
 		LLStringUtil::format_map_t args;
 		args["AMOUNT"] = llformat("%d", price);
-		LLFloaterBuyCurrency::buyCurrency(LLTrans::getString("this_object_costs", args), price);
+		LLBuyCurrencyHTML::openCurrencyFloater( LLTrans::getString("this_object_costs", args), price );
 		return;
 	}
 
@@ -4430,8 +4431,7 @@ void handle_buy_or_take()
 		{
 			LLStringUtil::format_map_t args;
 			args["AMOUNT"] = llformat("%d", total_price);
-			LLFloaterBuyCurrency::buyCurrency(
-					LLTrans::getString("BuyingCosts", args), total_price);
+			LLBuyCurrencyHTML::openCurrencyFloater( LLTrans::getString( "BuyingCosts", args ), total_price );
 		}
 	}
 	else
@@ -5612,6 +5612,11 @@ void handle_customize_avatar()
 	LLSideTray::getInstance()->showPanel("sidepanel_appearance", LLSD().with("type", "my_outfits"));
 }
 
+void handle_edit_outfit()
+{
+	LLSideTray::getInstance()->showPanel("sidepanel_appearance", LLSD().with("type", "edit_outfit"));
+}
+
 void handle_edit_shape()
 {
 	LLSideTray::getInstance()->showPanel("sidepanel_appearance", LLSD().with("type", "edit_shape"));
@@ -5626,7 +5631,7 @@ void handle_report_abuse()
 
 void handle_buy_currency()
 {
-	LLFloaterBuyCurrency::buyCurrency();
+	LLBuyCurrencyHTML::openCurrencyFloater();
 }
 
 class LLFloaterVisible : public view_listener_t
@@ -7654,6 +7659,42 @@ class LLWorldToggleCameraControls : public view_listener_t
 	}
 };
 
+class LLUploadCostCalculator : public view_listener_t
+{
+	std::string mCostStr;
+
+	bool handleEvent(const LLSD& userdata)
+	{
+		std::string menu_name = userdata.asString();
+		gMenuHolder->childSetLabelArg(menu_name, "[COST]", mCostStr);
+
+		return true;
+	}
+
+	void calculateCost();
+
+public:
+	LLUploadCostCalculator()
+	{
+		calculateCost();
+	}
+};
+
+void LLUploadCostCalculator::calculateCost()
+{
+	S32 upload_cost = LLGlobalEconomy::Singleton::getInstance()->getPriceUpload();
+
+	// getPriceUpload() returns -1 if no data available yet.
+	if(upload_cost >= 0)
+	{
+		mCostStr = llformat("%d", upload_cost);
+	}
+	else
+	{
+		mCostStr = llformat("%d", gSavedSettings.getU32("DefaultUploadCost"));
+	}
+}
+
 void show_navbar_context_menu(LLView* ctrl, S32 x, S32 y)
 {
 	static LLMenuGL*	show_navbar_context_menu = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>("menu_hide_navbar.xml",
@@ -7695,6 +7736,8 @@ void initialize_menus()
 	enable.add("IsGodCustomerService", boost::bind(&is_god_customer_service));
 	enable.add("IsGodCustomerService", boost::bind(&is_god_customer_service));
 
+	view_listener_t::addEnable(new LLUploadCostCalculator(), "Upload.CalculateCosts");
+
 	// Agent
 	commit.add("Agent.toggleFlying", boost::bind(&LLAgent::toggleFlying));
 	enable.add("Agent.enableFlying", boost::bind(&LLAgent::enableFlying));
@@ -7727,6 +7770,7 @@ void initialize_menus()
 	view_listener_t::addMenu(new LLEditEnableCustomizeAvatar(), "Edit.EnableCustomizeAvatar");
 	view_listener_t::addMenu(new LLEnableEditShape(), "Edit.EnableEditShape");
 	commit.add("CustomizeAvatar", boost::bind(&handle_customize_avatar));
+	commit.add("EditOutfit", boost::bind(&handle_edit_outfit));
 	commit.add("EditShape", boost::bind(&handle_edit_shape));
 
 	// View menu
diff --git a/indra/newview/llviewermenufile.cpp b/indra/newview/llviewermenufile.cpp
index c415d89e9cb9b829d9c4c457fdb0bbf4588f35c2..5570fe5fec76133dd3ba8fd2fc467a09d6c17214 100644
--- a/indra/newview/llviewermenufile.cpp
+++ b/indra/newview/llviewermenufile.cpp
@@ -39,7 +39,7 @@
 #include "llagentcamera.h"
 #include "llfilepicker.h"
 #include "llfloaterreg.h"
-#include "llfloaterbuycurrency.h"
+#include "llbuycurrencyhtml.h"
 #include "llfloatersnapshot.h"
 #include "llimage.h"
 #include "llimagebmp.h"
@@ -811,7 +811,7 @@ void upload_done_callback(const LLUUID& uuid, void* user_data, S32 result, LLExt
 					LLStringUtil::format_map_t args;
 					args["NAME"] = data->mAssetInfo.getName();
 					args["AMOUNT"] = llformat("%d", expected_upload_cost);
-					LLFloaterBuyCurrency::buyCurrency(LLTrans::getString("UploadingCosts", args), expected_upload_cost);
+					LLBuyCurrencyHTML::openCurrencyFloater( LLTrans::getString("UploadingCosts", args), expected_upload_cost );
 					is_balance_sufficient = FALSE;
 				}
 				else if(region)
diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp
index 5b0b603d63b8968e93017387e3fa4634e5667f6c..5836aff4e759a17e9988d355dc8ed99bf4d4ecda 100644
--- a/indra/newview/llviewermessage.cpp
+++ b/indra/newview/llviewermessage.cpp
@@ -55,8 +55,7 @@
 #include "llagent.h"
 #include "llagentcamera.h"
 #include "llcallingcard.h"
-//#include "llfirstuse.h"
-#include "llfloaterbuycurrency.h"
+#include "llbuycurrencyhtml.h"
 #include "llfloaterbuyland.h"
 #include "llfloaterland.h"
 #include "llfloaterregioninfo.h"
@@ -283,7 +282,7 @@ void give_money(const LLUUID& uuid, LLViewerRegion* region, S32 amount, BOOL is_
 	{
 		LLStringUtil::format_map_t args;
 		args["AMOUNT"] = llformat("%d", amount);
-		LLFloaterBuyCurrency::buyCurrency(LLTrans::getString("giving", args), amount);
+		LLBuyCurrencyHTML::openCurrencyFloater( LLTrans::getString("giving", args), amount );
 	}
 }
 
diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp
index d925ab0d9005ae811e2f7790eff7fb97de4770af..d8a9ce93745897e474c3c820b7f0d7e815d23ca0 100644
--- a/indra/newview/llviewertexture.cpp
+++ b/indra/newview/llviewertexture.cpp
@@ -1893,6 +1893,12 @@ bool LLViewerFetchedTexture::updateFetch()
 			h = mGLTexturep->getHeight(0);
 			c = mComponents;
 		}
+
+		const U32 override_tex_discard_level = gSavedSettings.getU32("TextureDiscardLevel");
+		if (override_tex_discard_level != 0)
+		{
+			desired_discard = override_tex_discard_level;
+		}
 		
 		// bypass texturefetch directly by pulling from LLTextureCache
 		bool fetch_request_created = false;
diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp
index c82de73f2512c0a195078d0a43651df26e8eaf93..cf3fb01b5a4a440d88d51b48a2f5cf741a075e5f 100644
--- a/indra/newview/llvoavatarself.cpp
+++ b/indra/newview/llvoavatarself.cpp
@@ -157,14 +157,14 @@ void LLVOAvatarSelf::initInstance()
 	{
 		for (U32 j = 0; j <= MAX_DISCARD_LEVEL; ++j)
 		{
-			mTextureLoadTimes[i][j] = -1.0f;
+			mDebugTextureLoadTimes[i][j] = -1.0f;
 		}
 	}
 
 	for (U32 i =0; i < LLVOAvatarDefines::BAKED_NUM_INDICES; ++i)
 	{
-		mBakedTextureTimes[i][0] = -1.0f;
-		mBakedTextureTimes[i][1] = -1.0f;
+		mDebugBakedTextureTimes[i][0] = -1.0f;
+		mDebugBakedTextureTimes[i][1] = -1.0f;
 	}
 
 	status &= buildMenus();
@@ -1271,6 +1271,8 @@ BOOL LLVOAvatarSelf::isLocalTextureDataAvailable(const LLTexLayerSet* layerset)
 //-----------------------------------------------------------------------------
 BOOL LLVOAvatarSelf::isLocalTextureDataFinal(const LLTexLayerSet* layerset) const
 {
+	const U32 override_tex_discard_level = gSavedSettings.getU32("TextureDiscardLevel");
+
 	for (U32 i = 0; i < mBakedTextureDatas.size(); i++)
 	{
 		if (layerset == mBakedTextureDatas[i].mTexLayerSet)
@@ -1285,7 +1287,7 @@ BOOL LLVOAvatarSelf::isLocalTextureDataFinal(const LLTexLayerSet* layerset) cons
 				const U32 wearable_count = gAgentWearables.getWearableCount(wearable_type);
 				for (U32 wearable_index = 0; wearable_index < wearable_count; wearable_index++)
 				{
-					if (getLocalDiscardLevel(*local_tex_iter, wearable_index) != 0)
+					if (getLocalDiscardLevel(*local_tex_iter, wearable_index) > (S32)(override_tex_discard_level))
 					{
 						return FALSE;
 					}
@@ -1761,12 +1763,12 @@ BOOL LLVOAvatarSelf::getIsCloud()
 }
 
 /*static*/
-void LLVOAvatarSelf::onTimingLocalTexLoaded(BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata)
+void LLVOAvatarSelf::debugOnTimingLocalTexLoaded(BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata)
 {
-	gAgentAvatarp->timingLocalTexLoaded(success, src_vi, src, aux_src, discard_level, final, userdata);
+	gAgentAvatarp->debugTimingLocalTexLoaded(success, src_vi, src, aux_src, discard_level, final, userdata);
 }
 
-void LLVOAvatarSelf::timingLocalTexLoaded(BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata)
+void LLVOAvatarSelf::debugTimingLocalTexLoaded(BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata)
 {
 	LLAvatarTexData *data = (LLAvatarTexData *)userdata;
 	if (!data)
@@ -1776,14 +1778,14 @@ void LLVOAvatarSelf::timingLocalTexLoaded(BOOL success, LLViewerFetchedTexture *
 
 	ETextureIndex index = data->mIndex;
 	
-if (index < 0 || index >= TEX_NUM_INDICES)
+	if (index < 0 || index >= TEX_NUM_INDICES)
 	{
 		return;
 	}
 
 	if (discard_level >=0 && discard_level <= MAX_DISCARD_LEVEL) // ignore discard level -1, as it means we have no data.
 	{
-		mTextureLoadTimes[(U32)index][(U32)discard_level] = mDebugSelfLoadTimer.getElapsedTimeF32();
+		mDebugTextureLoadTimes[(U32)index][(U32)discard_level] = mDebugSelfLoadTimer.getElapsedTimeF32();
 	}
 	if (final)
 	{
@@ -1791,14 +1793,14 @@ if (index < 0 || index >= TEX_NUM_INDICES)
 	}
 }
 
-void LLVOAvatarSelf::bakedTextureUpload(EBakedTextureIndex index, BOOL finished)
+void LLVOAvatarSelf::debugBakedTextureUpload(EBakedTextureIndex index, BOOL finished)
 {
 	U32 done = 0;
 	if (finished)
 	{
 		done = 1;
 	}
-	mBakedTextureTimes[index][done] = mDebugSelfLoadTimer.getElapsedTimeF32();
+	mDebugBakedTextureTimes[index][done] = mDebugSelfLoadTimer.getElapsedTimeF32();
 }
 
 const LLUUID& LLVOAvatarSelf::grabBakedTexture(EBakedTextureIndex baked_index) const
@@ -1963,7 +1965,7 @@ void LLVOAvatarSelf::setNewBakedTexture( ETextureIndex te, const LLUUID& uuid )
 	const LLVOAvatarDictionary::TextureEntry *texture_dict = LLVOAvatarDictionary::getInstance()->getTexture(te);
 	if (texture_dict->mIsBakedTexture)
 	{
-		bakedTextureUpload(texture_dict->mBakedTextureIndex, TRUE); // FALSE for start of upload, TRUE for finish.
+		debugBakedTextureUpload(texture_dict->mBakedTextureIndex, TRUE); // FALSE for start of upload, TRUE for finish.
 		llinfos << "New baked texture: " << texture_dict->mName << " UUID: " << uuid <<llendl;
 	}
 	else
@@ -1993,8 +1995,8 @@ void LLVOAvatarSelf::outputRezDiagnostics() const
 {
 	const F32 final_time = mDebugSelfLoadTimer.getElapsedTimeF32();
 	llinfos << "REZTIME: Myself rez stats:" << llendl;
-	llinfos << "\t Time from avatar creation to load wearables: " << (S32)mTimeWearablesLoaded << llendl;
-	llinfos << "\t Time from avatar creation to de-cloud: " << (S32)mTimeAvatarVisible << llendl;
+	llinfos << "\t Time from avatar creation to load wearables: " << (S32)mDebugTimeWearablesLoaded << llendl;
+	llinfos << "\t Time from avatar creation to de-cloud: " << (S32)mDebugTimeAvatarVisible << llendl;
 	llinfos << "\t Time from avatar creation to de-cloud for others: " << (S32)final_time << llendl;
 	llinfos << "\t Load time for each texture: " << llendl;
 	for (U32 i = 0; i < LLVOAvatarDefines::TEX_NUM_INDICES; ++i)
@@ -2005,7 +2007,7 @@ void LLVOAvatarSelf::outputRezDiagnostics() const
 		for (j=0; j <= MAX_DISCARD_LEVEL; j++)
 		{
 			out << "\t";
-			S32 load_time = (S32)mTextureLoadTimes[i][j];
+			S32 load_time = (S32)mDebugTextureLoadTimes[i][j];
 			if (load_time == -1)
 			{
 				out << "*";
@@ -2025,7 +2027,7 @@ void LLVOAvatarSelf::outputRezDiagnostics() const
 	llinfos << "\t Time points for each upload (start / finish)" << llendl;
 	for (U32 i = 0; i < LLVOAvatarDefines::BAKED_NUM_INDICES; ++i)
 	{
-		llinfos << "\t\t (" << i << ") \t" << (S32)mBakedTextureTimes[i][0] << " / " << (S32)mBakedTextureTimes[i][1] << llendl;
+		llinfos << "\t\t (" << i << ") \t" << (S32)mDebugBakedTextureTimes[i][0] << " / " << (S32)mDebugBakedTextureTimes[i][1] << llendl;
 	}
 }
 
diff --git a/indra/newview/llvoavatarself.h b/indra/newview/llvoavatarself.h
index 666219f3aaca3bc6255f4d542c3d66ae07253f0a..8e6d9698f2e248ed3109ecc7a35a86206defbbb0 100644
--- a/indra/newview/llvoavatarself.h
+++ b/indra/newview/llvoavatarself.h
@@ -124,8 +124,6 @@ class LLVOAvatarSelf :
 	//--------------------------------------------------------------------
 public:
 	/*virtual*/ BOOL    getIsCloud();
-	void bakedTextureUpload(LLVOAvatarDefines::EBakedTextureIndex index, BOOL finished);
-	static void		onTimingLocalTexLoaded(BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata);
 
 	//--------------------------------------------------------------------
 	// Region state
@@ -217,6 +215,8 @@ class LLVOAvatarSelf :
 	static void			processRebakeAvatarTextures(LLMessageSystem* msg, void**);
 protected:
 	/*virtual*/ void	removeMissingBakedTextures();
+private:
+	LLFrameTimer    	mBakeTimeoutTimer;
 
 	//--------------------------------------------------------------------
 	// Layers
@@ -348,16 +348,18 @@ class LLVOAvatarSelf :
 		LLUUID			mAvatarID;
 		LLVOAvatarDefines::ETextureIndex	mIndex;
 	};
-	void wearablesLoaded() { mTimeWearablesLoaded = mDebugSelfLoadTimer.getElapsedTimeF32(); }
-	void avatarVisible() { mTimeAvatarVisible = mDebugSelfLoadTimer.getElapsedTimeF32(); }
+	void debugWearablesLoaded() { mDebugTimeWearablesLoaded = mDebugSelfLoadTimer.getElapsedTimeF32(); }
+	void debugAvatarVisible() { mDebugTimeAvatarVisible = mDebugSelfLoadTimer.getElapsedTimeF32(); }
 	void outputRezDiagnostics() const;
+	void debugBakedTextureUpload(LLVOAvatarDefines::EBakedTextureIndex index, BOOL finished);
+	static void		debugOnTimingLocalTexLoaded(BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata);
 private:
 	LLFrameTimer    mDebugSelfLoadTimer;
-	F32				mTimeWearablesLoaded;
-	F32 			mTimeAvatarVisible;
-	F32 			mTextureLoadTimes[LLVOAvatarDefines::TEX_NUM_INDICES][MAX_DISCARD_LEVEL+1]; // load time for each texture at each discard level
-	F32 			mBakedTextureTimes[LLVOAvatarDefines::BAKED_NUM_INDICES][2]; // time to start upload and finish upload of each baked texture
-	void			timingLocalTexLoaded(BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata);
+	F32				mDebugTimeWearablesLoaded;
+	F32 			mDebugTimeAvatarVisible;
+	F32 			mDebugTextureLoadTimes[LLVOAvatarDefines::TEX_NUM_INDICES][MAX_DISCARD_LEVEL+1]; // load time for each texture at each discard level
+	F32 			mDebugBakedTextureTimes[LLVOAvatarDefines::BAKED_NUM_INDICES][2]; // time to start upload and finish upload of each baked texture
+	void			debugTimingLocalTexLoaded(BOOL success, LLViewerFetchedTexture *src_vi, LLImageRaw* src, LLImageRaw* aux_src, S32 discard_level, BOOL final, void* userdata);
 
 /**                    Diagnostics
  **                                                                            **
diff --git a/indra/newview/llvotree.cpp b/indra/newview/llvotree.cpp
index b89c0cd6385c4c0aa1d72b60d6dd590c23847870..eb5b6c6618dc6a86e86dacd82eb3cf353f73291d 100644
--- a/indra/newview/llvotree.cpp
+++ b/indra/newview/llvotree.cpp
@@ -66,12 +66,14 @@ const F32 LEAF_TOP = 1.0f;
 const F32 LEAF_BOTTOM = 0.52f;
 const F32 LEAF_WIDTH = 1.f;
 
-S32 LLVOTree::sLODVertexOffset[4];
-S32 LLVOTree::sLODVertexCount[4];
-S32 LLVOTree::sLODIndexOffset[4];
-S32 LLVOTree::sLODIndexCount[4];
-S32 LLVOTree::sLODSlices[4] = {10, 5, 4, 3};
-F32 LLVOTree::sLODAngles[4] = {30.f, 20.f, 15.f, 0.f};
+const S32 LLVOTree::sMAX_NUM_TREE_LOD_LEVELS = 4 ;
+
+S32 LLVOTree::sLODVertexOffset[sMAX_NUM_TREE_LOD_LEVELS];
+S32 LLVOTree::sLODVertexCount[sMAX_NUM_TREE_LOD_LEVELS];
+S32 LLVOTree::sLODIndexOffset[sMAX_NUM_TREE_LOD_LEVELS];
+S32 LLVOTree::sLODIndexCount[sMAX_NUM_TREE_LOD_LEVELS];
+S32 LLVOTree::sLODSlices[sMAX_NUM_TREE_LOD_LEVELS] = {10, 5, 4, 3};
+F32 LLVOTree::sLODAngles[sMAX_NUM_TREE_LOD_LEVELS] = {30.f, 20.f, 15.f, 0.00001f};
 
 F32 LLVOTree::sTreeFactor = 1.f;
 
@@ -373,12 +375,11 @@ BOOL LLVOTree::idleUpdate(LLAgent &agent, LLWorld &world, const F64 &time)
 		}
 	}
 
-	S32 trunk_LOD = 0;
+	S32 trunk_LOD = sMAX_NUM_TREE_LOD_LEVELS ;
 	F32 app_angle = getAppAngle()*LLVOTree::sTreeFactor;
 
-	for (S32 j = 0; j < 4; j++)
+	for (S32 j = 0; j < sMAX_NUM_TREE_LOD_LEVELS; j++)
 	{
-
 		if (app_angle > LLVOTree::sLODAngles[j])
 		{
 			trunk_LOD = j;
@@ -445,16 +446,15 @@ void LLVOTree::setPixelAreaAndAngle(LLAgent &agent)
 	
 	// This should be the camera's center, as soon as we move to all region-local.
 	LLVector3 relative_position = getPositionAgent() - gAgentCamera.getCameraPositionAgent();
-	F32 range = relative_position.length();				// ugh, square root
+	F32 range_squared = relative_position.lengthSquared() ;				
 
 	F32 max_scale = mBillboardScale * getMaxScale();
 	F32 area = max_scale * (max_scale*mBillboardRatio);
 
 	// Compute pixels per meter at the given range
-	F32 pixels_per_meter = LLViewerCamera::getInstance()->getViewHeightInPixels() / 
-						   (tan(LLViewerCamera::getInstance()->getView()) * range);
+	F32 pixels_per_meter = LLViewerCamera::getInstance()->getViewHeightInPixels() / tan(LLViewerCamera::getInstance()->getView());
 
-	mPixelArea = (pixels_per_meter) * (pixels_per_meter) * area;
+	mPixelArea = (pixels_per_meter) * (pixels_per_meter) * area / range_squared;
 #if 0
 	// mAppAngle is a bit of voodoo;
 	// use the one calculated LLViewerObject::setPixelAreaAndAngle above
@@ -506,6 +506,13 @@ BOOL LLVOTree::updateGeometry(LLDrawable *drawable)
 {
 	LLFastTimer ftm(FTM_UPDATE_TREE);
 
+	if(mTrunkLOD >= sMAX_NUM_TREE_LOD_LEVELS) //do not display the tree.
+	{
+		mReferenceBuffer = NULL ;
+		mDrawable->getFace(0)->mVertexBuffer = NULL ;
+		return TRUE ;
+	}
+
 	if (mReferenceBuffer.isNull() || mDrawable->getFace(0)->mVertexBuffer.isNull())
 	{
 		const F32 SRR3 = 0.577350269f; // sqrt(1/3)
@@ -523,7 +530,7 @@ BOOL LLVOTree::updateGeometry(LLDrawable *drawable)
 		face->mCenterAgent = getPositionAgent();
 		face->mCenterLocal = face->mCenterAgent;
 
-		for (lod = 0; lod < 4; lod++)
+		for (lod = 0; lod < sMAX_NUM_TREE_LOD_LEVELS; lod++)
 		{
 			slices = sLODSlices[lod];
 			sLODVertexOffset[lod] = max_vertices;
@@ -700,7 +707,7 @@ BOOL LLVOTree::updateGeometry(LLDrawable *drawable)
 		// Generate the vertices
 		// Generate the indices
 
-		for (lod = 0; lod < 4; lod++)
+		for (lod = 0; lod < sMAX_NUM_TREE_LOD_LEVELS; lod++)
 		{
 			slices = sLODSlices[lod];
 			F32 base_radius = 0.65f;
@@ -892,7 +899,6 @@ void LLVOTree::updateMesh()
 	S32 stop_depth = 0;
 	F32 alpha = 1.0;
 	
-
 	U32 vert_count = 0;
 	U32 index_count = 0;
 	
diff --git a/indra/newview/llvotree.h b/indra/newview/llvotree.h
index feac9e0675e2b1c0a6c9c9ec3e3110e90aa21276..036ad692b1700b1db30361130f7feb07ec5b42f1 100644
--- a/indra/newview/llvotree.h
+++ b/indra/newview/llvotree.h
@@ -152,6 +152,7 @@ class LLVOTree : public LLViewerObject
 	};
 
 	static F32 sTreeFactor;			// Tree level of detail factor
+	static const S32 sMAX_NUM_TREE_LOD_LEVELS ;
 
 	friend class LLDrawPoolTree;
 protected:
diff --git a/indra/newview/llwearable.cpp b/indra/newview/llwearable.cpp
index 28613c8bcf456d886276b53ffe3fd9c5c7e0a79d..10b9a18fa8ef6061cc46f9b18d7b49daedc0572d 100644
--- a/indra/newview/llwearable.cpp
+++ b/indra/newview/llwearable.cpp
@@ -442,7 +442,7 @@ BOOL LLWearable::importFile( LLFILE* file )
 			delete mSavedTEMap[te];
 		}
 
-		image->setLoadedCallback(LLVOAvatarSelf::onTimingLocalTexLoaded,0,TRUE,FALSE, new LLVOAvatarSelf::LLAvatarTexData(id, (LLVOAvatarDefines::ETextureIndex)te));
+		image->setLoadedCallback(LLVOAvatarSelf::debugOnTimingLocalTexLoaded,0,TRUE,FALSE, new LLVOAvatarSelf::LLAvatarTexData(id, (LLVOAvatarDefines::ETextureIndex)te));
 
 
 		LLUUID textureid(text_buffer);
@@ -759,12 +759,12 @@ void LLWearable::copyDataFrom(const LLWearable* src)
 			LLViewerFetchedTexture *image = NULL;
 			if(iter != src->mTEMap.end())
 			{
-				image = src->getConstLocalTextureObject(te)->getImage();
-				image_id = src->getConstLocalTextureObject(te)->getID();
+				image = src->getLocalTextureObject(te)->getImage();
+				image_id = src->getLocalTextureObject(te)->getID();
 				mTEMap[te] = new LLLocalTextureObject(image, image_id);
 				mSavedTEMap[te] = new LLLocalTextureObject(image, image_id);
-				mTEMap[te]->setBakedReady(src->getConstLocalTextureObject(te)->getBakedReady());
-				mTEMap[te]->setDiscard(src->getConstLocalTextureObject(te)->getDiscard());
+				mTEMap[te]->setBakedReady(src->getLocalTextureObject(te)->getBakedReady());
+				mTEMap[te]->setDiscard(src->getLocalTextureObject(te)->getDiscard());
 			}
 			else
 			{
@@ -809,7 +809,7 @@ LLLocalTextureObject* LLWearable::getLocalTextureObject(S32 index)
 	return NULL;
 }
 
-const LLLocalTextureObject* LLWearable::getConstLocalTextureObject(S32 index) const
+const LLLocalTextureObject* LLWearable::getLocalTextureObject(S32 index) const
 {
 	te_map_t::const_iterator iter = mTEMap.find(index);
 	if( iter != mTEMap.end() )
diff --git a/indra/newview/llwearable.h b/indra/newview/llwearable.h
index 458415228f0a1abd5036e6ec7d0c745fbf6c0494..6b6067fd27cee241b5faca2419beb5a645294928 100644
--- a/indra/newview/llwearable.h
+++ b/indra/newview/llwearable.h
@@ -81,7 +81,6 @@ class LLWearable
 	const std::string&			getTypeLabel() const;
 	const std::string&			getTypeName() const;
 	LLAssetType::EType			getAssetType() const;
-	LLLocalTextureObject*		getLocalTextureObject(S32 index) const;
 	S32							getDefinitionVersion() const { return mDefinitionVersion; }
 	void						setDefinitionVersion( S32 new_version ) { mDefinitionVersion = new_version; }
 
@@ -112,7 +111,7 @@ class LLWearable
 	void				setItemID(const LLUUID& item_id);
 
 	LLLocalTextureObject* getLocalTextureObject(S32 index);
-	const LLLocalTextureObject* getConstLocalTextureObject(S32 index) const;
+	const LLLocalTextureObject* getLocalTextureObject(S32 index) const;
 
 	void				setLocalTextureObject(S32 index, LLLocalTextureObject &lto);
 	void				addVisualParam(LLVisualParam *param);
diff --git a/indra/newview/llwearableitemslist.cpp b/indra/newview/llwearableitemslist.cpp
index b209dfecce7b55a1d6a495756cd9a98fd15ff502..fb7577c00835e82aced109d14aa97833469c3f76 100644
--- a/indra/newview/llwearableitemslist.cpp
+++ b/indra/newview/llwearableitemslist.cpp
@@ -35,8 +35,11 @@
 
 #include "lliconctrl.h"
 
+#include "llagentwearables.h"
+#include "llappearancemgr.h"
 #include "llinventoryfunctions.h"
 #include "llinventorymodel.h"
+#include "llmenugl.h" // for LLContextMenu
 #include "lltransutil.h"
 
 class LLFindOutfitItems : public LLInventoryCollectFunctor
@@ -377,12 +380,17 @@ static const LLWearableItemTypeNameComparator WEARABLE_TYPE_NAME_COMPARATOR;
 static const LLDefaultChildRegistry::Register<LLWearableItemsList> r("wearable_items_list");
 
 LLWearableItemsList::Params::Params()
+:	use_internal_context_menu("use_internal_context_menu", true)
 {}
 
 LLWearableItemsList::LLWearableItemsList(const LLWearableItemsList::Params& p)
 :	LLInventoryItemsList(p)
 {
 	setComparator(&WEARABLE_TYPE_NAME_COMPARATOR);
+	if (p.use_internal_context_menu)
+	{
+		setRightMouseDownCallback(boost::bind(&LLWearableItemsList::onRightClick, this, _2, _3));
+	}
 }
 
 // virtual
@@ -406,4 +414,140 @@ void LLWearableItemsList::updateList(const LLUUID& category_id)
 	refreshList(item_array);
 }
 
+void LLWearableItemsList::onRightClick(S32 x, S32 y)
+{
+	uuid_vec_t selected_uuids;
+
+	getSelectedUUIDs(selected_uuids);
+	if (selected_uuids.empty())
+	{
+		return;
+	}
+
+	ContextMenu::instance().show(this, selected_uuids, x, y);
+}
+
+//////////////////////////////////////////////////////////////////////////
+/// ContextMenu
+//////////////////////////////////////////////////////////////////////////
+
+// virtual
+LLContextMenu* LLWearableItemsList::ContextMenu::createMenu()
+{
+	LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar;
+	const uuid_vec_t& ids = mUUIDs;		// selected items IDs
+	LLUUID selected_id = ids.front();	// ID of the first selected item
+
+	functor_t wear = boost::bind(&LLAppearanceMgr::wearItemOnAvatar, LLAppearanceMgr::getInstance(), _1, true, false);
+	functor_t take_off = boost::bind(&LLAppearanceMgr::removeItemFromAvatar, LLAppearanceMgr::getInstance(), _1);
+
+	// Register handlers common for all wearable types.
+	registrar.add("Wearable.Wear", boost::bind(handleMultiple, wear, ids));
+	registrar.add("Wearable.Edit", boost::bind(handleMultiple, LLAgentWearables::editWearable, ids));
+	registrar.add("Wearable.ShowOriginal", boost::bind(show_item_original, selected_id));
+
+	// Register handlers for clothing.
+	registrar.add("Clothing.TakeOff", boost::bind(handleMultiple, take_off, ids));
+
+	// Register handlers for body parts.
+
+	// Register handlers for attachments.
+	registrar.add("Attachment.Detach", boost::bind(handleMultiple, take_off, ids));
+	registrar.add("Attachment.Profile", boost::bind(show_item_profile, selected_id));
+
+	// Create the menu.
+	LLContextMenu* menu = createFromFile("menu_wearable_list_item.xml");
+
+	// Determine which items should be visible/enabled.
+	updateItemsVisibility(menu);
+	return menu;
+}
+
+void LLWearableItemsList::ContextMenu::updateItemsVisibility(LLContextMenu* menu)
+{
+	if (!menu)
+	{
+		llwarns << "Invalid menu" << llendl;
+		return;
+	}
+
+	const uuid_vec_t& ids = mUUIDs;	// selected items IDs
+	U32 mask = 0;					// mask of selected items' types
+	U32 nitems = ids.size();		// number of selected items
+	U32 nworn = 0;					// number of worn items among the selected ones
+	U32 nwornlinks = 0;				// number of worn links among the selected items
+	U32 neditable = 0;				// number of editable items among the selected ones
+
+	for (uuid_vec_t::const_iterator it = ids.begin(); it != ids.end(); ++it)
+	{
+		LLUUID id = *it;
+		LLViewerInventoryItem* item = gInventory.getItem(id);
+
+		if (!item)
+		{
+			llwarns << "Invalid item" << llendl;
+			// *NOTE: the logic below may not work in this case
+			continue;
+		}
+
+		updateMask(mask, item->getType());
+
+		bool is_link = item->getIsLinkType();
+		bool is_worn = get_is_item_worn(id);
+		bool is_editable = gAgentWearables.isWearableModifiable(id);
+
+		if (is_worn)
+		{
+			++nworn;
+
+			if (is_link)
+			{
+				++nwornlinks;
+			}
+		}
+		if (is_editable)
+		{
+			++neditable;
+		}
+	} // for
+
+	// *TODO: eliminate multiple traversals over the menu items
+	// *TODO: try disabling items rather than hiding them
+	// *FIX:  we may hide *all* items and thus get an ugly empty menu
+	setMenuItemVisible(menu, "wear",			nworn == 0);
+	setMenuItemVisible(menu, "edit",			mask & (MASK_CLOTHING|MASK_BODYPART) && nitems == 1 && neditable == 1);
+	setMenuItemVisible(menu, "show_original",	nitems == 1 && nwornlinks == nitems);
+	setMenuItemVisible(menu, "take_off",		mask == MASK_CLOTHING && nworn == nitems); // selected only worn clothes
+	setMenuItemVisible(menu, "detach",			mask == MASK_ATTACHMENT && nworn == nitems);
+	setMenuItemVisible(menu, "object_profile",	mask == MASK_ATTACHMENT && nitems == 1);
+}
+
+// We need this method to convert non-zero BOOL values to exactly 1 (TRUE).
+// Otherwise code relying on a BOOL value being TRUE may fail
+// (I experienced a weird assert in LLView::drawChildren() because of that.
+void LLWearableItemsList::ContextMenu::setMenuItemVisible(LLContextMenu* menu, const std::string& name, bool val)
+{
+	menu->setItemVisible(name, val);
+}
+
+void LLWearableItemsList::ContextMenu::updateMask(U32& mask, LLAssetType::EType at)
+{
+	if (at == LLAssetType::AT_CLOTHING)
+	{
+		mask |= MASK_CLOTHING;
+	}
+	else if (at == LLAssetType::AT_BODYPART)
+	{
+		mask |= MASK_BODYPART;
+	}
+	else if (at == LLAssetType::AT_OBJECT)
+	{
+		mask |= MASK_ATTACHMENT;
+	}
+	else
+	{
+		llwarns << "Unsupported asset type: " << at << llendl;
+	}
+}
+
 // EOF
diff --git a/indra/newview/llwearableitemslist.h b/indra/newview/llwearableitemslist.h
index 2cab5a07a2b9380ed809861d1b9149e52b27bbb9..7ad1b5a3ad804cc554d78e90844e87a571f33d72 100644
--- a/indra/newview/llwearableitemslist.h
+++ b/indra/newview/llwearableitemslist.h
@@ -32,11 +32,14 @@
 #ifndef LL_LLWEARABLEITEMSLIST_H
 #define LL_LLWEARABLEITEMSLIST_H
 
+// libs
 #include "llpanel.h"
+#include "llsingleton.h"
 
 // newview
 #include "llinventoryitemslist.h"
 #include "llinventorymodel.h"
+#include "lllistcontextmenu.h"
 #include "llwearabletype.h"
 
 /**
@@ -274,8 +277,32 @@ class LLWearableItemTypeNameComparator : public LLWearableItemNameComparator
 class LLWearableItemsList : public LLInventoryItemsList
 {
 public:
+	/**
+	 * Context menu.
+	 * 
+	 * This menu is likely to be used from outside
+	 * (e.g. for items selected across multiple wearable lists),
+	 * so making it a singleton.
+	 */
+	class ContextMenu : public LLListContextMenu, public LLSingleton<ContextMenu>
+	{
+	protected:
+		enum {
+			MASK_CLOTHING		= 0x01,
+			MASK_BODYPART		= 0x02,
+			MASK_ATTACHMENT		= 0x04,
+		};
+
+		/* virtual */ LLContextMenu* createMenu();
+		void updateItemsVisibility(LLContextMenu* menu);
+		void setMenuItemVisible(LLContextMenu* menu, const std::string& name, bool val);
+		void updateMask(U32& mask, LLAssetType::EType at);
+	};
+
 	struct Params : public LLInitParam::Block<Params, LLInventoryItemsList::Params>
 	{
+		Optional<bool> use_internal_context_menu;
+
 		Params();
 	};
 
@@ -286,6 +313,8 @@ class LLWearableItemsList : public LLInventoryItemsList
 protected:
 	friend class LLUICtrlFactory;
 	LLWearableItemsList(const LLWearableItemsList::Params& p);
+
+	void onRightClick(S32 x, S32 y);
 };
 
 #endif //LL_LLWEARABLEITEMSLIST_H
diff --git a/indra/newview/llxmlrpctransaction.cpp b/indra/newview/llxmlrpctransaction.cpp
index da61840761adf6299f87ea6d08940eb52d0d7e70..bc7f8ec854a02a9839ce1fe54110e6b807a01321 100644
--- a/indra/newview/llxmlrpctransaction.cpp
+++ b/indra/newview/llxmlrpctransaction.cpp
@@ -45,6 +45,7 @@
 #include <xmlrpc-epi/xmlrpc.h>
 
 #include "llappviewer.h"
+#include "lltrans.h"
 
 // Static instance of LLXMLRPCListener declared here so that every time we
 // bring in this code, we instantiate a listener. If we put the static
@@ -510,11 +511,7 @@ void LLXMLRPCTransaction::Impl::setStatus(EStatus status,
 			default:
 				// Usually this means that there's a problem with the login server,
 				// not with the client.  Direct user to status page.
-				mStatusMessage =
-					"Despite our best efforts, something unexpected has gone wrong. \n"
-					" \n"
-					"Please check secondlife.com/status \n"
-					"to see if there is a known problem with the service.";
+				mStatusMessage = LLTrans::getString("server_is_down");
 
 				mStatusURI = "http://secondlife.com/status/";
 		}
diff --git a/indra/newview/skins/default/textures/textures.xml b/indra/newview/skins/default/textures/textures.xml
index 0788a0ca9ed0d0d2fa58b300a6235c041f8f7bbb..2c1cb5938771759f92a6c4cf556ab7d6aa192c0d 100644
--- a/indra/newview/skins/default/textures/textures.xml
+++ b/indra/newview/skins/default/textures/textures.xml
@@ -649,4 +649,9 @@ with the same filename but different name
   <texture name="Progress_11" file_name="icons/Progress_11.png" preload="true" />
   <texture name="Progress_12" file_name="icons/Progress_12.png" preload="true" />
 
+  <texture name="bevel_background" file_name="widgets/bevel_background.png" preload="true" scale.left="12" scale.top="15" scale.right="120" scale.bottom="2"/>
+  <texture name="buy_off" file_name="widgets/buy_off.png" preload="true" scale.left="2" scale.top="15" scale.right="67" scale.bottom="4"/>
+  <texture name="buy_over" file_name="widgets/buy_over.png" preload="true" scale.left="2" scale.top="15" scale.right="67" scale.bottom="4"/>
+  <texture name="buy_press" file_name="widgets/buy_press.png" preload="true" scale.left="2" scale.top="15" scale.right="67" scale.bottom="4"/>
+  
 </textures>
diff --git a/indra/newview/skins/default/textures/widgets/bevel_background.png b/indra/newview/skins/default/textures/widgets/bevel_background.png
new file mode 100644
index 0000000000000000000000000000000000000000..fb5067503dea1616256ce018d8a795778ca7cb3c
Binary files /dev/null and b/indra/newview/skins/default/textures/widgets/bevel_background.png differ
diff --git a/indra/newview/skins/default/textures/widgets/buy_off.png b/indra/newview/skins/default/textures/widgets/buy_off.png
new file mode 100644
index 0000000000000000000000000000000000000000..961ad071d4242cf7928137525ad1846d002dff48
Binary files /dev/null and b/indra/newview/skins/default/textures/widgets/buy_off.png differ
diff --git a/indra/newview/skins/default/textures/widgets/buy_over.png b/indra/newview/skins/default/textures/widgets/buy_over.png
new file mode 100644
index 0000000000000000000000000000000000000000..0be19f8a31a51ece6397d0f12579c889fa9699e8
Binary files /dev/null and b/indra/newview/skins/default/textures/widgets/buy_over.png differ
diff --git a/indra/newview/skins/default/textures/widgets/buy_press.png b/indra/newview/skins/default/textures/widgets/buy_press.png
new file mode 100644
index 0000000000000000000000000000000000000000..d6f587464db39abee6592da3119ea666ee7378b8
Binary files /dev/null and b/indra/newview/skins/default/textures/widgets/buy_press.png differ
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 20e7c28db0ee04c4666ea69a25dcf9fe650dfcc8..5f28fa6495c0a531a700baef9c0da69ec0638d56 100644
--- a/indra/newview/skins/default/xui/en/floater_about_land.xml
+++ b/indra/newview/skins/default/xui/en/floater_about_land.xml
@@ -1933,7 +1933,7 @@ Only large parcels can be listed in search.
              left_delta="20"
              name="Only Allow"
              top="49"
-             width="278">
+             width="325">
                 Restrict Access to Residents verified by:
             </text>
             <check_box
diff --git a/indra/newview/skins/default/xui/en/floater_avatar_textures.xml b/indra/newview/skins/default/xui/en/floater_avatar_textures.xml
index 119dd63a17a2689b52e4baa352473457aa792f4e..bac3ea86f1fa7a59f7ecb4acea6585e3903f082d 100644
--- a/indra/newview/skins/default/xui/en/floater_avatar_textures.xml
+++ b/indra/newview/skins/default/xui/en/floater_avatar_textures.xml
@@ -1,12 +1,12 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
 <floater
  legacy_header_height="18"
- height="990"
+ height="700"
  layout="topleft"
  name="avatar_texture_debug"
  help_topic="avatar_texture_debug"
  title="AVATAR TEXTURES"
- width="1240"
+ width="940"
  can_resize="true">
     <floater.string
      name="InvalidAvatar">
@@ -17,13 +17,13 @@
      color="DkGray2"
      opaque="true"
      follows="all"
-     height="970"
+     height="680"
      layout="topleft"
      left="5"
      top_pad="15"
      name="profile_scroll"
      reserve_scroll_corner="false"
-     width="1235">
+     width="930">
     <panel
      name="scroll_content_panel"
      follows="left|top"
@@ -31,39 +31,40 @@
      layout="topleft"
      top="0"
      background_visible="false"
-     height="950"
      left="0"
-     width="1230">
+	 height="680">
     <text
      type="string"
      length="1"
      height="16"
      layout="topleft"
-     left="30"
+     left="15"
      name="label"
      top="20"
-     width="80">
-        Baked Textures
+     width="90">
+        Baked
+Textures
     </text>
     <text
      type="string"
      length="1"
      height="16"
      layout="topleft"
-     left_pad="50"
+     left_pad="22"
      name="composite_label"
      top_delta="0"
      width="120">
-        Composite Textures
+        Composite
+Textures
     </text>
     <button
-     height="20"
+     height="40"
      label="Dump IDs to Console"
      label_selected="Dump"
      layout="topleft"
-     left_pad="530"
      name="Dump"
      top_delta="0"
+	 right="-10"
      width="150" />
 
     <panel
@@ -78,242 +79,242 @@
      width="1230">
 
     <texture_picker
-     height="143"
+     height="103"
      label="Hair"
      layout="topleft"
      left="10"
      name="hair-baked"
      top="17"
-     width="128" />
+     width="92" />
     <texture_picker
-     height="143"
+     height="103"
      label="Hair"
      layout="topleft"
-     left_pad="7"
+     left_pad="21"
      name="hair_grain"
      top_delta="0"
-     width="128" />
+     width="92" />
     <texture_picker
-     height="143"
+     height="103"
      label="Hair Alpha"
      layout="topleft"
      left_pad="7"
      name="hair_alpha"
      top_delta="0"
-     width="128" />
+     width="92" />
 
     <texture_picker
-     height="143"
+     height="103"
      label="Head"
      layout="topleft"
      left="10"
      name="head-baked"
-     top="167"
-     width="128" />
+     top_delta="100"
+     width="92" />
     <texture_picker
-     height="143"
+     height="103"
      label="Makeup"
      layout="topleft"
-     left_pad="7"
+     left_pad="21"
      name="head_bodypaint"
      top_delta="0"
-     width="128" />
+     width="92" />
     <texture_picker
-     height="143"
+     height="103"
      label="Head Alpha"
      layout="topleft"
      left_pad="7"
      name="head_alpha"
      top_delta="0"
-     width="128" />
+     width="92" />
     <texture_picker
-     height="143"
+     height="103"
      label="Head Tattoo"
      layout="topleft"
      left_pad="7"
      name="head_tattoo"
      top_delta="0"
-     width="128" />
+     width="92" />
 
     <texture_picker
-     height="143"
+     height="103"
      label="Eyes"
      layout="topleft"
      left="10"
      name="eyes-baked"
-     top="317"
-     width="128" />
+     top_delta="100"
+     width="92" />
     <texture_picker
-     height="143"
+     height="103"
      label="Eye"
      layout="topleft"
-     left_pad="7"
+     left_pad="21"
      name="eyes_iris"
      top_delta="0"
-     width="128" />
+     width="92" />
     <texture_picker
-     height="143"
+     height="103"
      label="Eyes Alpha"
      layout="topleft"
      left_pad="7"
      name="eyes_alpha"
      top_delta="0"
-     width="128" />
+     width="92" />
 
     <texture_picker
-     height="143"
+     height="103"
      label="Upper Body"
      layout="topleft"
      left="10"
      name="upper-baked"
-     top="467"
-     width="128" />
+     top_delta="100"
+     width="92" />
     <texture_picker
-     height="143"
-     label="Upper Body Bodypaint"
+     height="103"
+     label="Upper BodyPaint"
      layout="topleft"
-     left_pad="7"
+     left_pad="21"
      name="upper_bodypaint"
      top_delta="0"
-     width="128" />
+     width="92" />
     <texture_picker
-     height="143"
+     height="103"
      label="Undershirt"
      layout="topleft"
      left_pad="7"
      name="upper_undershirt"
      top_delta="0"
-     width="128" />
+     width="92" />
     <texture_picker
-     height="143"
+     height="103"
      label="Gloves"
      layout="topleft"
      left_pad="7"
      name="upper_gloves"
      top_delta="0"
-     width="128" />
+     width="92" />
     <texture_picker
-     height="143"
+     height="103"
      label="Shirt"
      layout="topleft"
      left_pad="7"
      name="upper_shirt"
      top_delta="0"
-     width="128" />
+     width="92" />
     <texture_picker
-     height="143"
+     height="103"
      label="Upper Jacket"
      layout="topleft"
      left_pad="7"
      name="upper_jacket"
      top_delta="0"
-     width="128" />
+     width="92" />
     <texture_picker
-     height="143"
+     height="103"
      label="Upper Alpha"
      layout="topleft"
      left_pad="7"
      name="upper_alpha"
      top_delta="0"
-     width="128" />
+     width="92" />
     <texture_picker
-     height="143"
+     height="103"
      label="Upper Tattoo"
      layout="topleft"
      left_pad="7"
      name="upper_tattoo"
      top_delta="0"
-     width="128" />
+     width="92" />
 
     <texture_picker
-     height="143"
+     height="103"
      label="Lower Body"
      layout="topleft"
      left="10"
      name="lower-baked"
-     top="617"
-     width="128" />
+     top_delta="100"
+     width="92" />
     <texture_picker
-     height="143"
-     label="Lower Body Bodypaint"
+     height="103"
+     label="Lower BodyPaint"
      layout="topleft"
-     left_pad="7"
+     left_pad="21"
      name="lower_bodypaint"
      top_delta="0"
-     width="128" />
+     width="92" />
     <texture_picker
-     height="143"
+     height="103"
      label="Underpants"
      layout="topleft"
      left_pad="7"
      name="lower_underpants"
      top_delta="0"
-     width="128" />
+     width="92" />
     <texture_picker
-     height="143"
+     height="103"
      label="Socks"
      layout="topleft"
      left_pad="7"
      name="lower_socks"
      top_delta="0"
-     width="128" />
+     width="92" />
     <texture_picker
-     height="143"
+     height="103"
      label="Shoes"
      layout="topleft"
      left_pad="7"
      name="lower_shoes"
      top_delta="0"
-     width="128" />
+     width="92" />
     <texture_picker
-     height="143"
+     height="103"
      label="Pants"
      layout="topleft"
      left_pad="7"
      name="lower_pants"
      top_delta="0"
-     width="128" />
+     width="92" />
     <texture_picker
-     height="143"
+     height="103"
      label="Jacket"
      layout="topleft"
      left_pad="7"
      name="lower_jacket"
      top_delta="0"
-     width="128" />
+     width="92" />
     <texture_picker
-     height="143"
+     height="103"
      label="Lower Alpha"
      layout="topleft"
      left_pad="7"
      name="lower_alpha"
      top_delta="0"
-     width="128" />
+     width="92" />
     <texture_picker
-     height="143"
+     height="103"
      label="Lower Tattoo"
      layout="topleft"
      left_pad="7"
      name="lower_tattoo"
      top_delta="0"
-     width="128" />
+     width="92" />
 
     <texture_picker
-     height="143"
+     height="103"
      label="Skirt"
      layout="topleft"
      left="10"
      name="skirt-baked"
-     top="767"
-     width="128" />
+     top_delta="100"
+     width="92" />
     <texture_picker
-     height="143"
+     height="103"
      label="Skirt"
      layout="topleft"
-     left_pad="7"
+     left_pad="21"
      name="skirt"
      top_delta="0"
-     width="128" />
+     width="92" />
 </panel>
 </panel>
 </scroll_container>
diff --git a/indra/newview/skins/default/xui/en/floater_buy_currency_html.xml b/indra/newview/skins/default/xui/en/floater_buy_currency_html.xml
new file mode 100644
index 0000000000000000000000000000000000000000..4643f66bd897bd8471c863619f5549acd430465c
--- /dev/null
+++ b/indra/newview/skins/default/xui/en/floater_buy_currency_html.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
+<floater
+ legacy_header_height="18"
+ can_resize="false"
+ height="280"
+ layout="topleft"
+ min_height="280"
+ min_width="450"
+ name="floater_buy_currency_html"
+ help_topic="floater_buy_currency_html"
+ save_rect="true"
+ single_instance="true"
+ title="BUY CURRENCY"
+ width="452">
+ <floater.string
+      name="buy_currency_url" translate="false">
+        https://quick-buy-www.jeff.ooze.lindenlab.com/en/display
+ </floater.string>
+    <web_browser
+     bottom="278"
+     follows="left|right|top|bottom"
+     layout="topleft"
+     left="2"
+     name="browser"
+     top="18"
+     width="450" />
+</floater>
diff --git a/indra/newview/skins/default/xui/en/inspect_group.xml b/indra/newview/skins/default/xui/en/inspect_group.xml
index 37ae5a64d7e01b422a49397834bacdb8b6ddb65f..bcdb63228da89f96bb1dce46bd56ec2ab55ee838 100644
--- a/indra/newview/skins/default/xui/en/inspect_group.xml
+++ b/indra/newview/skins/default/xui/en/inspect_group.xml
@@ -79,7 +79,7 @@ L$123 to join
    height="23"
    label="Join"
    left="8"
-   top="286"
+   top="125"
    name="join_btn"
    width="103"
    commit_callback.function="InspectGroup.Join"/>
@@ -88,7 +88,7 @@ L$123 to join
    height="23"
    label="Leave"
    left="8"
-   top="286"
+   top="125"
    name="leave_btn"
    width="103"
    commit_callback.function="InspectGroup.Leave"/>
@@ -97,7 +97,7 @@ L$123 to join
      height="23"
      label="View Profile"
      name="view_profile_btn"
-     top="286"
+     top="125"
      left="117"
      width="103"
      commit_callback.function="InspectGroup.ViewProfile" />
diff --git a/indra/newview/skins/default/xui/en/menu_avatar_self.xml b/indra/newview/skins/default/xui/en/menu_avatar_self.xml
index b0cfb261cb8831535ca38703b52e5b8c6e21457d..d5b993152a5374bbfafe973e9b8ebbd5e789abc8 100644
--- a/indra/newview/skins/default/xui/en/menu_avatar_self.xml
+++ b/indra/newview/skins/default/xui/en/menu_avatar_self.xml
@@ -191,8 +191,15 @@
         <menu_item_call.on_enable
          function="Edit.EnableCustomizeAvatar" />
     </menu_item_call>
-    <menu_item_call
-    label="Edit My Shape"
+    <menu_item_call label="Edit My Outfit" 
+    layout="topleft"
+    name="Edit Outfit">
+       <menu_item_call.on_click
+        function="EditOutfit" />
+       <menu_item_call.on_enable
+        function="Edit.EnableCustomizeAvatar" />
+   </menu_item_call>
+    <menu_item_call label="Edit My Shape" 
     layout="topleft"
     name="Edit My Shape">
        <menu_item_call.on_click
diff --git a/indra/newview/skins/default/xui/en/menu_cof_attachment.xml b/indra/newview/skins/default/xui/en/menu_cof_attachment.xml
new file mode 100644
index 0000000000000000000000000000000000000000..b422d87938bf4f14f6950c2d1e2fe7ea4289bf28
--- /dev/null
+++ b/indra/newview/skins/default/xui/en/menu_cof_attachment.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
+<context_menu
+ layout="topleft"
+ name="COF Attachment">
+    <menu_item_call
+     label="Detach"
+     layout="topleft"
+     name="detach">
+        <on_click
+         function="Attachment.Detach"
+         parameter="detach"/>
+    </menu_item_call>
+    <context_menu
+     label="Attach to"
+     layout="topleft"
+     name="attach_to" />
+    <context_menu
+     label="Attach to HUD"
+     layout="topleft"
+     name="attach_to_hud" />
+</context_menu>
diff --git a/indra/newview/skins/default/xui/en/menu_cof_body_part.xml b/indra/newview/skins/default/xui/en/menu_cof_body_part.xml
new file mode 100644
index 0000000000000000000000000000000000000000..01008ef203c3ba1ec7397e52789359059540e4fa
--- /dev/null
+++ b/indra/newview/skins/default/xui/en/menu_cof_body_part.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
+<context_menu
+ layout="topleft"
+ name="COF Body">
+    <menu_item_call
+     label="Replace"
+     layout="topleft"
+     name="replace">
+        <on_click
+         function="BodyPart.Replace"/>
+    </menu_item_call>
+    <menu_item_call
+     label="Edit"
+     layout="topleft"
+     name="edit">
+        <on_click
+         function="BodyPart.Edit"/>
+        <on_enable
+         function="BodyPart.OnEnable"
+         parameter="edit" />
+    </menu_item_call>
+</context_menu>
diff --git a/indra/newview/skins/default/xui/en/menu_cof_clothing.xml b/indra/newview/skins/default/xui/en/menu_cof_clothing.xml
new file mode 100644
index 0000000000000000000000000000000000000000..f9cb29f0d714adbcfac8915738998724adc389c7
--- /dev/null
+++ b/indra/newview/skins/default/xui/en/menu_cof_clothing.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
+<context_menu
+ layout="topleft"
+ name="COF Clothing">
+    <menu_item_call
+     label="Take Off"
+     layout="topleft"
+     name="take_off">
+        <on_click
+         function="Clothing.TakeOff" />
+    </menu_item_call>
+    <menu_item_call
+     label="Move Up a Layer"
+     layout="topleft"
+     name="move_up">
+        <on_click
+         function="Clothing.MoveUp" />
+        <on_enable
+         function="Clothing.OnEnable"
+         parameter="move_up" />
+    </menu_item_call>
+    <menu_item_call
+     label="Move Down a Layer"
+     layout="topleft"
+     name="move_down">
+        <on_click
+         function="Clothing.MoveDown" />
+        <on_enable
+         function="Clothing.OnEnable"
+         parameter="move_down" />
+    </menu_item_call>
+    <menu_item_call
+     label="Edit"
+     layout="topleft"
+     name="edit">
+        <on_click
+         function="Clothing.Edit" />
+        <on_enable
+         function="Clothing.OnEnable"
+         parameter="edit" />
+    </menu_item_call>
+</context_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
new file mode 100644
index 0000000000000000000000000000000000000000..982d4f20153eb2d31d4a3a727466888d7c1f5357
--- /dev/null
+++ b/indra/newview/skins/default/xui/en/menu_cof_gear.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
+<menu
+ layout="topleft"
+ name="Gear COF">
+    <menu_item_call
+     label="Add To Outfit"
+     layout="topleft"
+     name="add">
+        <on_click
+         function="Gear.OnClick"
+         parameter="add"/>
+        <on_enable
+         function="Gear.OnEnable"
+         parameter="add" />
+    </menu_item_call>
+</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
new file mode 100644
index 0000000000000000000000000000000000000000..dfc72b557cc75b425159b4cf5fc078db3bb8993e
--- /dev/null
+++ b/indra/newview/skins/default/xui/en/menu_outfit_gear.xml
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
+<menu
+ layout="topleft"
+ name="Gear Outfit">
+    <menu_item_call
+     label="Wear - Replace Current Outfit"
+     layout="topleft"
+     name="wear">
+        <on_click
+         function="Gear.OnClick"
+         parameter="wear"/>
+        <on_enable
+         function="Gear.OnEnable"
+         parameter="wear" />
+    </menu_item_call>
+    <menu_item_call
+     label="Take Off - Remove Current Outfit"
+     layout="topleft"
+     name="take_off">
+        <on_click
+         function="Gear.OnClick"
+         parameter="take_off"/>
+        <on_enable
+         function="Gear.OnEnable"
+         parameter="take_off" />
+    </menu_item_call>
+    <menu_item_separator />
+    <menu_item_call
+     label="Rename"
+     layout="topleft"
+     name="rename">
+        <on_click
+         function="Gear.OnClick"
+         parameter="rename"/>
+        <on_enable
+         function="Gear.OnEnable"
+         parameter="rename" />
+    </menu_item_call>
+    <menu_item_call
+     label="Delete Outfit"
+     layout="topleft"
+     name="delete_outfit">
+        <on_click
+         function="Gear.OnClick"
+         parameter="delete_outfit"/>
+        <on_enable
+         function="Gear.OnEnable"
+         parameter="delete_outfit" />
+    </menu_item_call>
+</menu>
diff --git a/indra/newview/skins/default/xui/en/menu_outfit_tab.xml b/indra/newview/skins/default/xui/en/menu_outfit_tab.xml
new file mode 100644
index 0000000000000000000000000000000000000000..8f3e62157a9c2a19ef8bf207c498ca8722526490
--- /dev/null
+++ b/indra/newview/skins/default/xui/en/menu_outfit_tab.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
+<context_menu
+ layout="topleft"
+ name="Outfit">
+    <menu_item_call
+     label="Wear - Replace Current Outfit"
+     layout="topleft"
+     name="wear_replace">
+        <on_click
+         function="Outfit.WearReplace" />
+    </menu_item_call>
+    <menu_item_call
+     label="Wear - Add to Current Outfit"
+     layout="topleft"
+     name="wear_add">
+        <on_click
+         function="Outfit.WearAdd" />
+    </menu_item_call>
+    <menu_item_call
+     label="Take Off - Remove Current Outfit"
+     layout="topleft"
+     name="take_off">
+        <on_click
+         function="Outfit.TakeOff" />
+    </menu_item_call>
+    <menu_item_separator />
+    <menu_item_call
+     label="Rename"
+     layout="topleft"
+     name="rename">
+        <on_click
+         function="Outfit.Rename" />
+    </menu_item_call>
+    <menu_item_call
+     label="Delete Outfit"
+     layout="topleft"
+     name="delete">
+        <on_click
+         function="Outfit.Delete" />
+    </menu_item_call>
+</context_menu>
diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml
index 16c2581d63f4cc51f8068d188a7b76c3ed2f9f32..aff8f7ddf4c884bd78ddc49559ef40b9f84ed049 100644
--- a/indra/newview/skins/default/xui/en/menu_viewer.xml
+++ b/indra/newview/skins/default/xui/en/menu_viewer.xml
@@ -521,6 +521,52 @@
                 <menu_item_check.on_enable
                  function="Tools.EnableToolNotPie" />
             </menu_item_check>
+        <menu
+         create_jump_keys="true"
+         label="Select Linked Parts"
+         name="Select Linked Parts"
+         tear_off="true">
+            <menu_item_call
+             label="Select Next Part"
+             name="Select Next Part"
+	     shortcut="control|.">
+                <menu_item_call.on_click
+                 function="Tools.SelectNextPart"
+                 parameter="next" />
+                <menu_item_call.on_enable
+                 function="Tools.EnableSelectNextPart" />
+            </menu_item_call>
+            <menu_item_call
+             label="Select Previous Part"
+             name="Select Previous Part"
+	     shortcut="control|,">
+                <menu_item_call.on_click
+                 function="Tools.SelectNextPart"
+                 parameter="previous" />
+                <menu_item_call.on_enable
+                 function="Tools.EnableSelectNextPart" />
+            </menu_item_call>
+            <menu_item_call
+             label="Include Next Part"
+             name="Include Next Part"
+	     shortcut="control|shift|.">
+                <menu_item_call.on_click
+                 function="Tools.SelectNextPart"
+                 parameter="includenext" />
+                <menu_item_call.on_enable
+                 function="Tools.EnableSelectNextPart" />
+            </menu_item_call>
+            <menu_item_call
+             label="Include Previous Part"
+             name="Include Previous Part"
+	     shortcut="control|shift|,">
+                <menu_item_call.on_click
+                 function="Tools.SelectNextPart"
+                 parameter="includeprevious" />
+                <menu_item_call.on_enable
+                 function="Tools.EnableSelectNextPart" />
+            </menu_item_call>
+        </menu>
         <menu_item_separator/>
         <menu_item_call
            label="Focus on Selection"
@@ -764,49 +810,60 @@
         </menu>
         <menu
          create_jump_keys="true"
-         label="Select Linked Parts"
-         name="Select Linked Parts"
+         label="Upload"
+         layout="topleft"
+         name="Upload"
          tear_off="true">
             <menu_item_call
-             label="Select Next Part"
-             name="Select Next Part"
-	     shortcut="control|.">
+             label="Image (L$[COST])..."
+             layout="topleft"
+             name="Upload Image"
+             shortcut="control|U">
                 <menu_item_call.on_click
-                 function="Tools.SelectNextPart"
-                 parameter="next" />
+                 function="File.UploadImage"
+                 parameter="" />
                 <menu_item_call.on_enable
-                 function="Tools.EnableSelectNextPart" />
+                 function="File.EnableUpload" />
+                <menu_item_call.on_visible
+                 function="Upload.CalculateCosts"
+                 parameter="Upload Image" />
             </menu_item_call>
             <menu_item_call
-             label="Select Previous Part"
-             name="Select Previous Part"
-	     shortcut="control|,">
+             label="Sound (L$[COST])..."
+             layout="topleft"
+             name="Upload Sound">
                 <menu_item_call.on_click
-                 function="Tools.SelectNextPart"
-                 parameter="previous" />
+                 function="File.UploadSound"
+                 parameter="" />
                 <menu_item_call.on_enable
-                 function="Tools.EnableSelectNextPart" />
+                 function="File.EnableUpload" />
+                <menu_item_call.on_visible
+                 function="Upload.CalculateCosts"
+                 parameter="Upload Sound" />
             </menu_item_call>
             <menu_item_call
-             label="Include Next Part"
-             name="Include Next Part"
-	     shortcut="control|shift|.">
+             label="Animation (L$[COST])..."
+             layout="topleft"
+             name="Upload Animation">
                 <menu_item_call.on_click
-                 function="Tools.SelectNextPart"
-                 parameter="includenext" />
+                 function="File.UploadAnim"
+                 parameter="" />
                 <menu_item_call.on_enable
-                 function="Tools.EnableSelectNextPart" />
+                 function="File.EnableUpload" />
+                <menu_item_call.on_visible
+                 function="Upload.CalculateCosts"
+                 parameter="Upload Animation" />
             </menu_item_call>
             <menu_item_call
-             label="Include Previous Part"
-             name="Include Previous Part"
-	     shortcut="control|shift|,">
+             label="Bulk (L$[COST] per file)..."
+             layout="topleft"
+             name="Bulk Upload">
                 <menu_item_call.on_click
-                 function="Tools.SelectNextPart"
-                 parameter="includeprevious" />
-                <menu_item_call.on_enable
-                 function="Tools.EnableSelectNextPart" />
+                 function="File.UploadBulk"
+                 parameter="" />
             </menu_item_call>
+            <menu_item_separator
+             layout="topleft" />
         </menu>
     </menu>
     <menu
@@ -3210,4 +3267,4 @@
             </menu>
         </menu>
     </menu>
-</menu_bar>
+</menu_bar>
\ No newline at end of file
diff --git a/indra/newview/skins/default/xui/en/menu_wearable_list_item.xml b/indra/newview/skins/default/xui/en/menu_wearable_list_item.xml
new file mode 100644
index 0000000000000000000000000000000000000000..7ea7eaade5ace7b4e1d55f00528d64b9d2298c06
--- /dev/null
+++ b/indra/newview/skins/default/xui/en/menu_wearable_list_item.xml
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
+<context_menu
+ name="Outfit Wearable Context Menu">
+    <menu_item_call
+     label="Wear"
+     layout="topleft"
+     name="wear">
+        <on_click
+         function="Wearable.Wear" />
+    </menu_item_call>
+    <menu_item_call
+     label="Detach"
+     layout="topleft"
+     name="detach">
+        <on_click
+         function="Attachment.Detach" />
+    </menu_item_call>
+<!-- *TODO: implement the submenus
+    <menu
+     label="Attach to"
+     layout="topleft"
+     name="attach_to" />
+    <menu
+     label="Attach to HUD"
+     layout="topleft"
+     name="attach_to_hud" />
+-->
+    <menu_item_call
+     label="Object Profile"
+     layout="topleft"
+     name="object_profile">
+        <on_click
+         function="Attachment.Profile" />
+    </menu_item_call>
+    <menu_item_call
+     label="Take Off"
+     layout="topleft"
+     name="take_off">
+        <on_click
+         function="Clothing.TakeOff"
+         parameter="take_off"/>
+    </menu_item_call>
+    <menu_item_call
+     label="Edit"
+     layout="topleft"
+     name="edit">
+        <on_click
+         function="Wearable.Edit"
+         parameter="edit"/>
+    </menu_item_call>
+    <menu_item_call
+     label="Show Original"
+     layout="topleft"
+     name="show_original">
+        <on_click
+         function="Wearable.ShowOriginal" />
+    </menu_item_call>
+</context_menu>
diff --git a/indra/newview/skins/default/xui/en/outfit_accordion_tab.xml b/indra/newview/skins/default/xui/en/outfit_accordion_tab.xml
index 5fcc9b012b3074e9cdd6f93836e41ba190451c11..066992b25da5288e75bbf593e21e29b1b8492544 100644
--- a/indra/newview/skins/default/xui/en/outfit_accordion_tab.xml
+++ b/indra/newview/skins/default/xui/en/outfit_accordion_tab.xml
@@ -15,6 +15,7 @@
      allow_select="true"
      follows="all"
      keep_one_selected="true"
+     multi_select="true"
      name="wearable_items_list"
      translate="false"
     />
diff --git a/indra/newview/skins/default/xui/en/panel_bottomtray.xml b/indra/newview/skins/default/xui/en/panel_bottomtray.xml
index bfc40a863830b3046600e5fcd42919847405a09a..ac61c7da5d61adb457d94ec304bca5cdf3401ae6 100644
--- a/indra/newview/skins/default/xui/en/panel_bottomtray.xml
+++ b/indra/newview/skins/default/xui/en/panel_bottomtray.xml
@@ -67,7 +67,7 @@
          mouse_opaque="false"
          name="speak_panel"
          top_delta="0"
-         user_resize="false"
+         user_resize="true"
          width="110">
             <talk_button
              follows="left|right"
@@ -193,6 +193,7 @@
          min_width="40"
          mouse_opaque="false"
          name="snapshot_panel"
+         user_resize="false"
          width="39">
             <button
              follows="left|right"
diff --git a/indra/newview/skins/default/xui/en/panel_cof_wearables.xml b/indra/newview/skins/default/xui/en/panel_cof_wearables.xml
index 86b9ea6e14515abe83b20b33f6b9c48031224e9d..cf84c31078a2758687008b8abd432779e24dcb81 100644
--- a/indra/newview/skins/default/xui/en/panel_cof_wearables.xml
+++ b/indra/newview/skins/default/xui/en/panel_cof_wearables.xml
@@ -29,6 +29,7 @@
              height="10"
              layout="topleft"
              left="0"
+             multi_select="true"
              name="list_attachments"
              top="0"
              width="311" />
@@ -63,6 +64,7 @@
                  height="10"
                  layout="topleft"
                  left="0"
+                 multi_select="true"
                  name="list_clothing"
                  top_pad="0"
                  width="311" />
@@ -98,6 +100,7 @@
                  height="10"
                  layout="topleft"
                  left="0"
+                 multi_select="true"
                  name="list_body_parts"
                  top_pad="0"
                  width="311" />
diff --git a/indra/newview/skins/default/xui/en/panel_edit_shape.xml b/indra/newview/skins/default/xui/en/panel_edit_shape.xml
index 76842e527983081147cf2a1c3ed29f3b6dbf3358..cf15fb045562dea7ed1d3283c94267f7849a2bee 100644
--- a/indra/newview/skins/default/xui/en/panel_edit_shape.xml
+++ b/indra/newview/skins/default/xui/en/panel_edit_shape.xml
@@ -43,7 +43,7 @@
 		name="wearable_accordion"
 		top="0"
         single_expansion="true"
-        fit_parent="false"
+        fit_parent="true"
 		width="313">
 		<accordion_tab
 			layout="topleft"
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 b473a7a282b38b7d10646166c063263e88d29ad2..895cc4e3ccd4269bc31502a7380e115a7d766f20 100644
--- a/indra/newview/skins/default/xui/en/panel_outfit_edit.xml
+++ b/indra/newview/skins/default/xui/en/panel_outfit_edit.xml
@@ -336,6 +336,7 @@
 		              allow_select="true"
 		              layout="topleft"
 		              follows="all"
+		              multi_select="true"
 		              width="310"
 		              height="140"
 		              left="0"
diff --git a/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml b/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml
index 0a56f711ddd0f27929be368465edc52830c6b583..266fd6cb5e7e49393bbe871e9a19c9d2e4969acc 100644
--- a/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml
+++ b/indra/newview/skins/default/xui/en/panel_preferences_graphics1.xml
@@ -160,7 +160,7 @@
      layout="topleft"
      left="5"
      name="CustomGraphics Panel"
-     top="124"
+     top="76"
      width="485">
 		<text
 		type="string"
@@ -351,7 +351,7 @@
 		top_delta="0"
 		width="128">
 			m
-		</text>
+		</text>    
 		<slider
 		control_name="RenderMaxPartCount"
 		decimal_digits="0"
@@ -367,6 +367,34 @@
 		name="MaxParticleCount"
 		top_pad="7"
 		width="303" />
+    <slider
+    control_name="RenderAvatarMaxVisible"
+    decimal_digits="0"
+    follows="left|top"
+    height="16"
+    increment="2"
+    initial_value="35"
+    label="Max. avatar draw distance:"
+    label_width="185"
+    layout="topleft"
+    left_delta="0"
+    max_val="65"
+    min_val="1"
+    name="MaxAvatarDrawDistance"
+    top_pad="4"
+    width="290" />
+    <text
+    type="string"
+    length="1"
+    follows="left|top"
+    height="12"
+    layout="topleft"
+    left_delta="291"
+    name="DrawDistanceMeterText3"
+    top_delta="0"
+    width="128">
+      m
+    </text>
 		<slider
 		control_name="RenderGlowResolutionPow"
 		decimal_digits="0"
@@ -377,7 +405,7 @@
 		label="Post process quality:"
 		label_width="185"
 		layout="topleft"
-		left_delta="0"
+		left="200"
 		max_val="9"
 		min_val="8"
 		name="RenderPostProcess"
@@ -522,7 +550,7 @@
         layout="topleft"
         left="469"
         name="PostProcessText"
-        top="305"
+        top="60"
         width="128">
            Low
         </text>
@@ -607,7 +635,7 @@
         layout="topleft"
         left="200"
         name="LightingDetailText"
-        top_pad="8"
+        top_pad="18"
         width="140">
            Lighting detail:
         </text>
@@ -644,7 +672,7 @@
         layout="topleft"
         left_pad="-30"
         name="TerrainDetailText"
-        top="465"
+        top="226"
         width="155">
            Terrain detail:
         </text>
diff --git a/indra/newview/skins/default/xui/en/panel_status_bar.xml b/indra/newview/skins/default/xui/en/panel_status_bar.xml
index 690d2971ee1730205aaedf27601577c8aa2a8e8f..e0c9c49a23d43a0d599219aec1e215ba67867fed 100644
--- a/indra/newview/skins/default/xui/en/panel_status_bar.xml
+++ b/indra/newview/skins/default/xui/en/panel_status_bar.xml
@@ -43,38 +43,40 @@
     </panel.string>
     <button
      auto_resize="true"
-     halign="right"
+     halign="center"
      font="SansSerifSmall"
      follows="right|top"
      image_overlay=""
-     image_selected="spacer35.tga"
-     image_unselected="spacer35.tga"
-     image_pressed="spacer35.tga"
-     height="16"
-     right="-230"
+     image_selected="bevel_background"
+     image_unselected="bevel_background"
+     image_pressed="bevel_background"
+     height="18"
+     right="-275"
      label_shadow="false"
      name="buycurrency"
      tool_tip="My Balance"
-     top="3"
-     width="120" />
+     pad_left="12"
+     pad_right="12" 
+     top="0"
+     width="40" />
     <button
      auto_resize="true"
-     halign="right"
+     halign="center"
      font="SansSerifSmall"
      follows="right|top"
-     image_selected="spacer35.tga"
-     image_unselected="spacer35.tga"
-     image_pressed="spacer35.tga"
-     height="16"
-     label="Buy L$"
-     label_color="EmphasisColor"
+     image_hover_unselected="buy_over"
+     image_unselected="buy_off"
+     image_pressed="buy_press"
+     height="18"
+     label="BUY L$"
+     label_color="White"
      left_pad="0"
-     label_shadow="false"
+     label_shadow="true"
      name="buyL"
-     pad_right="20"
+     pad_right="0"
      pad_bottom="2"
      tool_tip="Click to buy more L$"
-     top="2"
+     top="0"
      width="55" />
     <text
      type="string"
@@ -88,7 +90,7 @@
      left_pad="0"
      name="TimeText"
      tool_tip="Current time (Pacific)"
-     width="100">
+     width="145">
         24:00 AM PST
     </text>
     <button
diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml
index f8bb36b88ac2ddac6154bc53473b21fb78004a34..e57b30185d80f2ac2e775ddd4fadf1ae620a1164 100644
--- a/indra/newview/skins/default/xui/en/strings.xml
+++ b/indra/newview/skins/default/xui/en/strings.xml
@@ -3176,5 +3176,11 @@ Abuse Report</string>
 
   <!-- language specific white-space characters, delimiters, spacers, item separation symbols -->
   <string name="sentences_separator" value=" "></string>
+  
+  <string name="server_is_down">
+	Despite our best efforts, something unexpected has gone wrong.
+
+	Please check secondlife.com/status to see if there is a known problem with the service.
+  </string>
 
   </strings>
diff --git a/indra/newview/skins/default/xui/it/panel_nearby_media.xml b/indra/newview/skins/default/xui/it/panel_nearby_media.xml
index 649b772424ec10cc1e2a4d898d63876f0900af4c..01e21d520aa2ff9e0850ce8c7cfb317c7e3a73a1 100644
--- a/indra/newview/skins/default/xui/it/panel_nearby_media.xml
+++ b/indra/newview/skins/default/xui/it/panel_nearby_media.xml
@@ -16,7 +16,7 @@
 		(riproduzione)
 	</string>
 	<panel name="minimized_controls">
-		<button label="Interrompi tutto" name="all_nearby_media_disable_btn" tool_tip="Spegni tutti i media nei dintorni"/>
+		<button label="Spegni" name="all_nearby_media_disable_btn" tool_tip="Spegni tutti i media nei dintorni"/>
 		<button label="Accendi tutto" name="all_nearby_media_enable_btn" tool_tip="Accendi tutti i media nei dintorni"/>
 		<button name="open_prefs_btn" tool_tip="Accedi alle preferenze del media"/>
 		<button label="Più &gt;&gt;" label_selected="Meno &lt;&lt;" name="more_btn" tool_tip="Opzioni avanzate"/>
diff --git a/indra/newview/skins/default/xui/it/panel_stand_stop_flying.xml b/indra/newview/skins/default/xui/it/panel_stand_stop_flying.xml
index 198ebf4b2a49ef8ae5ee501fcdec0d019deddc1a..e4ff7019ec35c5815f515a260c2ae5b6d5f7f856 100644
--- a/indra/newview/skins/default/xui/it/panel_stand_stop_flying.xml
+++ b/indra/newview/skins/default/xui/it/panel_stand_stop_flying.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <!-- Width and height of this panel should be synchronized with "panel_modes" in the floater_moveview.xml-->
 <panel name="panel_stand_stop_flying">
-	<button label="Stai in piedi" name="stand_btn" tool_tip="Clicca qui per alzarti."/>
+	<button label="Alzati" name="stand_btn" tool_tip="Clicca qui per alzarti."/>
 	<button label="Ferma il volo" name="stop_fly_btn" tool_tip="Ferma il volo"/>
 </panel>
diff --git a/indra/newview/skins/default/xui/ja/floater_about_land.xml b/indra/newview/skins/default/xui/ja/floater_about_land.xml
index d23ab3565be79dda3b5bafa3e9a8caf664433467..10c27a2b33eacec3de3ddff7c80d574ada640ab5 100644
--- a/indra/newview/skins/default/xui/ja/floater_about_land.xml
+++ b/indra/newview/skins/default/xui/ja/floater_about_land.xml
@@ -308,10 +308,10 @@
 				(なし)
 			</panel.string>
 			<panel.string name="push_restrict_text">
-				プッシングを制限
+				プッシュ禁止
 			</panel.string>
 			<panel.string name="push_restrict_region_text">
-				プッシングを制限 (地域設定優先)
+				プッシュ禁止 (地域設定優先)
 			</panel.string>
 			<text name="allow_label">
 				他の住人への許可:
@@ -337,7 +337,7 @@
 				土地オプション:
 			</text>
 			<check_box label="安全(ダメージなし)" name="check safe" tool_tip="チェックを入れるとこの土地でのダメージコンバットが無効になり、「安全」に設定されます。 チェックを外すとダメージコンバットが有効になります。"/>
-			<check_box label="プッシングを制限" name="PushRestrictCheck" tool_tip="スクリプトによるプッシングを制限します。 このオプションを選択することにより、あなたの土地での破壊的行動を防ぐことができます。"/>
+			<check_box label="プッシュ禁止" name="PushRestrictCheck" tool_tip="スクリプトによるプッシュを禁止します。 このオプションを選択することにより、あなたの土地での破壊的行動を防ぐことができます。"/>
 			<check_box label="検索に区画を表示(週 L$ 30)" name="ShowDirectoryCheck" tool_tip="この区画を検索結果に表示します"/>
 			<combo_box name="land category with adult">
 				<combo_box.item label="全カテゴリ" name="item0"/>
@@ -355,7 +355,7 @@
 				<combo_box.item label="その他" name="item12"/>
 			</combo_box>
 			<combo_box name="land category">
-				<combo_box.item label="全カテゴリー" name="item0"/>
+				<combo_box.item label="全カテゴリ" name="item0"/>
 				<combo_box.item label="Linden 所在地" name="item1"/>
 				<combo_box.item label="アート&amp;カルチャー" name="item3"/>
 				<combo_box.item label="ビジネス" name="item4"/>
@@ -379,7 +379,7 @@
 			<button label="設定" label_selected="設定" name="Set" tool_tip="訪問者の着地点の設定を行います。この区画内に立って行ってください。"/>
 			<button label="クリア" label_selected="クリア" name="Clear" tool_tip="着地点をクリア"/>
 			<text name="Teleport Routing: ">
-				テレポート制限:
+				テレポート経路:
 			</text>
 			<combo_box name="landing type" tool_tip="テレポート経路 -- あなたの土地へのテレポート経路を選択">
 				<combo_box.item label="不可" name="Blocked"/>
diff --git a/indra/newview/skins/default/xui/ja/floater_joystick.xml b/indra/newview/skins/default/xui/ja/floater_joystick.xml
index 65eeebe4edb25dea54f1c3f8c74e0ac75c2a8986..daa480ef5a6b9be3bc8ee28c54d6ca968b93ee07 100644
--- a/indra/newview/skins/default/xui/ja/floater_joystick.xml
+++ b/indra/newview/skins/default/xui/ja/floater_joystick.xml
@@ -89,7 +89,7 @@
 	<spinner left="205" name="BuildAxisDeadZone3" width="50"/>
 	<spinner left="275" name="FlycamAxisDeadZone3" width="50"/>
 	<text name="Feathering">
-		羽毛
+		感度調整
 	</text>
 	<slider label="" left="126" name="AvatarFeathering" width="67"/>
 	<slider label="" left="196" name="BuildFeathering" width="67"/>
diff --git a/indra/newview/skins/default/xui/ja/floater_postcard.xml b/indra/newview/skins/default/xui/ja/floater_postcard.xml
index 5a2b047fe07496f6602ca178a3b661f995882b3c..9d9b59fa51391ac959bbaeafa3b6fb149430f0ba 100644
--- a/indra/newview/skins/default/xui/ja/floater_postcard.xml
+++ b/indra/newview/skins/default/xui/ja/floater_postcard.xml
@@ -1,11 +1,11 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
-<floater name="Postcard" title="スナップショットをメール">
+<floater name="Postcard" title="スナップショットをEメールで送信">
 	<text name="to_label">
-		住人のメール:
+		受信先のEメール:
 	</text>
 	<line_editor left="145" name="to_form" width="125"/>
 	<text name="from_label">
-		あなたのメール:
+		あなたのEメール:
 	</text>
 	<line_editor left="145" name="from_form" width="125"/>
 	<text name="name_label">
diff --git a/indra/newview/skins/default/xui/ja/floater_tools.xml b/indra/newview/skins/default/xui/ja/floater_tools.xml
index a7e687abeb8079183979344183e673690409bdc9..6c3ad99fa786d820303ebfc8fb941d7ea32b4ef8 100644
--- a/indra/newview/skins/default/xui/ja/floater_tools.xml
+++ b/indra/newview/skins/default/xui/ja/floater_tools.xml
@@ -49,7 +49,7 @@
 	</text>
 	<radio_group name="focus_radio_group">
 		<radio_item label="ズーム" name="radio zoom"/>
-		<radio_item label="軌跡(Ctrl)" name="radio orbit"/>
+		<radio_item label="旋回(Ctrl)" name="radio orbit"/>
 		<radio_item label="水平・垂直移動 (Ctrl + Shift)" name="radio pan"/>
 	</radio_group>
 	<radio_group name="move_radio_group">
@@ -69,9 +69,9 @@
 	</text>
 	<check_box left="116" name="checkbox uniform"/>
 	<text name="checkbox uniform label">
-		両側を引伸ばす
+		両側を引き延ばす
 	</text>
-	<check_box initial_value="true" label="テクスチャを引伸ばす" name="checkbox stretch textures"/>
+	<check_box initial_value="true" label="テクスチャを引き延ばす" name="checkbox stretch textures"/>
 	<check_box initial_value="true" label="グリッドにスナップ" left_delta="27" name="checkbox snap to grid"/>
 	<combo_box left_delta="60" name="combobox grid mode" tool_tip="オブジェクトの配置に使うグリッドルーラを選択します" width="76">
 		<combo_box.item label="インワールドグリッド" name="World"/>
@@ -87,7 +87,7 @@
 	<button label="" label_selected="" name="ToolHemiCylinder" tool_tip="半円柱"/>
 	<button label="" label_selected="" name="ToolCone" tool_tip="円錐"/>
 	<button label="" label_selected="" name="ToolHemiCone" tool_tip="半円錐"/>
-	<button label="" label_selected="" name="ToolSphere" tool_tip="球形"/>
+	<button label="" label_selected="" name="ToolSphere" tool_tip="球体"/>
 	<button label="" label_selected="" name="ToolHemiSphere" tool_tip="半球"/>
 	<button label="" label_selected="" name="ToolTorus" tool_tip="トーラス"/>
 	<button label="" label_selected="" name="ToolTube" tool_tip="チューブ"/>
@@ -267,7 +267,7 @@
 				<combo_box.item label="ボックス" name="Box"/>
 				<combo_box.item label="シリンダー" name="Cylinder"/>
 				<combo_box.item label="プリズム" name="Prism"/>
-				<combo_box.item label="球形" name="Sphere"/>
+				<combo_box.item label="球体" name="Sphere"/>
 				<combo_box.item label="トーラス" name="Torus"/>
 				<combo_box.item label="チューブ" name="Tube"/>
 				<combo_box.item label="リング" name="Ring"/>
@@ -350,7 +350,7 @@
 			</text>
 			<combo_box name="sculpt type control">
 				<combo_box.item label="(なし)" name="None"/>
-				<combo_box.item label="球形" name="Sphere"/>
+				<combo_box.item label="球体" name="Sphere"/>
 				<combo_box.item label="トーラス" name="Torus"/>
 				<combo_box.item label="平面" name="Plane"/>
 				<combo_box.item label="シリンダー" name="Cylinder"/>
diff --git a/indra/newview/skins/default/xui/ja/menu_participant_list.xml b/indra/newview/skins/default/xui/ja/menu_participant_list.xml
index 3d0368245effa5d97dad2ec92956c58147c13685..4555bad9bacf073037cb8568962ecf2f912852c7 100644
--- a/indra/newview/skins/default/xui/ja/menu_participant_list.xml
+++ b/indra/newview/skins/default/xui/ja/menu_participant_list.xml
@@ -10,7 +10,7 @@
 	<menu_item_call label="支払う" name="Pay"/>
 	<menu_item_check label="人のアイコン表示" name="View Icons"/>
 	<menu_item_check label="ボイスをブロック" name="Block/Unblock"/>
-	<menu_item_check label="文字をブロックする" name="MuteText"/>
+	<menu_item_check label="文字をブロック" name="MuteText"/>
 	<context_menu label="モデレーターのオプション &gt;" name="Moderator Options">
 		<menu_item_check label="文字チャットを許可" name="AllowTextChat"/>
 		<menu_item_call label="この参加者をミュートする" name="ModerateVoiceMuteSelected"/>
diff --git a/indra/newview/skins/default/xui/ja/notifications.xml b/indra/newview/skins/default/xui/ja/notifications.xml
index 7adc5e3a7843cedc727b5d5f6a7a33f0e10ababb..f734bcde42ba6f18eed0f7a6df6dca6933e5d6de 100644
--- a/indra/newview/skins/default/xui/ja/notifications.xml
+++ b/indra/newview/skins/default/xui/ja/notifications.xml
@@ -2230,7 +2230,7 @@ Web ページにリンクすると、他人がこの場所に簡単にアクセ
 ここでは飛べません。
 	</notification>
 	<notification name="PushRestricted">
-		このエリアではプッシュが制限されています。 土地所有者以外は他人をプッシュすることはできません。
+		このエリアではプッシュが禁止されています。 土地所有者以外は他人をプッシュすることはできません。
 	</notification>
 	<notification name="NoVoice">
 		このエリアではボイスチャットが無効です。 誰かが話しているのを聞くことはできません。
diff --git a/install.xml b/install.xml
index 0e54c73c93c942719bd3340c3dacc1a79f981623..c6b6ffda810edb6c2914c6dc5b5dd70d0ed29dda 100644
--- a/install.xml
+++ b/install.xml
@@ -955,16 +955,16 @@ anguage Infrstructure (CLI) international standard</string>
           <key>linux</key>
           <map>
             <key>md5sum</key>
-            <string>a90135a68d2821eef742d15cb06b15b9</string>
+            <string>7a5e02d252b76ab41bdca58506fa4147</string>
             <key>url</key>
-            <uri>http://s3.amazonaws.com/viewer-source-downloads/install_pkgs/llqtwebkit-linux-20100407-cookie-api.tar.bz2</uri>
+            <uri>http://s3.amazonaws.com/viewer-source-downloads/install_pkgs/llqtwebkit-linux-20100521.tar.bz2</uri>
           </map>
           <key>windows</key>
           <map>
             <key>md5sum</key>
-            <string>d682ed6232193b4eab3170657a54ebf9</string>
+            <string>1d9697fed57084eea7b3dc250e9c66f7</string>
             <key>url</key>
-            <uri>http://s3.amazonaws.com/viewer-source-downloads/install_pkgs/llqtwebkit-windows-qt4.6-20100519.tar.bz2</uri>
+            <uri>http://s3.amazonaws.com/viewer-source-downloads/install_pkgs/llqtwebkit-windows-qt4.6-20100525.tar.bz2</uri>
           </map>
         </map>
       </map>