diff --git a/indra/llcommon/llsd.cpp b/indra/llcommon/llsd.cpp
index 9140ebb3f334957d7792ff91f91cb9bad0d293b1..c863d4e266b51949672f6658b16cb04655cdaf91 100644
--- a/indra/llcommon/llsd.cpp
+++ b/indra/llcommon/llsd.cpp
@@ -355,7 +355,7 @@ namespace
 		using LLSD::Impl::erase; // Unhiding erase(LLSD::Integer)
 		using LLSD::Impl::ref; // Unhiding ref(LLSD::Integer)
 		virtual LLSD get(const LLSD::String&) const; 
-		        LLSD& insert(const LLSD::String& k, const LLSD& v);
+		void insert(const LLSD::String& k, const LLSD& v);
 		virtual void erase(const LLSD::String&);
 		              LLSD& ref(const LLSD::String&);
 		virtual const LLSD& ref(const LLSD::String&) const;
@@ -394,14 +394,9 @@ namespace
 		return (i != mData.end()) ? i->second : LLSD();
 	}
 	
-	LLSD& ImplMap::insert(const LLSD::String& k, const LLSD& v)
+	void ImplMap::insert(const LLSD::String& k, const LLSD& v)
 	{
 		mData.insert(DataMap::value_type(k, v));
-		#ifdef LL_MSVC7
-			return *((LLSD*)this);
-		#else
-			return *dynamic_cast<LLSD*>(this);
-		#endif
 	}
 	
 	void ImplMap::erase(const LLSD::String& k)
@@ -450,7 +445,7 @@ namespace
 		virtual int size() const; 
 		virtual LLSD get(LLSD::Integer) const;
 		        void set(LLSD::Integer, const LLSD&);
-		        LLSD& insert(LLSD::Integer, const LLSD&);
+		        void insert(LLSD::Integer, const LLSD&);
 		        void append(const LLSD&);
 		virtual void erase(LLSD::Integer);
 		              LLSD& ref(LLSD::Integer);
@@ -499,14 +494,10 @@ namespace
 		mData[index] = v;
 	}
 	
-	LLSD& ImplArray::insert(LLSD::Integer i, const LLSD& v)
+	void ImplArray::insert(LLSD::Integer i, const LLSD& v)
 	{
 		if (i < 0) {
-			#ifdef LL_MSVC7
-				return *((LLSD*)this);
-			#else
-				return *dynamic_cast<LLSD*>(this);
-			#endif
+			return;
 		}
 		DataVector::size_type index = i;
 		
@@ -516,11 +507,6 @@ namespace
 		}
 		
 		mData.insert(mData.begin() + index, v);
-		#ifdef LL_MSVC7
-			return *((LLSD*)this);
-		#else
-			return *dynamic_cast<LLSD*>(this);
-		#endif
 	}
 	
 	void ImplArray::append(const LLSD& v)
@@ -763,11 +749,12 @@ LLSD LLSD::emptyMap()
 
 bool LLSD::has(const String& k) const	{ return safe(impl).has(k); }
 LLSD LLSD::get(const String& k) const	{ return safe(impl).get(k); } 
+void LLSD::insert(const String& k, const LLSD& v) {	makeMap(impl).insert(k, v); }
 
-LLSD& LLSD::insert(const String& k, const LLSD& v)
+LLSD& LLSD::with(const String& k, const LLSD& v)
 										{ 
 											makeMap(impl).insert(k, v); 
-											return *dynamic_cast<LLSD*>(this);
+											return *this;
 										}
 void LLSD::erase(const String& k)		{ makeMap(impl).erase(k); }
 
@@ -788,8 +775,9 @@ int LLSD::size() const					{ return safe(impl).size(); }
  
 LLSD LLSD::get(Integer i) const			{ return safe(impl).get(i); } 
 void LLSD::set(Integer i, const LLSD& v){ makeArray(impl).set(i, v); }
+void LLSD::insert(Integer i, const LLSD& v) { makeArray(impl).insert(i, v); }
 
-LLSD& LLSD::insert(Integer i, const LLSD& v)
+LLSD& LLSD::with(Integer i, const LLSD& v)
 										{ 
 											makeArray(impl).insert(i, v); 
 											return *this;
diff --git a/indra/llcommon/llsd.h b/indra/llcommon/llsd.h
index 552bb57498e6280407fe02d4181d2fea920aed0a..135133c19c4126358ebe85f9220e19291c51706c 100644
--- a/indra/llcommon/llsd.h
+++ b/indra/llcommon/llsd.h
@@ -223,8 +223,9 @@ class LL_COMMON_API LLSD
 		
 		bool has(const String&) const;
 		LLSD get(const String&) const;
-		LLSD& insert(const String&, const LLSD&);
+		void insert(const String&, const LLSD&);
 		void erase(const String&);
+		LLSD& with(const String&, const LLSD&);
 		
 		LLSD& operator[](const String&);
 		LLSD& operator[](const char* c)			{ return (*this)[String(c)]; }
@@ -238,9 +239,10 @@ class LL_COMMON_API LLSD
 		
 		LLSD get(Integer) const;
 		void set(Integer, const LLSD&);
-		LLSD& insert(Integer, const LLSD&);
+		void insert(Integer, const LLSD&);
 		void append(const LLSD&);
 		void erase(Integer);
+		LLSD& with(Integer, const LLSD&);
 		
 		const LLSD& operator[](Integer) const;
 		LLSD& operator[](Integer);
diff --git a/indra/llmessage/llareslistener.cpp b/indra/llmessage/llareslistener.cpp
index 7db3675b77420c80c883526b41b42fd3d3a01969..97efa96d5392b7e58b721a082a26a8f340212a87 100644
--- a/indra/llmessage/llareslistener.cpp
+++ b/indra/llmessage/llareslistener.cpp
@@ -34,7 +34,7 @@ LLAresListener::LLAresListener(LLAres* llares):
         "On failure, returns an array containing only the original URI, so\n"
         "failure case can be processed like success case.",
         &LLAresListener::rewriteURI,
-        LLSD().insert("uri", LLSD()).insert("reply", LLSD()));
+        LLSD().with("uri", LLSD()).with("reply", LLSD()));
 }
 
 /// This UriRewriteResponder subclass packages returned URIs as an LLSD
diff --git a/indra/llui/llflatlistview.cpp b/indra/llui/llflatlistview.cpp
index ddfb0f85347be80c69b8893c1fadb47a7c94f439..f4a5f1c99026bb83c7b1c575cc6e04ba778fb46c 100644
--- a/indra/llui/llflatlistview.cpp
+++ b/indra/llui/llflatlistview.cpp
@@ -39,8 +39,8 @@
 
 static const LLDefaultChildRegistry::Register<LLFlatListView> flat_list_view("flat_list_view");
 
-const LLSD SELECTED_EVENT	= LLSD().insert("selected", true);
-const LLSD UNSELECTED_EVENT	= LLSD().insert("selected", false);
+const LLSD SELECTED_EVENT	= LLSD().with("selected", true);
+const LLSD UNSELECTED_EVENT	= LLSD().with("selected", false);
 
 static const std::string COMMENT_TEXTBOX = "comment_text";
 
@@ -530,7 +530,7 @@ BOOL LLFlatListView::handleKeyHere(KEY key, MASK mask)
 			if ( !selectNextItemPair(true, reset_selection) && reset_selection)
 			{
 				// If case we are in accordion tab notify parent to go to the previous accordion
-				notifyParent(LLSD().insert("action","select_prev"));
+				notifyParent(LLSD().with("action","select_prev"));
 			}
 			break;
 		}
@@ -539,7 +539,7 @@ BOOL LLFlatListView::handleKeyHere(KEY key, MASK mask)
 			if ( !selectNextItemPair(false, reset_selection) && reset_selection)
 			{
 				// If case we are in accordion tab notify parent to go to the next accordion
-				notifyParent(LLSD().insert("action","select_next"));
+				notifyParent(LLSD().with("action","select_next"));
 			}
 			break;
 		}
@@ -570,7 +570,7 @@ BOOL LLFlatListView::handleKeyHere(KEY key, MASK mask)
 		// In case we are in accordion tab notify parent to show selected rectangle
 		LLRect screen_rc;
 		localRectToScreen(selected_rc, &screen_rc);
-		notifyParent(LLSD().insert("scrollToShowRect",screen_rc.getValue()));
+		notifyParent(LLSD().with("scrollToShowRect",screen_rc.getValue()));
 		handled = TRUE;
 	}
 
diff --git a/indra/llui/llfloaterreglistener.cpp b/indra/llui/llfloaterreglistener.cpp
index 029d3b681035246cad07545abfe2350ebbfc4826..082d7c1573dcaf418087156611587928b7bcd7ea 100644
--- a/indra/llui/llfloaterreglistener.cpp
+++ b/indra/llui/llfloaterreglistener.cpp
@@ -28,7 +28,7 @@ LLFloaterRegListener::LLFloaterRegListener():
     add("getBuildMap",
         "Return on [\"reply\"] data about all registered LLFloaterReg floater names",
         &LLFloaterRegListener::getBuildMap,
-        LLSD().insert("reply", LLSD()));
+        LLSD().with("reply", LLSD()));
     LLSD requiredName;
     requiredName["name"] = LLSD();
     add("showInstance",
diff --git a/indra/llui/llnotifications.cpp b/indra/llui/llnotifications.cpp
index 05f2d3a9cfd379b4420306f81a5d5413b37c5392..86989012ee4c34842f2ef8c500606d444ae58c0d 100644
--- a/indra/llui/llnotifications.cpp
+++ b/indra/llui/llnotifications.cpp
@@ -711,7 +711,7 @@ LLBoundListener LLNotificationChannelBase::connectChangedImpl(const LLEventListe
 	// only about new notifications
 	for (LLNotificationSet::iterator it = mItems.begin(); it != mItems.end(); ++it)
 	{
-		slot(LLSD().insert("sigtype", "load").insert("id", (*it)->id()));
+		slot(LLSD().with("sigtype", "load").with("id", (*it)->id()));
 	}
 	// and then connect the signal so that all future notifications will also be
 	// forwarded.
@@ -722,7 +722,7 @@ LLBoundListener LLNotificationChannelBase::connectAtFrontChangedImpl(const LLEve
 {
 	for (LLNotificationSet::iterator it = mItems.begin(); it != mItems.end(); ++it)
 	{
-		slot(LLSD().insert("sigtype", "load").insert("id", (*it)->id()));
+		slot(LLSD().with("sigtype", "load").with("id", (*it)->id()));
 	}
 	return mChanged.connect(slot, boost::signals2::at_front);
 }
@@ -907,7 +907,7 @@ void LLNotificationChannel::setComparator(LLNotificationComparator comparator)
 	mItems.swap(s2);
 	
 	// notify clients that we've been resorted
-	mChanged(LLSD().insert("sigtype", "sort")); 
+	mChanged(LLSD().with("sigtype", "sort")); 
 }
 
 bool LLNotificationChannel::isEmpty() const
@@ -1443,7 +1443,7 @@ void LLNotifications::add(const LLNotificationPtr pNotif)
 		llerrs << "Notification added a second time to the master notification channel." << llendl;
 	}
 
-	updateItem(LLSD().insert("sigtype", "add").insert("id", pNotif->id()), pNotif);
+	updateItem(LLSD().with("sigtype", "add").with("id", pNotif->id()), pNotif);
 }
 
 void LLNotifications::cancel(LLNotificationPtr pNotif)
@@ -1454,7 +1454,7 @@ void LLNotifications::cancel(LLNotificationPtr pNotif)
 		llerrs << "Attempted to delete nonexistent notification " << pNotif->getName() << llendl;
 	}
 	pNotif->cancel();
-	updateItem(LLSD().insert("sigtype", "delete").insert("id", pNotif->id()), pNotif);
+	updateItem(LLSD().with("sigtype", "delete").with("id", pNotif->id()), pNotif);
 }
 
 void LLNotifications::update(const LLNotificationPtr pNotif)
@@ -1462,7 +1462,7 @@ void LLNotifications::update(const LLNotificationPtr pNotif)
 	LLNotificationSet::iterator it=mItems.find(pNotif);
 	if (it != mItems.end())
 	{
-		updateItem(LLSD().insert("sigtype", "change").insert("id", pNotif->id()), pNotif);
+		updateItem(LLSD().with("sigtype", "change").with("id", pNotif->id()), pNotif);
 	}
 }
 
diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml
index 63e17058e87c49bd23316c0cc4d7f93eefb73cbb..4a65b4065805df7bdcc93e149e08f30d638a8b99 100644
--- a/indra/newview/app_settings/settings.xml
+++ b/indra/newview/app_settings/settings.xml
@@ -386,17 +386,6 @@
       <key>Value</key>
       <integer>0</integer>
     </map>
-    <key>AutoPlayMedia</key>
-    <map>
-      <key>Comment</key>
-      <string>Allow media objects to automatically play or navigate?</string>
-      <key>Persist</key>
-      <integer>1</integer>
-      <key>Type</key>
-      <string>Boolean</string>
-      <key>Value</key>
-      <integer>1</integer>
-    </map>
     <key>AutoSnapshot</key>
     <map>
       <key>Comment</key>
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index eb08707b61320f0396143c6e1c9c56c12d39f80f..84843138bfc343f7172c9672beddb28a4dbfb0cb 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -899,6 +899,8 @@ bool LLAppViewer::init()
 		loadEventHostModule(gSavedSettings.getS32("QAModeEventHostPort"));
 	}
 	
+	LLViewerMedia::initClass();
+	
 	return true;
 }
 
diff --git a/indra/newview/llavatarlistitem.cpp b/indra/newview/llavatarlistitem.cpp
index efc9538fa6dac5fb47b1186d855563d15cdb8b37..3bee5c353fb6dcb7abee6b4ff0e2f454d0130557 100644
--- a/indra/newview/llavatarlistitem.cpp
+++ b/indra/newview/llavatarlistitem.cpp
@@ -260,7 +260,7 @@ void LLAvatarListItem::setAvatarIconVisible(bool visible)
 
 void LLAvatarListItem::onInfoBtnClick()
 {
-	LLFloaterReg::showInstance("inspect_avatar", LLSD().insert("avatar_id", mAvatarId));
+	LLFloaterReg::showInstance("inspect_avatar", LLSD().with("avatar_id", mAvatarId));
 
 	/* TODO fix positioning of inspector
 	localPointToScreen(mXPos, mYPos, &mXPos, &mYPos);
diff --git a/indra/newview/llchathistory.cpp b/indra/newview/llchathistory.cpp
index 078c2518c6f76c5e56e196e37629a0bd6df43d1a..6e1bb961a5b2d424186f72d27e513b14a0cbdc52 100644
--- a/indra/newview/llchathistory.cpp
+++ b/indra/newview/llchathistory.cpp
@@ -78,7 +78,7 @@ class LLChatHistoryHeader: public LLPanel
 		{
 			LLMuteList::getInstance()->add(LLMute(getAvatarId(), mFrom, LLMute::OBJECT));
 
-			LLSideTray::getInstance()->showPanel("panel_block_list_sidetray", LLSD().insert("blocked_to_select", getAvatarId()));
+			LLSideTray::getInstance()->showPanel("panel_block_list_sidetray", LLSD().with("blocked_to_select", getAvatarId()));
 		}
 	}
 
@@ -160,11 +160,11 @@ class LLChatHistoryHeader: public LLPanel
 	{
 		if (mSourceType == CHAT_SOURCE_OBJECT)
 		{
-			LLFloaterReg::showInstance("inspect_object", LLSD().insert("object_id", mAvatarID));
+			LLFloaterReg::showInstance("inspect_object", LLSD().with("object_id", mAvatarID));
 		}
 		else if (mSourceType == CHAT_SOURCE_AGENT)
 		{
-			LLFloaterReg::showInstance("inspect_avatar", LLSD().insert("avatar_id", mAvatarID));
+			LLFloaterReg::showInstance("inspect_avatar", LLSD().with("avatar_id", mAvatarID));
 		}
 		//if chat source is system, you may add "else" here to define behaviour.
 	}
diff --git a/indra/newview/lleventnotifier.cpp b/indra/newview/lleventnotifier.cpp
index 9c8af16535cbbeea70f334bc63bd69587d0a4e33..b64799bd86569d239412902e715ed2099844dc21 100644
--- a/indra/newview/lleventnotifier.cpp
+++ b/indra/newview/lleventnotifier.cpp
@@ -197,7 +197,7 @@ bool LLEventNotification::handleResponse(const LLSD& notification, const LLSD& r
 			break;
 		}
 	case 1:
-		LLFloaterReg::showInstance("search", LLSD().insert("category", "events").insert("id", S32(getEventID())));
+		LLFloaterReg::showInstance("search", LLSD().with("category", "events").with("id", S32(getEventID())));
 		break;
 	case 2:
 		break;
diff --git a/indra/newview/llfloaterabout.cpp b/indra/newview/llfloaterabout.cpp
index 58c0c197618d4afc3c2bb11ec120344cfb659fc6..68fc69b4f7865800fadbd0abcb68f89428e6ecdf 100644
--- a/indra/newview/llfloaterabout.cpp
+++ b/indra/newview/llfloaterabout.cpp
@@ -312,7 +312,7 @@ class LLFloaterAboutListener: public LLEventAPI
 		add("getInfo",
             "Request an LLSD::Map containing information used to populate About box",
             &LLFloaterAboutListener::getInfo,
-            LLSD().insert("reply", LLSD()));
+            LLSD().with("reply", LLSD()));
 	}
 
 private:
diff --git a/indra/newview/llfloatertestinspectors.cpp b/indra/newview/llfloatertestinspectors.cpp
index 09996b0b92cd5271fd5d8a84fb29f63bc7899a0f..58d5197eaaa07f7d00b2d69ad80a0181c35bd5a3 100644
--- a/indra/newview/llfloatertestinspectors.cpp
+++ b/indra/newview/llfloatertestinspectors.cpp
@@ -82,12 +82,12 @@ void LLFloaterTestInspectors::showAvatarInspector(LLUICtrl*, const LLSD& avatar_
 		id = avatar_id.asUUID();
 	}
 	// spawns off mouse position automatically
-	LLFloaterReg::showInstance("inspect_avatar", LLSD().insert("avatar_id", id));
+	LLFloaterReg::showInstance("inspect_avatar", LLSD().with("avatar_id", id));
 }
 
 void LLFloaterTestInspectors::showObjectInspector(LLUICtrl*, const LLSD& object_id)
 {
-	LLFloaterReg::showInstance("inspect_object", LLSD().insert("object_id", object_id));
+	LLFloaterReg::showInstance("inspect_object", LLSD().with("object_id", object_id));
 }
 
 void LLFloaterTestInspectors::onClickAvatar2D()
diff --git a/indra/newview/llgroupactions.cpp b/indra/newview/llgroupactions.cpp
index 6fe8ed0e4d25c7be6520dd305f5ab6b73c04c06e..4adefdfcaf2e41e4452a200edda2bc036916a2d7 100644
--- a/indra/newview/llgroupactions.cpp
+++ b/indra/newview/llgroupactions.cpp
@@ -113,7 +113,7 @@ LLGroupHandler gGroupHandler;
 // static
 void LLGroupActions::search()
 {
-	LLFloaterReg::showInstance("search", LLSD().insert("category", "groups"));
+	LLFloaterReg::showInstance("search", LLSD().with("category", "groups"));
 }
 
 // static
diff --git a/indra/newview/llgrouplist.cpp b/indra/newview/llgrouplist.cpp
index cdb85f5b1c2db489752e44307504ae35bad4f219..97cf139f1d4f8ea3493e8d746c782a36e751e867 100644
--- a/indra/newview/llgrouplist.cpp
+++ b/indra/newview/llgrouplist.cpp
@@ -329,7 +329,7 @@ void LLGroupListItem::setActive(bool active)
 
 void LLGroupListItem::onInfoBtnClick()
 {
-	LLFloaterReg::showInstance("inspect_group", LLSD().insert("group_id", mGroupID));
+	LLFloaterReg::showInstance("inspect_group", LLSD().with("group_id", mGroupID));
 }
 
 void LLGroupListItem::onProfileBtnClick()
diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp
index a44ce07d764923a350cec7abaf6d6d1fc4746d64..ac6aa307f2083663949151d9b549696c39ad36ba 100644
--- a/indra/newview/llinventorybridge.cpp
+++ b/indra/newview/llinventorybridge.cpp
@@ -1313,6 +1313,16 @@ BOOL LLItemBridge::isItemPermissive() const
 	return FALSE;
 }
 
+bool LLItemBridge::isAddAction(std::string action) const
+{
+	return ("wear" == action || "attach" == action || "activate" == action);
+}
+
+bool LLItemBridge::isRemoveAction(std::string action) const
+{
+	return ("take_off" == action || "detach" == action || "deactivate" == action);
+}
+
 // +=================================================+
 // |        LLFolderBridge                           |
 // +=================================================+
@@ -3673,7 +3683,7 @@ std::string LLGestureBridge::getLabelSuffix() const
 // virtual
 void LLGestureBridge::performAction(LLFolderView* folder, LLInventoryModel* model, std::string action)
 {
-	if ("activate" == action)
+	if (isAddAction(action))
 	{
 		LLGestureManager::instance().activateGesture(mUUID);
 
@@ -3685,7 +3695,7 @@ void LLGestureBridge::performAction(LLFolderView* folder, LLInventoryModel* mode
 		gInventory.updateItem(item);
 		gInventory.notifyObservers();
 	}
-	else if ("deactivate" == action)
+	else if (isRemoveAction(action))
 	{
 		LLGestureManager::instance().deactivateGesture(mUUID);
 
@@ -3870,7 +3880,7 @@ LLInventoryObject* LLObjectBridge::getObject() const
 // virtual
 void LLObjectBridge::performAction(LLFolderView* folder, LLInventoryModel* model, std::string action)
 {
-	if ("attach" == action)
+	if (isAddAction(action))
 	{
 		LLUUID object_id = mUUID;
 		LLViewerInventoryItem* item;
@@ -3893,7 +3903,7 @@ void LLObjectBridge::performAction(LLFolderView* folder, LLInventoryModel* model
 		}
 		gFocusMgr.setKeyboardFocus(NULL);
 	}
-	else if ("detach" == action)
+	else if (isRemoveAction(action))
 	{
 		LLInventoryItem* item = gInventory.getItem(mUUID);
 		if(item)
@@ -4386,7 +4396,7 @@ LLUIImagePtr LLWearableBridge::getIcon() const
 // virtual
 void LLWearableBridge::performAction(LLFolderView* folder, LLInventoryModel* model, std::string action)
 {
-	if ("wear" == action)
+	if (isAddAction(action))
 	{
 		wearOnAvatar();
 	}
@@ -4399,7 +4409,7 @@ void LLWearableBridge::performAction(LLFolderView* folder, LLInventoryModel* mod
 		editOnAvatar();
 		return;
 	}
-	else if ("take_off" == action)
+	else if (isRemoveAction(action))
 	{
 		if(gAgentWearables.isWearingItem(mUUID))
 		{
diff --git a/indra/newview/llinventorybridge.h b/indra/newview/llinventorybridge.h
index 6a284e05506364de33a8b5ae60b09f238182e41b..ef340af0cbd3f4ac795bb078a0d590a04769742e 100644
--- a/indra/newview/llinventorybridge.h
+++ b/indra/newview/llinventorybridge.h
@@ -259,6 +259,9 @@ class LLItemBridge : public LLInvFVBridge
 	virtual void clearDisplayName() { mDisplayName.clear(); }
 
 	LLViewerInventoryItem* getItem() const;
+	
+	bool isAddAction(std::string action) const;
+	bool isRemoveAction(std::string action) const;
 
 protected:
 	virtual BOOL isItemPermissive() const;
diff --git a/indra/newview/lllocationinputctrl.cpp b/indra/newview/lllocationinputctrl.cpp
index 9d4dc2b2857fc804b797b02c845e7aec50d37dc9..d97f1d4d181bbdd139e2a0f8e1383e158f7e1e3d 100644
--- a/indra/newview/lllocationinputctrl.cpp
+++ b/indra/newview/lllocationinputctrl.cpp
@@ -473,7 +473,7 @@ void LLLocationInputCtrl::draw()
 
 void LLLocationInputCtrl::onInfoButtonClicked()
 {
-	LLSideTray::getInstance()->showPanel("panel_places", LLSD().insert("type", "agent"));
+	LLSideTray::getInstance()->showPanel("panel_places", LLSD().with("type", "agent"));
 }
 
 void LLLocationInputCtrl::onForSaleButtonClicked()
@@ -495,7 +495,7 @@ void LLLocationInputCtrl::onAddLandmarkButtonClicked()
 	}
 	else
 	{
-		LLSideTray::getInstance()->showPanel("panel_places", LLSD().insert("type", "create_landmark"));
+		LLSideTray::getInstance()->showPanel("panel_places", LLSD().with("type", "create_landmark"));
 	}
 }
 
@@ -844,12 +844,12 @@ void LLLocationInputCtrl::onLocationContextMenuItemClicked(const LLSD& userdata)
 		
 		if(!landmark)
 		{
-			LLSideTray::getInstance()->showPanel("panel_places", LLSD().insert("type", "create_landmark"));
+			LLSideTray::getInstance()->showPanel("panel_places", LLSD().with("type", "create_landmark"));
 		}
 		else
 		{
 			LLSideTray::getInstance()->showPanel("panel_places", 
-					LLSD().insert("type", "landmark").insert("id",landmark->getUUID()));
+					LLSD().with("type", "landmark").with("id",landmark->getUUID()));
 		}
 	}
 	else if (item == "cut")
diff --git a/indra/newview/llmaniptranslate.cpp b/indra/newview/llmaniptranslate.cpp
index 932a3d8a83f7509412a16f349eb2f8c48dbeffef..765b504afe0b2fa92713ab949febc7dfa04a500f 100644
--- a/indra/newview/llmaniptranslate.cpp
+++ b/indra/newview/llmaniptranslate.cpp
@@ -1440,7 +1440,7 @@ void LLManipTranslate::renderSnapGuides()
 				LLVector3 help_text_pos = selection_center_start + (snap_offset_meters_up * 3.f * mSnapOffsetAxis);
 				const LLFontGL* big_fontp = LLFontGL::getFontSansSerif();
 
-				std::string help_text = "Move mouse cursor over ruler to snap";
+				std::string help_text = "Move mouse cursor over ruler";
 				LLColor4 help_text_color = LLColor4::white;
 				help_text_color.mV[VALPHA] = clamp_rescale(mHelpTextTimer.getElapsedTimeF32(), sHelpTextVisibleTime, sHelpTextVisibleTime + sHelpTextFadeTime, line_alpha, 0.f);
 				hud_render_utf8text(help_text, help_text_pos, *big_fontp, LLFontGL::NORMAL, LLFontGL::NO_SHADOW, -0.5f * big_fontp->getWidthF32(help_text), 3.f, help_text_color, mObjectSelection->getSelectType() == SELECT_TYPE_HUD);
diff --git a/indra/newview/llnavigationbar.cpp b/indra/newview/llnavigationbar.cpp
index 41376c4c097d9ab7ece339c0a675d31da5f7fc31..e65b7d8a0c61a2ee7742e75bd76ac6a69d27df65 100644
--- a/indra/newview/llnavigationbar.cpp
+++ b/indra/newview/llnavigationbar.cpp
@@ -561,7 +561,7 @@ void LLNavigationBar::handleLoginComplete()
 
 void LLNavigationBar::invokeSearch(std::string search_text)
 {
-	LLFloaterReg::showInstance("search", LLSD().insert("category", "all").insert("id", LLSD(search_text)));
+	LLFloaterReg::showInstance("search", LLSD().with("category", "all").with("id", LLSD(search_text)));
 }
 
 void LLNavigationBar::clearHistoryCache()
diff --git a/indra/newview/llpanelblockedlist.cpp b/indra/newview/llpanelblockedlist.cpp
index 73cffaa7ed85af84b0e03c606cbce6956c43ae59..ae703ebd8e8667b1590afb340eb8162dc1f3189d 100644
--- a/indra/newview/llpanelblockedlist.cpp
+++ b/indra/newview/llpanelblockedlist.cpp
@@ -104,7 +104,7 @@ void LLPanelBlockedList::selectBlocked(const LLUUID& mute_id)
 
 void LLPanelBlockedList::showPanelAndSelect(const LLUUID& idToSelect)
 {
-	LLSideTray::getInstance()->showPanel("panel_block_list_sidetray", LLSD().insert(BLOCKED_PARAM_NAME, idToSelect));
+	LLSideTray::getInstance()->showPanel("panel_block_list_sidetray", LLSD().with(BLOCKED_PARAM_NAME, idToSelect));
 }
 
 
diff --git a/indra/newview/llpanellandmarks.cpp b/indra/newview/llpanellandmarks.cpp
index 413d8ed7567ec6ad678f8ea395f5a7dc409cb18a..3af18bb751b237833022e5b6b2a9a7d00687a608 100644
--- a/indra/newview/llpanellandmarks.cpp
+++ b/indra/newview/llpanellandmarks.cpp
@@ -596,11 +596,11 @@ void LLLandmarksPanel::onAddAction(const LLSD& userdata) const
 		if(landmark)
 		{
 			LLSideTray::getInstance()->showPanel("panel_places", 
-								LLSD().insert("type", "landmark").insert("id",landmark->getUUID()));
+								LLSD().with("type", "landmark").with("id",landmark->getUUID()));
 		}
 		else
 		{
-			LLSideTray::getInstance()->showPanel("panel_places", LLSD().insert("type", "create_landmark"));
+			LLSideTray::getInstance()->showPanel("panel_places", LLSD().with("type", "create_landmark"));
 		}
 	} 
 	else if ("category" == command_name)
diff --git a/indra/newview/llpanelpeople.cpp b/indra/newview/llpanelpeople.cpp
index 6771bb417009fc430fc091444a19689ab5a1fc09..1743df52fc629fd38b1e055d1b13da27871f56cc 100644
--- a/indra/newview/llpanelpeople.cpp
+++ b/indra/newview/llpanelpeople.cpp
@@ -1298,7 +1298,7 @@ void LLPanelPeople::notifyChildren(const LLSD& info)
 		if (container->getCurrentPanelIndex() > 0) 
 		{
 			// if not on the default panel, switch to it
-			container->onOpen(LLSD().insert(LLSideTrayPanelContainer::PARAM_SUB_PANEL_NAME, getName()));
+			container->onOpen(LLSD().with(LLSideTrayPanelContainer::PARAM_SUB_PANEL_NAME, getName()));
 		}
 		else
 			LLSideTray::getInstance()->collapseSideBar();
diff --git a/indra/newview/llpanelprofile.cpp b/indra/newview/llpanelprofile.cpp
index 4d152a13f306c516214156a1b7bfa22c51340710..1830d00f6831f48b13692697fe78499be038cb45 100644
--- a/indra/newview/llpanelprofile.cpp
+++ b/indra/newview/llpanelprofile.cpp
@@ -68,7 +68,7 @@ class LLAgentHandler : public LLCommandHandler
 
 		if (verb == "inspect")
 		{
-			LLFloaterReg::showInstance("inspect_avatar", LLSD().insert("avatar_id", avatar_id));
+			LLFloaterReg::showInstance("inspect_avatar", LLSD().with("avatar_id", avatar_id));
 			return true;
 		}
 
diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp
index db8bda008ebdb5b9c29a4d909eda88a6cd00273d..50c20bc98f4d8d1ff65c147b3b6d60a3e94ef0eb 100644
--- a/indra/newview/llstartup.cpp
+++ b/indra/newview/llstartup.cpp
@@ -482,7 +482,7 @@ bool idle_startup()
 		{
 			std::string diagnostic = "Could not start address resolution system";
 			LL_WARNS("AppInit") << diagnostic << LL_ENDL;
-			LLAppViewer::instance()->earlyExit("LoginFailedNoNetwork", LLSD().insert("DIAGNOSTIC", diagnostic));
+			LLAppViewer::instance()->earlyExit("LoginFailedNoNetwork", LLSD().with("DIAGNOSTIC", diagnostic));
 		}
 		
 		//
@@ -553,7 +553,7 @@ bool idle_startup()
 			{
 				std::string diagnostic = llformat(" Error: %d", gMessageSystem->getErrorCode());
 				LL_WARNS("AppInit") << diagnostic << LL_ENDL;
-				LLAppViewer::instance()->earlyExit("LoginFailedNoNetwork", LLSD().insert("DIAGNOSTIC", diagnostic));
+				LLAppViewer::instance()->earlyExit("LoginFailedNoNetwork", LLSD().with("DIAGNOSTIC", diagnostic));
 			}
 
 			#if LL_WINDOWS
@@ -576,7 +576,7 @@ bool idle_startup()
 		}
 		else
 		{
-			LLAppViewer::instance()->earlyExit("MessageTemplateNotFound", LLSD().insert("PATH", message_template_path));
+			LLAppViewer::instance()->earlyExit("MessageTemplateNotFound", LLSD().with("PATH", message_template_path));
 		}
 
 		if(gMessageSystem && gMessageSystem->isOK())
diff --git a/indra/newview/lluilistener.cpp b/indra/newview/lluilistener.cpp
index 8b4cfa72481582dcafabaef2e0cb4f9b0316bf70..3ad9887bec8cc96f77c03cdff8374c4369c6aa1c 100644
--- a/indra/newview/lluilistener.cpp
+++ b/indra/newview/lluilistener.cpp
@@ -29,7 +29,7 @@ LLUIListener::LLUIListener():
         "Invoke the operation named by [\"function\"], passing [\"parameter\"],\n"
         "as if from a user gesture on a menu -- or a button click.",
         &LLUIListener::call,
-        LLSD().insert("function", LLSD()));
+        LLSD().with("function", LLSD()));
 }
 
 void LLUIListener::call(const LLSD& event) const
diff --git a/indra/newview/llviewerkeyboard.cpp b/indra/newview/llviewerkeyboard.cpp
index 8fd646ee932a9a808805f801e0c41d02cc782e09..f757155b9429713eab1d21007b16fccae6c1efe7 100644
--- a/indra/newview/llviewerkeyboard.cpp
+++ b/indra/newview/llviewerkeyboard.cpp
@@ -538,8 +538,9 @@ void start_chat( EKeystate s )
 
 void start_gesture( EKeystate s )
 {
+	LLUICtrl* focus_ctrlp = dynamic_cast<LLUICtrl*>(gFocusMgr.getKeyboardFocus());
 	if (KEYSTATE_UP == s &&
-		!(gFocusMgr.getKeyboardFocus() && dynamic_cast<LLUICtrl*>(gFocusMgr.getKeyboardFocus())->acceptsTextInput()))
+		! (focus_ctrlp && focus_ctrlp->acceptsTextInput()))
 	{
  		if (LLNearbyChatBar::getInstance()->getCurrentChat().empty())
  		{
diff --git a/indra/newview/llviewermedia.cpp b/indra/newview/llviewermedia.cpp
index d5fd23ac51da89039d1611effa8c870c93c8c8b6..858aab300baad5169da4e874e02c2d9f07aaf221 100644
--- a/indra/newview/llviewermedia.cpp
+++ b/indra/newview/llviewermedia.cpp
@@ -45,6 +45,9 @@
 #include "llviewertexturelist.h"
 #include "llvovolume.h"
 #include "llpluginclassmedia.h"
+#include "llviewerwindow.h"
+#include "llfocusmgr.h"
+#include "llcallbacklist.h"
 
 #include "llevent.h"		// LLSimpleListener
 #include "llnotificationsutil.h"
@@ -55,7 +58,7 @@
 #include <boost/bind.hpp>	// for SkinFolder listener
 #include <boost/signals2.hpp>
 
-/*static*/ const char* LLViewerMedia::AUTO_PLAY_MEDIA_SETTING = "AutoPlayMedia";
+/*static*/ const char* LLViewerMedia::AUTO_PLAY_MEDIA_SETTING = "ParcelMediaAutoPlayEnable";
 
 // Move this to its own file.
 
@@ -327,6 +330,8 @@ viewer_media_t LLViewerMedia::updateMediaImpl(LLMediaEntry* media_entry, const s
 		media_impl->mMediaLoop = media_entry->getAutoLoop();
 		media_impl->mMediaWidth = media_entry->getWidthPixels();
 		media_impl->mMediaHeight = media_entry->getHeightPixels();
+		media_impl->mMediaAutoPlay = media_entry->getAutoPlay();
+		media_impl->mMediaEntryURL = media_entry->getCurrentURL();
 		if (media_impl->mMediaSource)
 		{
 			media_impl->mMediaSource->setAutoScale(media_impl->mMediaAutoScale);
@@ -334,8 +339,8 @@ viewer_media_t LLViewerMedia::updateMediaImpl(LLMediaEntry* media_entry, const s
 			media_impl->mMediaSource->setSize(media_entry->getWidthPixels(), media_entry->getHeightPixels());
 		}
 		
-		bool url_changed = (media_entry->getCurrentURL() != previous_url);
-		if(media_entry->getCurrentURL().empty())
+		bool url_changed = (media_impl->mMediaEntryURL != previous_url);
+		if(media_impl->mMediaEntryURL.empty())
 		{
 			if(url_changed)
 			{
@@ -350,7 +355,7 @@ viewer_media_t LLViewerMedia::updateMediaImpl(LLMediaEntry* media_entry, const s
 			// The current media URL is not empty.
 			// If (the media was already loaded OR the media was set to autoplay) AND this update didn't come from this agent,
 			// do a navigate.
-			bool auto_play = (media_entry->getAutoPlay() && gSavedSettings.getBOOL(AUTO_PLAY_MEDIA_SETTING));
+			bool auto_play = (media_impl->mMediaAutoPlay && gSavedSettings.getBOOL(AUTO_PLAY_MEDIA_SETTING));
 			
 			if((was_loaded || auto_play) && !update_from_self)
 			{
@@ -372,8 +377,10 @@ viewer_media_t LLViewerMedia::updateMediaImpl(LLMediaEntry* media_entry, const s
 			media_entry->getAutoLoop());
 		
 		media_impl->setHomeURL(media_entry->getHomeURL());
+		media_impl->mMediaAutoPlay = media_entry->getAutoPlay();
+		media_impl->mMediaEntryURL = media_entry->getCurrentURL();
 		
-		if(media_entry->getAutoPlay() && gSavedSettings.getBOOL(AUTO_PLAY_MEDIA_SETTING))
+		if(media_impl->mMediaAutoPlay && gSavedSettings.getBOOL(AUTO_PLAY_MEDIA_SETTING))
 		{
 			needs_navigate = true;
 		}
@@ -381,21 +388,20 @@ viewer_media_t LLViewerMedia::updateMediaImpl(LLMediaEntry* media_entry, const s
 	
 	if(media_impl)
 	{
-		std::string url = media_entry->getCurrentURL();
 		if(needs_navigate)
 		{
-			media_impl->navigateTo(url, "", true, true);
-			lldebugs << "navigating to URL " << url << llendl;
+			media_impl->navigateTo(media_impl->mMediaEntryURL, "", true, true);
+			lldebugs << "navigating to URL " << media_impl->mMediaEntryURL << llendl;
 		}
-		else if(!media_impl->mMediaURL.empty() && (media_impl->mMediaURL != url))
+		else if(!media_impl->mMediaURL.empty() && (media_impl->mMediaURL != media_impl->mMediaEntryURL))
 		{
 			// If we already have a non-empty media URL set and we aren't doing a navigate, update the media URL to match the media entry.
-			media_impl->mMediaURL = url;
+			media_impl->mMediaURL = media_impl->mMediaEntryURL;
 
 			// If this causes a navigate at some point (such as after a reload), it should be considered server-driven so it isn't broadcast.
 			media_impl->mNavigateServerRequest = true;
 
-			lldebugs << "updating URL in the media impl to " << url << llendl;
+			lldebugs << "updating URL in the media impl to " << media_impl->mMediaEntryURL << llendl;
 		}
 	}
 	
@@ -625,7 +631,7 @@ static bool proximity_comparitor(const LLViewerMediaImpl* i1, const LLViewerMedi
 
 //////////////////////////////////////////////////////////////////////////////////////////
 // static
-void LLViewerMedia::updateMedia()
+void LLViewerMedia::updateMedia(void *dummy_arg)
 {
 	impl_list::iterator iter = sViewerMediaImplList.begin();
 	impl_list::iterator end = sViewerMediaImplList.end();
@@ -747,6 +753,19 @@ void LLViewerMedia::updateMedia()
 			impl_count_total++;
 		}
 		
+		// Overrides if the window is minimized or we lost focus (taking care
+		// not to accidentally "raise" the priority either)
+		if (!gViewerWindow->getActive() /* viewer window minimized? */ 
+			&& new_priority > LLPluginClassMedia::PRIORITY_HIDDEN)
+		{
+			new_priority = LLPluginClassMedia::PRIORITY_HIDDEN;
+		}
+		else if (!gFocusMgr.getAppHasFocus() /* viewer window lost focus? */
+				 && new_priority > LLPluginClassMedia::PRIORITY_LOW)
+		{
+			new_priority = LLPluginClassMedia::PRIORITY_LOW;
+		}
+		
 		pimpl->setPriority(new_priority);
 		
 		if(pimpl->getUsedInUI())
@@ -783,11 +802,18 @@ void LLViewerMedia::updateMedia()
 
 }
 
+//////////////////////////////////////////////////////////////////////////////////////////
+// static
+void LLViewerMedia::initClass()
+{
+	gIdleCallbacks.addFunction(LLViewerMedia::updateMedia, NULL);
+}
+
 //////////////////////////////////////////////////////////////////////////////////////////
 // static
 void LLViewerMedia::cleanupClass()
 {
-	// This is no longer necessary, since sViewerMediaImplList is no longer smart pointers.
+	gIdleCallbacks.deleteFunction(LLViewerMedia::updateMedia, NULL);
 }
 
 //////////////////////////////////////////////////////////////////////////////////////////
@@ -830,6 +856,7 @@ LLViewerMediaImpl::LLViewerMediaImpl(	  const LLUUID& texture_id,
 	mProximity(-1),
 	mProximityDistance(0.0f),
 	mMimeTypeProbe(NULL),
+	mMediaAutoPlay(false),
 	mIsUpdated(false)
 { 
 
@@ -1911,6 +1938,33 @@ void LLViewerMediaImpl::resetPreviousMediaState()
 	mPreviousMediaTime = 0.0f;
 }
 
+
+//////////////////////////////////////////////////////////////////////////////////////////
+//
+void LLViewerMediaImpl::setDisabled(bool disabled)
+{
+	if(mIsDisabled != disabled)
+	{
+		// Only do this on actual state transitions.
+		mIsDisabled = disabled;
+		
+		if(mIsDisabled)
+		{
+			// We just disabled this media.  Clear all state.
+			unload();
+		}
+		else
+		{
+			// We just (re)enabled this media.  Do a navigate if auto-play is in order.
+			if(mMediaAutoPlay && gSavedSettings.getBOOL(LLViewerMedia::AUTO_PLAY_MEDIA_SETTING))
+			{
+				navigateTo(mMediaEntryURL, "", true, true);
+			}
+		}
+
+	}
+};
+
 //////////////////////////////////////////////////////////////////////////////////////////
 //
 bool LLViewerMediaImpl::isForcedUnloaded() const
diff --git a/indra/newview/llviewermedia.h b/indra/newview/llviewermedia.h
index e2d159304f4d58b91b7fc14dc7eeb4a792fcdc13..713eb2710b12179795143541c1a24cde1bc32d16 100644
--- a/indra/newview/llviewermedia.h
+++ b/indra/newview/llviewermedia.h
@@ -96,9 +96,10 @@ class LLViewerMedia
 		static bool textureHasMedia(const LLUUID& texture_id);
 		static void setVolume(F32 volume);
 
-		static void updateMedia();
+		static void updateMedia(void* dummy_arg = NULL);
 		static bool isMusicPlaying();
 
+		static void initClass();
 		static void cleanupClass();
 
 		static void toggleMusicPlay(void*);
@@ -201,7 +202,7 @@ class LLViewerMediaImpl
 	bool isMediaFailed() const { return mMediaSourceFailed; };
 	void resetPreviousMediaState();
 	
-	void setDisabled(bool disabled) { mIsDisabled = disabled; };
+	void setDisabled(bool disabled);
 	bool isMediaDisabled() const { return mIsDisabled; };
 
 	// returns true if this instance should not be loaded (disabled, muted object, crashed, etc.)
@@ -345,6 +346,8 @@ class LLViewerMediaImpl
 	S32 mProximity;
 	F64 mProximityDistance;
 	LLMimeDiscoveryResponder *mMimeTypeProbe;
+	bool mMediaAutoPlay;
+	std::string mMediaEntryURL;
 	
 private:
 	BOOL mIsUpdated ;
diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp
index 34d07f3284267d0a241cbf18ca74975c88027683..0b40492391f7ceef070cd0fdfb434093f7a14af6 100644
--- a/indra/newview/llviewermenu.cpp
+++ b/indra/newview/llviewermenu.cpp
@@ -5360,7 +5360,7 @@ class LLWorldCreateLandmark : public view_listener_t
 {
 	bool handleEvent(const LLSD& userdata)
 	{
-		LLSideTray::getInstance()->showPanel("panel_places", LLSD().insert("type", "create_landmark"));
+		LLSideTray::getInstance()->showPanel("panel_places", LLSD().with("type", "create_landmark"));
 
 		return true;
 	}
diff --git a/indra/newview/llviewertexturelist.cpp b/indra/newview/llviewertexturelist.cpp
index dbcf5630102c514dc6653c912f8cba0c8934c57d..5be7f2945fb53a294af3df4bee3fcd27264d868f 100644
--- a/indra/newview/llviewertexturelist.cpp
+++ b/indra/newview/llviewertexturelist.cpp
@@ -614,10 +614,6 @@ void LLViewerTextureList::updateImages(F32 max_time)
 			didone = image->doLoadedCallbacks();
 		}
 	}
-	if (!gNoRender && !gGLManager.mIsDisabled)
-	{
-		LLViewerMedia::updateMedia();
-	}
 	updateImagesUpdateStats();
 }
 
diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp
index 9ba056a17c0e60db1968e84ba42e276e8e900c93..8529a935271a2c2afdd2ce0a404b27897eeb8ab7 100644
--- a/indra/newview/llviewerwindow.cpp
+++ b/indra/newview/llviewerwindow.cpp
@@ -1011,6 +1011,7 @@ BOOL LLViewerWindow::handleActivate(LLWindow *window, BOOL activated)
 	else
 	{
 		mActive = FALSE;
+				
 		if (gSavedSettings.getBOOL("AllowIdleAFK"))
 		{
 			gAgent.setAFK();
@@ -3244,8 +3245,7 @@ LLPickInfo LLViewerWindow::pickImmediate(S32 x, S32 y_from_bot,  BOOL pick_trans
 	}
 	else
 	{
-		llwarns << "List of last picks is empty" << llendl;
-		llwarns << "Using stub pick" << llendl;
+		lldebugs << "List of last picks is empty: Using stub pick" << llendl;
 		mLastPick = LLPickInfo();
 	}
 
diff --git a/indra/newview/llworldmapview.cpp b/indra/newview/llworldmapview.cpp
index 60b1e5964587e8401b3104b8d6853d34dcdd32c7..e6857ea780064fceaa9931c88d83a1f12b183932 100644
--- a/indra/newview/llworldmapview.cpp
+++ b/indra/newview/llworldmapview.cpp
@@ -1728,20 +1728,20 @@ BOOL LLWorldMapView::handleDoubleClick( S32 x, S32 y, MASK mask )
 				id.toString(uuid_str);
 				uuid_str = uuid_str.substr(28);
 				sscanf(uuid_str.c_str(), "%X", &event_id);
-				LLFloaterReg::showInstance("search", LLSD().insert("category", "events").insert("id", event_id));
+				LLFloaterReg::showInstance("search", LLSD().with("category", "events").with("id", event_id));
 				break;
 			}
 		case MAP_ITEM_LAND_FOR_SALE:
 		case MAP_ITEM_LAND_FOR_SALE_ADULT:
 			{
 				LLFloaterReg::hideInstance("world_map");
-				LLFloaterReg::showInstance("search", LLSD().insert("category", "destinations").insert("id", id));
+				LLFloaterReg::showInstance("search", LLSD().with("category", "destinations").with("id", id));
 				break;
 			}
 		case MAP_ITEM_CLASSIFIED:
 			{
 				LLFloaterReg::hideInstance("world_map");
-				LLFloaterReg::showInstance("search", LLSD().insert("category", "classifieds").insert("id", id));
+				LLFloaterReg::showInstance("search", LLSD().with("category", "classifieds").with("id", id));
 				break;
 			}
 		default:
diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp
index 21b297c4eef91a2a7a75313ad6928c0bf2f5ae15..282eddf380d395f02bc5ebdfd8403d3f6cb2ce57 100644
--- a/indra/newview/pipeline.cpp
+++ b/indra/newview/pipeline.cpp
@@ -7189,6 +7189,10 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in)
 			gGL.getTexUnit(0)->unbind(LLTexUnit::TT_TEXTURE);
 			glClearColor(0,0,0,0);
 			mWaterRef.bindTarget();
+			gGL.setColorMask(true, true);
+			mWaterRef.clear();
+			gGL.setColorMask(true, false);
+
 			mWaterRef.getViewport(gGLViewport);
 			
 			stop_glerror();
@@ -7221,6 +7225,21 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in)
 			U32 ref_mask = 0;
 			if (LLDrawPoolWater::sNeedsDistortionUpdate)
 			{
+				//initial sky pass (no user clip plane)
+				{ //mask out everything but the sky
+					U32 tmp = mRenderTypeMask;
+					mRenderTypeMask = tmp & ((1 << LLPipeline::RENDER_TYPE_SKY) |
+										(1 << LLPipeline::RENDER_TYPE_WL_SKY));
+					static LLCullResult result;
+					updateCull(camera, result);
+					stateSort(camera, result);
+					mRenderTypeMask = tmp & ((1 << LLPipeline::RENDER_TYPE_SKY) |
+										(1 << LLPipeline::RENDER_TYPE_CLOUDS) |
+										(1 << LLPipeline::RENDER_TYPE_WL_SKY));
+					renderGeom(camera, TRUE);
+					mRenderTypeMask = tmp;
+				}
+
 				U32 mask = mRenderTypeMask;
 				mRenderTypeMask &=	~((1<<LLPipeline::RENDER_TYPE_WATER) |
 									  (1<<LLPipeline::RENDER_TYPE_GROUND) |
@@ -7248,10 +7267,6 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in)
 					LLGLDisable cull(GL_CULL_FACE);
 					updateCull(camera, ref_result, 1);
 					stateSort(camera, ref_result);
-					gGL.setColorMask(true, true);
-					mWaterRef.clear();
-					gGL.setColorMask(true, false);
-
 				}
 				else
 				{
@@ -7264,22 +7279,6 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in)
 				mRenderTypeMask = mask;
 			}
 
-			//initial sky pass (no user clip plane)
-			{ //mask out everything but the sky
-				U32 tmp = mRenderTypeMask;
-				mRenderTypeMask = tmp & ((1 << LLPipeline::RENDER_TYPE_SKY) |
-									(1 << LLPipeline::RENDER_TYPE_WL_SKY));
-				static LLCullResult result;
-				updateCull(camera, result);
-				stateSort(camera, result);
-				mRenderTypeMask = tmp & ((1 << LLPipeline::RENDER_TYPE_SKY) |
-									(1 << LLPipeline::RENDER_TYPE_CLOUDS) |
-									(1 << LLPipeline::RENDER_TYPE_WL_SKY));
-				renderGeom(camera, TRUE);
-				mRenderTypeMask = tmp;
-			}
-
-
 			if (LLDrawPoolWater::sNeedsDistortionUpdate)
 			{
 				mRenderTypeMask = ref_mask;
diff --git a/indra/newview/skins/default/xui/en/panel_preferences_privacy.xml b/indra/newview/skins/default/xui/en/panel_preferences_privacy.xml
index 23832ba120b728cc7e9090681b6c22ecc68922a6..29e9b476eb70a8dadb6f66d09f57f01d19a36e03 100644
--- a/indra/newview/skins/default/xui/en/panel_preferences_privacy.xml
+++ b/indra/newview/skins/default/xui/en/panel_preferences_privacy.xml
@@ -78,7 +78,7 @@
      top_pad="10"
      width="350" />
     <check_box
-     control_name="AutoPlayMedia"
+     control_name="ParcelMediaAutoPlayEnable"
      height="16"
      label="Allow Media Autoplay"
      layout="topleft"
@@ -86,15 +86,6 @@
      name="autoplay_enabled"
      top_pad="10"
      width="350" />
-    <check_box
-     control_name="ParcelMediaAutoPlayEnable"
-     height="16"
-     label="Automatically Play Parcel Media"
-     layout="topleft"
-     left="30"
-     name="parcel_autoplay_enabled"
-     top_pad="10"
-     width="350" />
    <text
       type="string"
     length="1"